Merge branch 'shandley/limit-sfx-range' into 'master'

Set a distance limit on the trigger of sound effects.

See merge request veloren/veloren!516
This commit is contained in:
Marcel 2019-10-04 09:58:58 +00:00
commit 101c563b03

View File

@ -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::<CharacterState>().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