diff --git a/voxygen/src/scene/sound.rs b/voxygen/src/scene/sound.rs index c3e66c6663..975c12da2d 100644 --- a/voxygen/src/scene/sound.rs +++ b/voxygen/src/scene/sound.rs @@ -22,6 +22,7 @@ impl SoundMgr { } pub fn maintain(&mut self, audio: &mut AudioFrontend, client: &Client) { + const SFX_DIST_LIMIT_SQR: f32 = 22500.0; let ecs = client.state().ecs(); // Get player position. let player_pos = ecs @@ -43,6 +44,7 @@ impl SoundMgr { ecs.read_storage::().maybe(), ) .join() + .filter(|(_, e_pos, _, _)| (e_pos.0.distance_squared(player_pos)) < SFX_DIST_LIMIT_SQR) { if let (Body::Humanoid(_), Some(character)) = (body, character) { let state = self