Remove old unused awareness stuff.

This commit is contained in:
holychowders 2022-08-14 15:24:43 -05:00
parent 712db9adea
commit bc20744cd3
3 changed files with 0 additions and 35 deletions

View File

@ -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<f32>,
pub sounds_heard: Vec<Sound>,
pub awareness: f32,
pub position_pid_controller: Option<PidController<fn(Vec3<f32>, Vec3<f32>) -> 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

View File

@ -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);

View File

@ -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;