mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Add red-orange pulsing "Nothing!" to the second phase of an a 0-quantity trade, and improve the distance merchants are visible at.
This commit is contained in:
parent
a2999ce96f
commit
76da18da3c
@ -55,6 +55,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Mountain peak and lake markers on the map
|
||||
- There's now a checkbox in the graphics tab to opt-in to receiving lossily-compressed terrain colors.
|
||||
- /buff command which allows you to cast a buff on player
|
||||
- Warn the user with an animated red text in the second phase of a trade in which a party is offering nothing.
|
||||
|
||||
### Changed
|
||||
|
||||
|
@ -951,6 +951,7 @@ impl Hud {
|
||||
let bodies = ecs.read_storage::<comp::Body>();
|
||||
let items = ecs.read_storage::<comp::Item>();
|
||||
let inventories = ecs.read_storage::<comp::Inventory>();
|
||||
let players = ecs.read_storage::<comp::Player>();
|
||||
let msm = ecs.read_resource::<MaterialStatManifest>();
|
||||
let entities = ecs.entities();
|
||||
let me = client.entity();
|
||||
@ -1527,6 +1528,7 @@ impl Hud {
|
||||
&hp_floater_lists,
|
||||
&uids,
|
||||
&inventories,
|
||||
players.maybe(),
|
||||
)
|
||||
.join()
|
||||
.filter(|t| {
|
||||
@ -1549,10 +1551,15 @@ impl Hud {
|
||||
hpfl,
|
||||
uid,
|
||||
inventory,
|
||||
player,
|
||||
)| {
|
||||
// Use interpolated position if available
|
||||
let pos = interpolated.map_or(pos.0, |i| i.pos);
|
||||
let in_group = client.group_members().contains_key(uid);
|
||||
// TODO: once the site2 rework lands and merchants have dedicated stalls or
|
||||
// buildings, they no longer need to be emphasized via the higher overhead
|
||||
// text radius relative to other NPCs
|
||||
let is_merchant = stats.name == "Merchant" && player.is_none();
|
||||
let dist_sqr = pos.distance_squared(player_pos);
|
||||
// Determine whether to display nametag and healthbar based on whether the
|
||||
// entity has been damaged, is targeted/selected, or is in your group
|
||||
@ -1562,9 +1569,10 @@ impl Hud {
|
||||
(info.target_entity.map_or(false, |e| e == entity)
|
||||
|| info.selected_entity.map_or(false, |s| s.0 == entity)
|
||||
|| health.map_or(true, overhead::should_show_healthbar)
|
||||
|| in_group)
|
||||
|| in_group
|
||||
|| is_merchant)
|
||||
&& dist_sqr
|
||||
< (if in_group {
|
||||
< (if in_group || is_merchant {
|
||||
NAMETAG_GROUP_RANGE
|
||||
} else if hpfl
|
||||
.time_since_last_dmg_by_me
|
||||
|
@ -400,6 +400,7 @@ impl<'a> Trade<'a> {
|
||||
.resize(2 * MAX_TRADE_SLOTS, &mut ui.widget_id_generator());
|
||||
});
|
||||
}
|
||||
let mut total_quantity = 0;
|
||||
for i in 0..MAX_TRADE_SLOTS {
|
||||
let slot = tradeslots.get(i).cloned().unwrap_or(TradeSlot {
|
||||
index: i,
|
||||
@ -408,6 +409,7 @@ impl<'a> Trade<'a> {
|
||||
ours,
|
||||
entity,
|
||||
});
|
||||
total_quantity += slot.quantity;
|
||||
let itemname = slot
|
||||
.invslot
|
||||
.and_then(|i| inventory.get(i))
|
||||
@ -426,6 +428,19 @@ impl<'a> Trade<'a> {
|
||||
))
|
||||
.set(state.ids.inv_textslots[i + who * MAX_TRADE_SLOTS], ui);
|
||||
}
|
||||
if total_quantity == 0 {
|
||||
Text::new("Nothing!")
|
||||
.top_left_with_margins_on(state.ids.inv_alignment[who], 10.0, 0.0)
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.font_size(self.fonts.cyri.scale(20))
|
||||
.color(Color::Rgba(
|
||||
1.0,
|
||||
0.25 + 0.25 * (4.0 * self.pulse).sin(),
|
||||
0.0,
|
||||
1.0,
|
||||
))
|
||||
.set(state.ids.inv_textslots[who * MAX_TRADE_SLOTS], ui);
|
||||
}
|
||||
}
|
||||
|
||||
fn accept_decline_buttons(
|
||||
|
Loading…
Reference in New Issue
Block a user