Remove dt and multiplication by 30.

This commit is contained in:
holychowders 2022-11-06 13:10:17 -06:00
parent 641a5c4cda
commit 571b07d54a
3 changed files with 7 additions and 13 deletions

View File

@ -581,8 +581,8 @@ impl Awareness {
/// Awareness was reached at some point and has not been reset.
pub fn reached(&self) -> bool { self.reached }
pub fn change_by(&mut self, amount: f32, dt: f32) {
let change = amount * dt * 30.0;
pub fn change_by(&mut self, amount: f32) {
let change = amount;
self.level = (self.level + change).clamp(Self::UNAWARE, Self::ALERT);
if self.state() == AwarenessState::Alert {

View File

@ -167,9 +167,7 @@ impl<'a> AgentData<'a> {
TimerIdle = 0,
}
agent
.awareness
.change_by(STD_AWARENESS_DECREMENT, read_data.dt.0);
agent.awareness.change_by(STD_AWARENESS_DECREMENT);
// Light lanterns at night
// TODO Add a method to turn on NPC lanterns underground

View File

@ -249,7 +249,7 @@ fn target_if_attacked(bdata: &mut BehaviorData) -> bool {
.push_event(ControlEvent::Utterance(UtteranceKind::Angry));
}
bdata.agent.awareness.change_by(1.0, bdata.read_data.dt.0);
bdata.agent.awareness.change_by(1.0);
// Determine whether the new target should be a priority
// over the old one (i.e: because it's either close or
@ -539,16 +539,12 @@ fn update_target_awareness(bdata: &mut BehaviorData) -> bool {
|| agent_data.can_sense_directly_near(tgt_pos);
if perceives_target {
agent.awareness.change_by(0.04, read_data.dt.0);
agent.awareness.change_by(0.04);
} else {
agent
.awareness
.change_by(STD_AWARENESS_DECREMENT, read_data.dt.0);
agent.awareness.change_by(STD_AWARENESS_DECREMENT);
}
} else {
agent
.awareness
.change_by(STD_AWARENESS_DECREMENT, read_data.dt.0);
agent.awareness.change_by(STD_AWARENESS_DECREMENT);
}
if bdata.agent.awareness.state() == AwarenessState::Unaware {