mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 05:27:38 +03:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user