From 800dd4b60bd6643fff826efccd3ae5677435a022 Mon Sep 17 00:00:00 2001 From: SlamBamActionman Date: Sun, 13 Oct 2024 15:43:45 +0200 Subject: [PATCH] Add sound --- Content.Shared/Rootable/RootableComponent.cs | 6 ++++++ Content.Shared/Rootable/SharedRootableSystem.cs | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/Content.Shared/Rootable/RootableComponent.cs b/Content.Shared/Rootable/RootableComponent.cs index a668df0fc476be..5c6acba5b3972a 100644 --- a/Content.Shared/Rootable/RootableComponent.cs +++ b/Content.Shared/Rootable/RootableComponent.cs @@ -1,5 +1,6 @@ using Content.Shared.Alert; using Content.Shared.FixedPoint; +using Robust.Shared.Audio; using Robust.Shared.GameStates; using Robust.Shared.Prototypes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; @@ -51,4 +52,9 @@ public sealed partial class RootableComponent : Component /// [DataField] public float SpeedModifier = 0.8f; + + /// + /// Sound that plays when rooting is toggled. + /// + public SoundSpecifier RootSound = new SoundPathSpecifier("/Audio/Voice/Diona/diona_salute.ogg"); } diff --git a/Content.Shared/Rootable/SharedRootableSystem.cs b/Content.Shared/Rootable/SharedRootableSystem.cs index 7d9a1424722ec3..f6e13f6fe6b10d 100644 --- a/Content.Shared/Rootable/SharedRootableSystem.cs +++ b/Content.Shared/Rootable/SharedRootableSystem.cs @@ -1,12 +1,14 @@ using Content.Shared.Damage.Components; using Content.Shared.Actions; using Content.Shared.Alert; +using Content.Shared.Coordinates; using Content.Shared.Fluids.Components; using Content.Shared.Gravity; using Content.Shared.Mobs; using Content.Shared.Movement.Systems; using Content.Shared.Slippery; using Content.Shared.Toggleable; +using Robust.Shared.Audio.Systems; using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Events; using Robust.Shared.Physics.Systems; @@ -26,6 +28,7 @@ public abstract class SharedRootableSystem : EntitySystem [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifier = default!; [Dependency] private readonly AlertsSystem _alerts = default!; + [Dependency] private readonly SharedAudioSystem _audioSystem = default!; private EntityQuery _puddleQuery; @@ -81,6 +84,8 @@ public bool TryToggleRooting(EntityUid uid, RootableComponent? rooted = null) else _alerts.ClearAlert(uid, rooted.RootedAlert); + _audioSystem.PlayPredicted(rooted.RootSound, uid.ToCoordinates(), uid); + return true; }