mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Remove dt
and multiplication by 30.
This commit is contained in:
parent
641a5c4cda
commit
571b07d54a
@ -581,8 +581,8 @@ impl Awareness {
|
|||||||
/// Awareness was reached at some point and has not been reset.
|
/// Awareness was reached at some point and has not been reset.
|
||||||
pub fn reached(&self) -> bool { self.reached }
|
pub fn reached(&self) -> bool { self.reached }
|
||||||
|
|
||||||
pub fn change_by(&mut self, amount: f32, dt: f32) {
|
pub fn change_by(&mut self, amount: f32) {
|
||||||
let change = amount * dt * 30.0;
|
let change = amount;
|
||||||
self.level = (self.level + change).clamp(Self::UNAWARE, Self::ALERT);
|
self.level = (self.level + change).clamp(Self::UNAWARE, Self::ALERT);
|
||||||
|
|
||||||
if self.state() == AwarenessState::Alert {
|
if self.state() == AwarenessState::Alert {
|
||||||
|
@ -167,9 +167,7 @@ impl<'a> AgentData<'a> {
|
|||||||
TimerIdle = 0,
|
TimerIdle = 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
agent
|
agent.awareness.change_by(STD_AWARENESS_DECREMENT);
|
||||||
.awareness
|
|
||||||
.change_by(STD_AWARENESS_DECREMENT, read_data.dt.0);
|
|
||||||
|
|
||||||
// Light lanterns at night
|
// Light lanterns at night
|
||||||
// TODO Add a method to turn on NPC lanterns underground
|
// TODO Add a method to turn on NPC lanterns underground
|
||||||
|
@ -249,7 +249,7 @@ fn target_if_attacked(bdata: &mut BehaviorData) -> bool {
|
|||||||
.push_event(ControlEvent::Utterance(UtteranceKind::Angry));
|
.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
|
// Determine whether the new target should be a priority
|
||||||
// over the old one (i.e: because it's either close or
|
// 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);
|
|| agent_data.can_sense_directly_near(tgt_pos);
|
||||||
|
|
||||||
if perceives_target {
|
if perceives_target {
|
||||||
agent.awareness.change_by(0.04, read_data.dt.0);
|
agent.awareness.change_by(0.04);
|
||||||
} else {
|
} else {
|
||||||
agent
|
agent.awareness.change_by(STD_AWARENESS_DECREMENT);
|
||||||
.awareness
|
|
||||||
.change_by(STD_AWARENESS_DECREMENT, read_data.dt.0);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
agent
|
agent.awareness.change_by(STD_AWARENESS_DECREMENT);
|
||||||
.awareness
|
|
||||||
.change_by(STD_AWARENESS_DECREMENT, read_data.dt.0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if bdata.agent.awareness.state() == AwarenessState::Unaware {
|
if bdata.agent.awareness.state() == AwarenessState::Unaware {
|
||||||
|
Loading…
Reference in New Issue
Block a user