Files
tbd-station-14/Content.Server/Destructible/Thresholds/Behaviors/PlaySoundBehavior.cs

23 lines
757 B
C#

using Content.Shared.Audio;
using Robust.Shared.Audio;
using Robust.Shared.Player;
namespace Content.Server.Destructible.Thresholds.Behaviors
{
[Serializable]
[DataDefinition]
public sealed partial class PlaySoundBehavior : IThresholdBehavior
{
/// <summary>
/// Sound played upon destruction.
/// </summary>
[DataField("sound", required: true)] public SoundSpecifier Sound { get; set; } = default!;
public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
{
var pos = system.EntityManager.GetComponent<TransformComponent>(owner).Coordinates;
system.EntityManager.System<SharedAudioSystem>().PlayPvs(Sound, pos);
}
}
}