mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'holychowders/fix_agents_not_responding_to_sound' into 'master'
Fix agents not hearing sounds due to reduced `listen_dist`, caused by commit `a6955e5af`. See merge request veloren/veloren!3353
This commit is contained in:
commit
005b69edc5
@ -282,7 +282,7 @@ impl<'a> From<&'a Body> for Psyche {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
sight_dist: 40.0,
|
sight_dist: 40.0,
|
||||||
listen_dist: 5.0,
|
listen_dist: 30.0,
|
||||||
aggro_dist: match body {
|
aggro_dist: match body {
|
||||||
Body::Humanoid(_) => Some(20.0),
|
Body::Humanoid(_) => Some(20.0),
|
||||||
_ => None, // Always aggressive if detected
|
_ => None, // Always aggressive if detected
|
||||||
|
@ -1576,18 +1576,13 @@ impl<'a> AgentData<'a> {
|
|||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: This is a temporary hack. Remove this once footsteps are emitted and
|
let can_sense_directly_near =
|
||||||
// agents are capable of detecting when someone is directly behind them.
|
{ |e_pos: &Pos| e_pos.0.distance_squared(self.pos.0) < 5_f32.powi(2) };
|
||||||
let within_listen_dist = |e_pos: &Pos| {
|
|
||||||
let listen_dist = agent.psyche.listen_dist;
|
|
||||||
|
|
||||||
e_pos.0.distance_squared(self.pos.0) < listen_dist.powi(2)
|
|
||||||
};
|
|
||||||
|
|
||||||
let is_detected = |entity: EcsEntity, e_pos: &Pos| {
|
let is_detected = |entity: EcsEntity, e_pos: &Pos| {
|
||||||
let chance = thread_rng().gen_bool(0.3);
|
let chance = thread_rng().gen_bool(0.3);
|
||||||
|
|
||||||
(within_listen_dist(e_pos) && chance)
|
(can_sense_directly_near(e_pos) && chance)
|
||||||
|| self.can_see_entity(agent, controller, entity, e_pos, read_data)
|
|| self.can_see_entity(agent, controller, entity, e_pos, read_data)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user