Fix sound-on-use spam (#7342)

This commit is contained in:
Leon Friedrich
2022-03-30 22:01:32 +13:00
committed by GitHub
parent 4bc73ac591
commit d55c9574c8
3 changed files with 32 additions and 4 deletions

View File

@@ -41,10 +41,13 @@ namespace Content.Server.Sound
TryEmitSound(component);
}
private void HandleEmitSoundOnUseInHand(EntityUid eUI, BaseEmitSoundComponent component, UseInHandEvent arg)
private void HandleEmitSoundOnUseInHand(EntityUid eUI, EmitSoundOnUseComponent component, UseInHandEvent arg)
{
// Intentionally not handling interaction. This component is an easy way to add sounds in addition to other behavior.
// Intentionally not checking whether the interaction has already been handled.
TryEmitSound(component);
if (component.Handle)
arg.Handled = true;
}
private void HandleEmitSoundOnThrown(EntityUid eUI, BaseEmitSoundComponent component, ThrownEvent arg)
@@ -52,10 +55,13 @@ namespace Content.Server.Sound
TryEmitSound(component);
}
private void HandleEmitSoundOnActivateInWorld(EntityUid eUI, BaseEmitSoundComponent component, ActivateInWorldEvent arg)
private void HandleEmitSoundOnActivateInWorld(EntityUid eUI, EmitSoundOnActivateComponent component, ActivateInWorldEvent arg)
{
// Intentionally not handling interaction. This component is an easy way to add sounds in addition to other behavior.
// Intentionally not checking whether the interaction has already been handled.
TryEmitSound(component);
if (component.Handle)
arg.Handled = true;
}
private void TryEmitSound(BaseEmitSoundComponent component)