2020-12-23 13:34:57 +01:00
|
|
|
using Content.Shared.Audio;
|
2021-03-21 09:12:03 -07:00
|
|
|
using Robust.Shared.Audio;
|
2023-11-27 22:12:34 +11:00
|
|
|
using Robust.Shared.Audio.Systems;
|
2021-03-21 09:12:03 -07:00
|
|
|
using Robust.Shared.Player;
|
2020-12-23 13:34:57 +01:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.Destructible.Thresholds.Behaviors
|
2020-12-23 13:34:57 +01:00
|
|
|
{
|
2021-02-05 13:41:05 +01:00
|
|
|
[Serializable]
|
2021-03-05 01:08:38 +01:00
|
|
|
[DataDefinition]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class PlaySoundBehavior : IThresholdBehavior
|
2020-12-23 13:34:57 +01:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Sound played upon destruction.
|
|
|
|
|
/// </summary>
|
2021-07-31 19:52:33 +02:00
|
|
|
[DataField("sound", required: true)] public SoundSpecifier Sound { get; set; } = default!;
|
2020-12-23 13:34:57 +01:00
|
|
|
|
2023-02-10 17:45:38 -06:00
|
|
|
public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
|
2020-12-23 13:34:57 +01:00
|
|
|
{
|
2021-11-09 21:24:35 +01:00
|
|
|
var pos = system.EntityManager.GetComponent<TransformComponent>(owner).Coordinates;
|
2023-03-24 13:17:22 +11:00
|
|
|
system.EntityManager.System<SharedAudioSystem>().PlayPvs(Sound, pos);
|
2020-12-23 13:34:57 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|