From bc20744cd39f6e67eb511d9dbe7968145305f62c Mon Sep 17 00:00:00 2001 From: holychowders Date: Sun, 14 Aug 2022 15:24:43 -0500 Subject: [PATCH] Remove old unused awareness stuff. --- common/src/comp/agent.rs | 31 ------------------------------- server/agent/src/action_nodes.rs | 3 --- server/agent/src/consts.rs | 1 - 3 files changed, 35 deletions(-) diff --git a/common/src/comp/agent.rs b/common/src/comp/agent.rs index 65d000d25a..aa6cfbbb59 100644 --- a/common/src/comp/agent.rs +++ b/common/src/comp/agent.rs @@ -18,7 +18,6 @@ use super::dialogue::Subject; pub const DEFAULT_INTERACTION_TIME: f32 = 3.0; pub const TRADE_INTERACTION_TIME: f32 = 300.0; -const AWARENESS_DECREMENT_CONSTANT: f32 = 2.1; const SECONDS_BEFORE_FORGET_SOUNDS: f64 = 180.0; #[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] @@ -507,7 +506,6 @@ pub struct Agent { pub timer: Timer, pub bearing: Vec2, pub sounds_heard: Vec, - pub awareness: f32, pub position_pid_controller: Option, Vec3) -> f32, 16>>, } @@ -535,7 +533,6 @@ impl Agent { timer: Timer::default(), bearing: Vec2::zero(), sounds_heard: Vec::new(), - awareness: 0.0, position_pid_controller: None, } } @@ -587,34 +584,6 @@ impl Agent { self } - pub fn decrement_awareness(&mut self, dt: f32) { - let mut decrement = dt * AWARENESS_DECREMENT_CONSTANT; - let awareness = self.awareness; - - let too_high = awareness >= 100.0; - let high = awareness >= 50.0; - let medium = awareness >= 30.0; - let low = awareness > 15.0; - let positive = awareness >= 0.0; - let negative = awareness < 0.0; - - if too_high { - decrement *= 3.0; - } else if high { - decrement *= 1.0; - } else if medium { - decrement *= 2.5; - } else if low { - decrement *= 0.70; - } else if positive { - decrement *= 0.5; - } else if negative { - return; - } - - self.awareness -= decrement; - } - pub fn forget_old_sounds(&mut self, time: f64) { if !self.sounds_heard.is_empty() { // Keep (retain) only newer sounds diff --git a/server/agent/src/action_nodes.rs b/server/agent/src/action_nodes.rs index 5d85e1927e..95a5c7fae6 100644 --- a/server/agent/src/action_nodes.rs +++ b/server/agent/src/action_nodes.rs @@ -1254,9 +1254,6 @@ impl<'a> AgentData<'a> { .map_or(false, |stats| stats.name == *"Guard".to_string()); let follows_threatening_sounds = has_enemy_alignment || is_village_guard; - // TODO: Awareness currently doesn't influence anything. - //agent.awareness += 0.5 * sound.vol; - if sound_was_threatening && is_close { if !self.below_flee_health(agent) && follows_threatening_sounds { self.follow(agent, controller, &read_data.terrain, &sound_pos); diff --git a/server/agent/src/consts.rs b/server/agent/src/consts.rs index 24d2f34008..1b1f03eb38 100644 --- a/server/agent/src/consts.rs +++ b/server/agent/src/consts.rs @@ -12,4 +12,3 @@ pub const RETARGETING_THRESHOLD_SECONDS: f64 = 10.0; pub const HEALING_ITEM_THRESHOLD: f32 = 0.5; pub const IDLE_HEALING_ITEM_THRESHOLD: f32 = 0.999; pub const DEFAULT_ATTACK_RANGE: f32 = 2.0; -pub const AWARENESS_INVESTIGATE_THRESHOLD: f32 = 1.0;