From ad4bca3e52e3bc2afe0aeacfad4ba74fcce3b4dd Mon Sep 17 00:00:00 2001 From: holychowders Date: Sun, 23 May 2021 15:38:39 -0700 Subject: [PATCH] Move neutral agent block above enemy block --- server/src/sys/agent.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/server/src/sys/agent.rs b/server/src/sys/agent.rs index f5dc938609..77d4818247 100644 --- a/server/src/sys/agent.rs +++ b/server/src/sys/agent.rs @@ -3870,6 +3870,14 @@ impl<'a> AgentData<'a> { // TODO: Change this to a search action instead of idle self.idle(agent, controller, &read_data); } + } else if is_village_guard { + let sound_is_villager_alarm = matches!(sound.kind, SoundKind::VillagerAlarm); + + if sound_is_villager_alarm { + self.follow(agent, controller, &read_data.terrain, &sound_pos); + } else { + self.idle(agent, controller, &read_data); + } } else if is_neutral { let aggro = agent.psyche.aggro; let close_enough = dist_sqrd < 35.0_f32.powi(2); @@ -3880,14 +3888,6 @@ impl<'a> AgentData<'a> { } else { self.idle(agent, controller, read_data); } - } else if is_village_guard { - let sound_is_villager_alarm = matches!(sound.kind, SoundKind::VillagerAlarm); - - if sound_is_villager_alarm { - self.follow(agent, controller, &read_data.terrain, &sound_pos); - } else { - self.idle(agent, controller, &read_data); - } } else { // TODO: Change this to a search action instead of idle self.idle(agent, controller, read_data);