Skip to content

Commit

Permalink
Add sound
Browse files Browse the repository at this point in the history
  • Loading branch information
SlamBamActionman committed Oct 13, 2024
1 parent 261747c commit 800dd4b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Content.Shared/Rootable/RootableComponent.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -51,4 +52,9 @@ public sealed partial class RootableComponent : Component
/// </summary>
[DataField]
public float SpeedModifier = 0.8f;

/// <summary>
/// Sound that plays when rooting is toggled.
/// </summary>
public SoundSpecifier RootSound = new SoundPathSpecifier("/Audio/Voice/Diona/diona_salute.ogg");
}
5 changes: 5 additions & 0 deletions Content.Shared/Rootable/SharedRootableSystem.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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<PuddleComponent> _puddleQuery;

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 800dd4b

Please sign in to comment.