Fix: Grenades don't make trigger sound (#25321)
* Fix: Grenades don't make trigger sound * transform instead of trycomp transform --------- Co-authored-by: Plykiya <plykiya@protonmail.com> (cherry picked from commit 7d94cc719c4c7c6cbffbe4b7aad72f36ed689621)
This commit is contained in:
parent
33b647a4da
commit
afcae40a0a
|
|
@ -29,6 +29,8 @@ using Robust.Shared.Physics.Events;
|
|||
using Robust.Shared.Physics.Systems;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Player;
|
||||
using Content.Shared.Coordinates;
|
||||
|
||||
namespace Content.Server.Explosion.EntitySystems
|
||||
{
|
||||
|
|
@ -103,9 +105,15 @@ namespace Content.Server.Explosion.EntitySystems
|
|||
|
||||
private void OnSoundTrigger(EntityUid uid, SoundOnTriggerComponent component, TriggerEvent args)
|
||||
{
|
||||
_audio.PlayPvs(component.Sound, uid);
|
||||
if (component.RemoveOnTrigger)
|
||||
RemCompDeferred<SoundOnTriggerComponent>(uid);
|
||||
if (component.RemoveOnTrigger) // if the component gets removed when it's triggered
|
||||
{
|
||||
var xform = Transform(uid);
|
||||
_audio.PlayPvs(component.Sound, xform.Coordinates); // play the sound at its last known coordinates
|
||||
}
|
||||
else // if the component doesn't get removed when triggered
|
||||
{
|
||||
_audio.PlayPvs(component.Sound, uid); // have the sound follow the entity itself
|
||||
}
|
||||
}
|
||||
|
||||
private void OnAnchorTrigger(EntityUid uid, AnchorOnTriggerComponent component, TriggerEvent args)
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@
|
|||
sprite: Objects/Weapons/Grenades/flashbang.rsi
|
||||
- type: FlashOnTrigger
|
||||
range: 7
|
||||
- type: EmitSoundOnTrigger
|
||||
- type: SoundOnTrigger
|
||||
sound:
|
||||
path: "/Audio/Effects/flash_bang.ogg"
|
||||
- type: DeleteOnTrigger
|
||||
|
|
|
|||
Loading…
Reference in New Issue