mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
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:
commit
cad641f115
@ -22,6 +22,7 @@ impl SoundMgr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn maintain(&mut self, audio: &mut AudioFrontend, client: &Client) {
|
pub fn maintain(&mut self, audio: &mut AudioFrontend, client: &Client) {
|
||||||
|
const SFX_DIST_LIMIT_SQR: f32 = 22500.0;
|
||||||
let ecs = client.state().ecs();
|
let ecs = client.state().ecs();
|
||||||
// Get player position.
|
// Get player position.
|
||||||
let player_pos = ecs
|
let player_pos = ecs
|
||||||
@ -43,6 +44,7 @@ impl SoundMgr {
|
|||||||
ecs.read_storage::<CharacterState>().maybe(),
|
ecs.read_storage::<CharacterState>().maybe(),
|
||||||
)
|
)
|
||||||
.join()
|
.join()
|
||||||
|
.filter(|(_, e_pos, _, _)| (e_pos.0.distance_squared(player_pos)) < SFX_DIST_LIMIT_SQR)
|
||||||
{
|
{
|
||||||
if let (Body::Humanoid(_), Some(character)) = (body, character) {
|
if let (Body::Humanoid(_), Some(character)) = (body, character) {
|
||||||
let state = self
|
let state = self
|
||||||
|
Loading…
x
Reference in New Issue
Block a user