24 lines
792 B
C#
24 lines
792 B
C#
using Content.Shared.Audio;
|
|
using Robust.Shared.Audio;
|
|
using Robust.Shared.Audio.Systems;
|
|
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);
|
|
}
|
|
}
|
|
}
|