Skip to content

Commit

Permalink
added audio and wallmount sprite proper
Browse files Browse the repository at this point in the history
  • Loading branch information
SleepyScarecrow committed Aug 11, 2024
1 parent 49472ba commit 30e0435
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 2 deletions.
20 changes: 19 additions & 1 deletion Content.Shared/Showers/SharedShowerSystem.cs
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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();
Expand Down Expand Up @@ -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)
{
Expand All @@ -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;
}
}
}
}
10 changes: 10 additions & 0 deletions Content.Shared/Showers/ShowerComponent.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;

Expand All @@ -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
{
Expand Down
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions Resources/Prototypes/Entities/Structures/Furniture/shower.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
Expand Down Expand Up @@ -39,3 +42,4 @@
ShowerVisualState.Off:
On: { state: shower_on }
Off: { state: shower }

3 changes: 2 additions & 1 deletion Resources/Prototypes/Recipes/Construction/furniture.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file modified Resources/Textures/Structures/Furniture/shower.rsi/shower.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 30e0435

Please sign in to comment.