mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* init * make it proper * listing, random humanoid appearance to shared * oops * moar * pre-pr cleanup * examine change * partial review * ye * comment * examinable * sounds * TrapInContainer >>>>> * textures * ambience * fix * Change collection to use leftclicking * last minute balance change fuck everything --------- Co-authored-by: SlamBamActionman <slambamactionman@gmail.com>
48 lines
1.4 KiB
C#
48 lines
1.4 KiB
C#
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;
|
|
|
|
/// <summary>
|
|
/// Plays a sound at the target entity.
|
|
/// </summary>
|
|
/// <inheritdoc cref="EntityEffectSystem{T,TEffect}"/>
|
|
public sealed partial class PlaySoundEntityEffectSystem : EntityEffectSystem<TransformComponent, PlaySound>
|
|
{
|
|
[Dependency] private SharedAudioSystem _audio = default!;
|
|
|
|
protected override void Effect(Entity<TransformComponent> entity, ref EntityEffectEvent<PlaySound> 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<PlaySound>
|
|
{
|
|
/// <summary>
|
|
/// The sound to play.
|
|
/// </summary>
|
|
[DataField(required: true)]
|
|
public SoundSpecifier Sound = new SoundCollectionSpecifier("Weh");
|
|
|
|
/// <summary>
|
|
/// Whether the sound is predicted.
|
|
/// Predicted audio requires a user passed in.
|
|
/// </summary>
|
|
[DataField]
|
|
public bool Predicted = true;
|
|
|
|
/// <inheritdoc/>
|
|
public override string EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => string.Empty;
|
|
}
|