From 5d5cb28b59225de823d0b3568a1c38fd4fe34073 Mon Sep 17 00:00:00 2001 From: James Melkonian Date: Wed, 14 Sep 2022 19:48:34 +0000 Subject: [PATCH] Fix pet aggro --- CHANGELOG.md | 1 + server/src/sys/agent.rs | 4 ++-- server/src/sys/agent/behavior_tree.rs | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d7807a2fd..1f2bb979d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 new chunk for the initial setting or subsequent change to apply). - Moderators and admins are no longer blocked from logging in when there are too many players. - FXAA now behaves correctly at non-1.0x internal resolutions +- Pets no longer aggro on pet owners after being healed ## [0.13.0] - 2022-07-23 diff --git a/server/src/sys/agent.rs b/server/src/sys/agent.rs index 2696580352..cc4424bccd 100644 --- a/server/src/sys/agent.rs +++ b/server/src/sys/agent.rs @@ -825,8 +825,8 @@ impl<'a> AgentData<'a> { let wants_pickup = matches!(self.body, Some(Body::Humanoid(_))) || matches!(item, item_drop::Body::Consumable); - // The agent will attempt to pickup the item if it wants to pick it up and is - // allowed to + // The agent will attempt to pickup the item if it wants to pick it up and + // is allowed to let attempt_pickup = wants_pickup && read_data .loot_owners diff --git a/server/src/sys/agent/behavior_tree.rs b/server/src/sys/agent/behavior_tree.rs index d6e42217b0..0d07272125 100644 --- a/server/src/sys/agent/behavior_tree.rs +++ b/server/src/sys/agent/behavior_tree.rs @@ -201,7 +201,8 @@ fn react_if_on_fire(bdata: &mut BehaviorData) -> bool { fn target_if_attacked(bdata: &mut BehaviorData) -> bool { match bdata.agent_data.health { Some(health) - if bdata.read_data.time.0 - health.last_change.time.0 < DAMAGE_MEMORY_DURATION => + if bdata.read_data.time.0 - health.last_change.time.0 < DAMAGE_MEMORY_DURATION + && health.last_change.amount < 0.0 => { if let Some(by) = health.last_change.damage_by() { if let Some(attacker) = bdata