-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<!-- This is a semi-strict format, you can add/remove sections as needed but the order/format should be kept the same Remove these comments before submitting --> # Description <!-- Explain this PR in as much detail as applicable Some example prompts to consider: How might this affect the game? The codebase? What might be some alternatives to this? How/Who does this benefit/hurt [the game/codebase]? --> Added in showers. A pure RP furniture item. --- # TODO <!-- A list of everything you have to do before this PR is "complete" You probably won't have to complete everything before merging but it's good to leave future references --> - [x] Sound effects - [x] Wallmount - [x] Add in Showers --- ![Display](https://github.com/user-attachments/assets/c8499c33-a9ce-4d2d-9003-ed8517afb0b9) --- # Changelog <!-- You can add an author after the `:cl:` to change the name that appears in the changelog (ex: `:cl: Death`) Leaving it blank will default to your GitHub display name This includes all available types for the changelog --> :cl: Tilkku - add: Added showers
- Loading branch information
1 parent
f57327e
commit 376b8f1
Showing
12 changed files
with
270 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using Content.Shared.Showers; | ||
|
||
namespace Content.Server.Shower; | ||
|
||
public sealed class ShowerSystem : SharedShowerSystem | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
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; | ||
|
||
namespace Content.Shared.Showers | ||
{ | ||
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(); | ||
SubscribeLocalEvent<ShowerComponent, MapInitEvent>(OnMapInit); | ||
SubscribeLocalEvent<ShowerComponent, GetVerbsEvent<AlternativeVerb>>(OnToggleShowerVerb); | ||
SubscribeLocalEvent<ShowerComponent, ActivateInWorldEvent>(OnActivateInWorld); | ||
} | ||
private void OnMapInit(EntityUid uid, ShowerComponent component, MapInitEvent args) | ||
{ | ||
if (_random.Prob(0.5f)) | ||
component.ToggleShower = true; | ||
UpdateAppearance(uid); | ||
} | ||
private void OnToggleShowerVerb(EntityUid uid, ShowerComponent component, GetVerbsEvent<AlternativeVerb> args) | ||
{ | ||
if (!args.CanInteract || !args.CanAccess || args.Hands == null) | ||
return; | ||
|
||
AlternativeVerb toggleVerb = new() | ||
{ | ||
Act = () => ToggleShowerHead(uid, args.User, component) | ||
}; | ||
|
||
if (component.ToggleShower) | ||
{ | ||
toggleVerb.Text = Loc.GetString("shower-turn-on"); | ||
toggleVerb.Icon = | ||
new SpriteSpecifier.Texture(new ResPath("/Textures/Interface/VerbIcons/open.svg.192dpi.png")); | ||
} | ||
else | ||
{ | ||
toggleVerb.Text = Loc.GetString("shower-turn-off"); | ||
toggleVerb.Icon = | ||
new SpriteSpecifier.Texture(new ResPath("/Textures/Interface/VerbIcons/close.svg.192dpi.png")); | ||
} | ||
args.Verbs.Add(toggleVerb); | ||
} | ||
private void OnActivateInWorld(EntityUid uid, ShowerComponent comp, ActivateInWorldEvent args) | ||
{ | ||
if (args.Handled) | ||
return; | ||
|
||
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) | ||
{ | ||
if (!Resolve(uid, ref component)) | ||
return; | ||
|
||
component.ToggleShower = !component.ToggleShower; | ||
|
||
UpdateAppearance(uid, component); | ||
} | ||
private void UpdateAppearance(EntityUid uid, ShowerComponent? component = null) | ||
{ | ||
if (!Resolve(uid, ref component)) | ||
return; | ||
|
||
_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; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using Robust.Shared.Audio; | ||
using Robust.Shared.GameStates; | ||
using Robust.Shared.Serialization; | ||
|
||
namespace Content.Shared.Showers | ||
{ | ||
/// <summary> | ||
/// showers that can be enabled | ||
/// </summary> | ||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] | ||
public sealed partial class ShowerComponent : Component | ||
{ | ||
/// <summary> | ||
/// Toggles shower. | ||
/// </summary> | ||
[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 | ||
{ | ||
ShowerVisualState, | ||
} | ||
|
||
[Serializable, NetSerializable] | ||
public enum ShowerVisualState : byte | ||
{ | ||
Off, | ||
On | ||
} | ||
} | ||
|
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
shower-turn-on = Turn On | ||
shower-turn-off = Turn Off |
46 changes: 46 additions & 0 deletions
46
Resources/Prototypes/Entities/Structures/Furniture/shower.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
- type: entity | ||
name: shower | ||
id: Shower | ||
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" ] | ||
- type: Appearance | ||
- type: Rotatable | ||
- type: Transform | ||
noRot: false | ||
- type: Clickable | ||
- type: Shower | ||
- type: Physics | ||
bodyType: Static | ||
canCollide: false | ||
- type: InteractionOutline | ||
- type: Damageable | ||
- type: Construction | ||
graph: Shower | ||
node: shower | ||
damageContainer: Inorganic | ||
damageModifierSet: Metallic | ||
- type: Destructible | ||
thresholds: | ||
- trigger: | ||
!type:DamageTrigger | ||
damage: 100 | ||
behaviors: | ||
- !type:DoActsBehavior | ||
acts: [ "Destruction" ] | ||
- type: GenericVisualizer | ||
visuals: | ||
enum.ShowerVisuals.ShowerVisualState: | ||
ShowerVisualState.Off: | ||
On: { state: shower_on } | ||
Off: { state: shower } | ||
|
29 changes: 29 additions & 0 deletions
29
Resources/Prototypes/Recipes/Construction/Graphs/furniture/shower.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
- type: constructionGraph | ||
id: Shower | ||
start: start | ||
graph: | ||
- node: start | ||
edges: | ||
- to: shower | ||
completed: | ||
- !type:SnapToGrid { } | ||
steps: | ||
- material: Steel | ||
amount: 5 | ||
doAfter: 1 | ||
- node: shower | ||
entity: Shower | ||
edges: | ||
- to: start | ||
completed: | ||
- !type:SpawnPrototype | ||
prototype: SheetSteel1 | ||
amount: 5 | ||
- !type:EmptyAllContainers {} | ||
- !type:DestroyEntity {} | ||
conditions: | ||
- !type:EntityAnchored | ||
anchored: false | ||
steps: | ||
- tool: Welding | ||
doAfter: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
Resources/Textures/Structures/Furniture/shower.rsi/meta.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"version": 1, | ||
"license": "CC-BY-SA-3.0", | ||
"copyright": "Made by Dakodragon, DiscordID: 56038550335922176", | ||
"size": { | ||
"x": 32, | ||
"y": 32 | ||
}, | ||
"states": [ | ||
{ | ||
"name": "shower", | ||
"directions": 4 | ||
}, | ||
{ | ||
"name": "shower_on", | ||
"directions": 4, | ||
"delays": [ | ||
[ 0.3, 0.3, 0.3 ], | ||
[ 0.3, 0.3, 0.3 ], | ||
[ 0.3, 0.3, 0.3 ], | ||
[ 0.3, 0.3, 0.3 ] | ||
] | ||
} | ||
] | ||
} |
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.