diff --git a/CHANGELOG.md b/CHANGELOG.md index 06f2126fb0..df04b03e34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - FXAA now behaves correctly at non-1.0x internal resolutions - Pets no longer aggro on pet owners after being healed - Pets no longer lose their intrinsic weapons/armour when loaded on login. +- Fixed npcs using `/say` instead of `/tell` ## [0.13.0] - 2022-07-23 diff --git a/server/src/sys/agent/behavior_tree.rs b/server/src/sys/agent/behavior_tree.rs index 4b18b4a599..8dce1e5fff 100644 --- a/server/src/sys/agent/behavior_tree.rs +++ b/server/src/sys/agent/behavior_tree.rs @@ -86,7 +86,6 @@ impl BehaviorTree { do_hostile_tree_if_hostile, do_pet_tree_if_owned, do_pickup_loot, - untarget, do_idle_tree, ], } @@ -339,6 +338,7 @@ fn do_pickup_loot(bdata: &mut BehaviorData) -> bool { .controller .push_event(ControlEvent::InventoryEvent(InventoryEvent::Pickup(*uid))); } + bdata.agent.target = None; } else if let Some((bearing, speed)) = bdata.agent.chaser.chase( &*bdata.read_data.terrain, bdata.agent_data.pos.0, @@ -362,14 +362,6 @@ fn do_pickup_loot(bdata: &mut BehaviorData) -> bool { false } -/// Reset the agent's target -/// -/// This function will never stop the BehaviorTree -fn untarget(bdata: &mut BehaviorData) -> bool { - bdata.agent.target = None; - false -} - // If too far away, then follow the target fn follow_if_far_away(bdata: &mut BehaviorData) -> bool { if let Some(Target { target, .. }) = bdata.agent.target { diff --git a/server/src/sys/agent/behavior_tree/interaction.rs b/server/src/sys/agent/behavior_tree/interaction.rs index 8d0a812a30..b905591401 100644 --- a/server/src/sys/agent/behavior_tree/interaction.rs +++ b/server/src/sys/agent/behavior_tree/interaction.rs @@ -489,6 +489,7 @@ pub fn handle_inbox_finished_trade(bdata: &mut BehaviorData) -> bool { }, } agent.behavior.unset(BehaviorState::TRADING); + agent.target = None; } } true @@ -559,6 +560,7 @@ pub fn handle_inbox_update_pending_trade(bdata: &mut BehaviorData) -> bool { if pending.phase != TradePhase::Mutate { // we got into the review phase but without balanced goods, decline agent.behavior.unset(BehaviorState::TRADING); + agent.target = None; event_emitter.emit(ServerEvent::ProcessTradeAction( *agent_data.entity, tradeid, @@ -601,6 +603,7 @@ pub fn handle_inbox_update_pending_trade(bdata: &mut BehaviorData) -> bool { }, TradingBehavior::None => { agent.behavior.unset(BehaviorState::TRADING); + agent.target = None; event_emitter.emit(ServerEvent::ProcessTradeAction( *agent_data.entity, tradeid, @@ -691,6 +694,7 @@ pub fn handle_inbox_cancel_interactions(bdata: &mut BehaviorData) -> bool { }, } agent.behavior.unset(BehaviorState::TRADING); + agent.target = None; } true }, @@ -698,6 +702,7 @@ pub fn handle_inbox_cancel_interactions(bdata: &mut BehaviorData) -> bool { // immediately cancel the trade let (tradeid, _pending, _prices, _inventories) = &**boxval; agent.behavior.unset(BehaviorState::TRADING); + agent.target = None; event_emitter.emit(ServerEvent::ProcessTradeAction( *agent_data.entity, *tradeid,