diff --git a/Content.Shared/Showers/SharedShowerSystem.cs b/Content.Shared/Showers/SharedShowerSystem.cs index 4f43e557ed2..be3af6228f2 100644 --- a/Content.Shared/Showers/SharedShowerSystem.cs +++ b/Content.Shared/Showers/SharedShowerSystem.cs @@ -1,5 +1,7 @@ using Content.Shared.Interaction; using Content.Shared.Verbs; +using Robust.Shared.Audio; +using Robust.Shared.Audio.Systems; using Robust.Shared.Random; using Robust.Shared.Utility; @@ -9,6 +11,7 @@ public abstract class SharedShowerSystem : EntitySystem { [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; public override void Initialize() { base.Initialize(); @@ -53,6 +56,8 @@ private void OnActivateInWorld(EntityUid uid, ShowerComponent comp, ActivateInWo args.Handled = true; ToggleShowerHead(uid, args.User, comp); + + _audio.PlayPvs(comp.EnableShowerSound, uid); } public void ToggleShowerHead(EntityUid uid, EntityUid? user = null, ShowerComponent? component = null, MetaDataComponent? meta = null) { @@ -68,7 +73,20 @@ private void UpdateAppearance(EntityUid uid, ShowerComponent? component = null) if (!Resolve(uid, ref component)) return; - _appearance.SetData(uid, ShowerVisuals.ShowerVisualState, component.ToggleShower ? ShowerVisualState.Off : ShowerVisualState.On); + _appearance.SetData(uid, ShowerVisuals.ShowerVisualState, component.ToggleShower ? ShowerVisualState.On : ShowerVisualState.Off); + + if (component.ToggleShower) + { + if (component.PlayingStream == null) + { + component.PlayingStream = _audio.PlayPvs(component.LoopingSound, uid, AudioParams.Default.WithLoop(true).WithMaxDistance(5)).Value.Entity; + } + } + else + { + component.PlayingStream = _audio.Stop(component.PlayingStream); + component.PlayingStream = null; + } } } } \ No newline at end of file diff --git a/Content.Shared/Showers/ShowerComponent.cs b/Content.Shared/Showers/ShowerComponent.cs index 550fb4bfbd5..339205546bd 100644 --- a/Content.Shared/Showers/ShowerComponent.cs +++ b/Content.Shared/Showers/ShowerComponent.cs @@ -1,3 +1,4 @@ +using Robust.Shared.Audio; using Robust.Shared.GameStates; using Robust.Shared.Serialization; @@ -15,8 +16,17 @@ public sealed partial class ShowerComponent : Component [DataField, AutoNetworkedField] public bool ToggleShower; + [DataField("enableShowerSound")] + public SoundSpecifier EnableShowerSound = new SoundPathSpecifier("/Audio/Ambience/Objects/shower_enable.ogg"); + + public EntityUid? PlayingStream; + + [DataField("loopingSound")] + public SoundSpecifier LoopingSound = new SoundPathSpecifier("/Audio/Ambience/Objects/shower_running.ogg"); + } + [Serializable, NetSerializable] public enum ShowerVisuals : byte { diff --git a/Resources/Audio/Ambience/Objects/shower_enable.ogg b/Resources/Audio/Ambience/Objects/shower_enable.ogg new file mode 100644 index 00000000000..98f41fbffb1 Binary files /dev/null and b/Resources/Audio/Ambience/Objects/shower_enable.ogg differ diff --git a/Resources/Audio/Ambience/Objects/shower_running.ogg b/Resources/Audio/Ambience/Objects/shower_running.ogg new file mode 100644 index 00000000000..9114b0c7dab Binary files /dev/null and b/Resources/Audio/Ambience/Objects/shower_running.ogg differ diff --git a/Resources/Prototypes/Entities/Structures/Furniture/shower.yml b/Resources/Prototypes/Entities/Structures/Furniture/shower.yml index b2a8037a8b0..e7d31807c78 100644 --- a/Resources/Prototypes/Entities/Structures/Furniture/shower.yml +++ b/Resources/Prototypes/Entities/Structures/Furniture/shower.yml @@ -4,9 +4,12 @@ description: A shower, complete with bluespace water. placement: mode: SnapgridCenter + snap: + - Wallmount components: - type: Sprite sprite: Structures/Furniture/shower.rsi + drawdepth: WallMountedItems layers: - state: shower map: ["enabled", "enum.ShowerVisualState.Off" ] @@ -39,3 +42,4 @@ ShowerVisualState.Off: On: { state: shower_on } Off: { state: shower } + diff --git a/Resources/Prototypes/Recipes/Construction/furniture.yml b/Resources/Prototypes/Recipes/Construction/furniture.yml index 3b964213e23..3ed0c9b9611 100644 --- a/Resources/Prototypes/Recipes/Construction/furniture.yml +++ b/Resources/Prototypes/Recipes/Construction/furniture.yml @@ -607,8 +607,9 @@ icon: sprite: Structures/Furniture/shower.rsi state: shower - objectType: Structure + objectType: Structure placementMode: SnapgridCenter + canRotate: true canBuildInImpassable: false conditions: - !type:TileNotBlocked diff --git a/Resources/Textures/Structures/Furniture/shower.rsi/shower.png b/Resources/Textures/Structures/Furniture/shower.rsi/shower.png index b87be03dc96..4ebce554d1c 100644 Binary files a/Resources/Textures/Structures/Furniture/shower.rsi/shower.png and b/Resources/Textures/Structures/Furniture/shower.rsi/shower.png differ diff --git a/Resources/Textures/Structures/Furniture/shower.rsi/shower_on.png b/Resources/Textures/Structures/Furniture/shower.rsi/shower_on.png index 523da0c8c4a..bf1737c0bb1 100644 Binary files a/Resources/Textures/Structures/Furniture/shower.rsi/shower_on.png and b/Resources/Textures/Structures/Furniture/shower.rsi/shower_on.png differ