using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Containers;
using Robust.Shared.Network;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
namespace Content.Shared.EntityEffects.Effects;
///
/// Plays a sound at the target entity.
///
///
public sealed partial class PlaySoundEntityEffectSystem : EntityEffectSystem
{
[Dependency] private SharedAudioSystem _audio = default!;
protected override void Effect(Entity entity, ref EntityEffectEvent args)
{
if (args.Effect.Predicted && args.User != null)
{
_audio.PlayPredicted(args.Effect.Sound, entity, args.User);
}
else
{
_audio.PlayPvs(args.Effect.Sound, entity);
}
}
}
public sealed partial class PlaySound : EntityEffectBase
{
///
/// The sound to play.
///
[DataField(required: true)]
public SoundSpecifier Sound = new SoundCollectionSpecifier("Weh");
///
/// Whether the sound is predicted.
/// Predicted audio requires a user passed in.
///
[DataField]
public bool Predicted = true;
///
public override string EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => string.Empty;
}