Fix duplicate mech footstep sounds (#12972)

* Fix duplicate mech footstep sounds

We just add a new component for relay targets so we can use that for audio prediction.

* Fix cwash

* woop
This commit is contained in:
metalgearsloth
2022-12-12 00:18:25 +11:00
committed by GitHub
parent a7a43c8b34
commit 748b79d1df
5 changed files with 106 additions and 5 deletions

View File

@@ -287,7 +287,18 @@ namespace Content.Shared.Movement.Systems
.WithVolume(FootstepVolume * soundModifier)
.WithVariation(sound.Params.Variation ?? FootstepVariation);
_audio.PlayPredicted(sound, mover.Owner, mover.Owner, audioParams);
// If we're a relay target then predict the sound for all relays.
if (TryComp<MovementRelayTargetComponent>(mover.Owner, out var targetComp))
{
foreach (var ent in targetComp.Entities)
{
_audio.PlayPredicted(sound, mover.Owner, ent, audioParams);
}
}
else
{
_audio.PlayPredicted(sound, mover.Owner, mover.Owner, audioParams);
}
}
}