Removed special-casing of merchants

This commit is contained in:
Joshua Barretto 2023-04-03 15:55:44 +01:00
parent 2d7d172f49
commit 5aaee96cb1
3 changed files with 6 additions and 17 deletions

View File

@ -11,5 +11,4 @@
legs: Item("common.items.armor.merchant.pants"), legs: Item("common.items.armor.merchant.pants"),
feet: Item("common.items.armor.merchant.foot"), feet: Item("common.items.armor.merchant.foot"),
lantern: Item("common.items.lantern.black_0"), lantern: Item("common.items.lantern.black_0"),
tabard: Item("common.items.debug.admin"),
) )

View File

@ -475,9 +475,9 @@ fn handle_rtsim_actions(bdata: &mut BehaviorData) -> bool {
match action { match action {
NpcAction::Greet(actor) => { NpcAction::Greet(actor) => {
if bdata.agent.allowed_to_speak() { if bdata.agent.allowed_to_speak() {
if let Some(target) = bdata.read_data.lookup_actor(actor) { if let Some(target) = bdata.read_data.lookup_actor(actor)
let target_pos = bdata.read_data.positions.get(target).map(|pos| pos.0); && let Some(target_pos) = bdata.read_data.positions.get(target)
{
if bdata.agent_data.look_toward( if bdata.agent_data.look_toward(
&mut bdata.controller, &mut bdata.controller,
&bdata.read_data, &bdata.read_data,
@ -488,7 +488,7 @@ fn handle_rtsim_actions(bdata: &mut BehaviorData) -> bool {
false, false,
bdata.read_data.time.0, bdata.read_data.time.0,
false, false,
target_pos, Some(target_pos.0),
)); ));
bdata.controller.push_action(ControlAction::Talk); bdata.controller.push_action(ControlAction::Talk);

View File

@ -212,8 +212,6 @@ const MENU_BG: Color = Color::Rgba(0.1, 0.12, 0.12, 1.0);
/// Distance at which nametags are visible for group members /// Distance at which nametags are visible for group members
const NAMETAG_GROUP_RANGE: f32 = 1000.0; const NAMETAG_GROUP_RANGE: f32 = 1000.0;
/// Distance at which nametags are visible for merchants
const NAMETAG_MERCHANT_RANGE: f32 = 50.0;
/// Distance at which nametags are visible /// Distance at which nametags are visible
const NAMETAG_RANGE: f32 = 40.0; const NAMETAG_RANGE: f32 = 40.0;
/// Time nametags stay visible after doing damage even if they are out of range /// Time nametags stay visible after doing damage even if they are out of range
@ -2268,11 +2266,6 @@ impl Hud {
let pos = interpolated.map_or(pos.0, |i| i.pos); let pos = interpolated.map_or(pos.0, |i| i.pos);
let in_group = client.group_members().contains_key(uid); let in_group = client.group_members().contains_key(uid);
let is_me = entity == me; let is_me = entity == me;
// 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" && client.player_list().get(uid).is_none();
let dist_sqr = pos.distance_squared(player_pos); let dist_sqr = pos.distance_squared(player_pos);
// Determine whether to display nametag and healthbar based on whether the // Determine whether to display nametag and healthbar based on whether the
// entity has been damaged, is targeted/selected, or is in your group // entity has been damaged, is targeted/selected, or is in your group
@ -2282,13 +2275,10 @@ impl Hud {
&& (info.target_entity.map_or(false, |e| e == entity) && (info.target_entity.map_or(false, |e| e == entity)
|| info.selected_entity.map_or(false, |s| s.0 == entity) || info.selected_entity.map_or(false, |s| s.0 == entity)
|| health.map_or(true, overhead::should_show_healthbar) || health.map_or(true, overhead::should_show_healthbar)
|| in_group || in_group)
|| is_merchant)
&& dist_sqr && dist_sqr
< (if in_group { < (if in_group {
NAMETAG_GROUP_RANGE NAMETAG_GROUP_RANGE
} else if is_merchant {
NAMETAG_MERCHANT_RANGE
} else if hpfl } else if hpfl
.time_since_last_dmg_by_me .time_since_last_dmg_by_me
.map_or(false, |t| t < NAMETAG_DMG_TIME) .map_or(false, |t| t < NAMETAG_DMG_TIME)