From 7c5c4ba53b562720202937d19ae266b9e3c74f99 Mon Sep 17 00:00:00 2001
From: sleepyyapril <123355664+sleepyyapril@users.noreply.github.com>
Date: Sun, 19 Jan 2025 02:04:17 -0400
Subject: [PATCH] Fix Hissing & Another Airlock Error (#1596)
errors/test fail ops
---------
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
---
.../ElectrocutionHUDVisualizerSystem.cs | 94 ++++++++++++++++
.../ElectrocutionOverlaySystem.cs | 101 ------------------
Content.Server/Chat/SuicideSystem.cs | 2 +-
.../ElectrocutionHUDVisualsComponent.cs | 7 ++
.../ShowElectrocutionHUDComponent.cs | 9 ++
.../Electrocution/SharedElectrocution.cs | 2 +-
.../Locale/en-US/random-barks/hissing.ftl | 1 +
.../DeltaV/Catalog/Shipyard/civilian.yml | 4 +-
.../Entities/Mobs/Player/observer.yml | 2 +-
.../Entities/Mobs/Player/silicon.yml | 2 +-
.../Doors/Airlocks/base_structureairlocks.yml | 3 +-
.../Structures/Doors/Airlocks/shuttle.yml | 70 +++---------
12 files changed, 131 insertions(+), 166 deletions(-)
create mode 100644 Content.Client/Electrocution/ElectrocutionHUDVisualizerSystem.cs
delete mode 100644 Content.Client/Electrocution/ElectrocutionOverlaySystem.cs
create mode 100644 Content.Shared/Electrocution/Components/ElectrocutionHUDVisualsComponent.cs
create mode 100644 Content.Shared/Electrocution/Components/ShowElectrocutionHUDComponent.cs
diff --git a/Content.Client/Electrocution/ElectrocutionHUDVisualizerSystem.cs b/Content.Client/Electrocution/ElectrocutionHUDVisualizerSystem.cs
new file mode 100644
index 00000000000..dad033b4f69
--- /dev/null
+++ b/Content.Client/Electrocution/ElectrocutionHUDVisualizerSystem.cs
@@ -0,0 +1,94 @@
+using Content.Shared.Electrocution;
+using Robust.Client.GameObjects;
+using Robust.Client.Player;
+using Robust.Shared.Player;
+
+namespace Content.Client.Electrocution;
+
+///
+/// Shows the Electrocution HUD to entities with the ShowElectrocutionHUDComponent.
+///
+public sealed class ElectrocutionHUDVisualizerSystem : VisualizerSystem
+{
+ [Dependency] private readonly IPlayerManager _playerMan = default!;
+
+ public override void Initialize()
+ {
+ base.Initialize();
+
+ SubscribeLocalEvent(OnInit);
+ SubscribeLocalEvent(OnShutdown);
+ SubscribeLocalEvent(OnPlayerAttached);
+ SubscribeLocalEvent(OnPlayerDetached);
+ }
+
+ private void OnPlayerAttached(Entity ent, ref LocalPlayerAttachedEvent args)
+ {
+ ShowHUD();
+ }
+
+ private void OnPlayerDetached(Entity ent, ref LocalPlayerDetachedEvent args)
+ {
+ RemoveHUD();
+ }
+
+ private void OnInit(Entity ent, ref ComponentInit args)
+ {
+ if (_playerMan.LocalEntity == ent)
+ {
+ ShowHUD();
+ }
+ }
+
+ private void OnShutdown(Entity ent, ref ComponentShutdown args)
+ {
+ if (_playerMan.LocalEntity == ent)
+ {
+ RemoveHUD();
+ }
+ }
+
+ // Show the HUD to the client.
+ // We have to look for all current entities that can be electrified and toggle the HUD layer on if they are.
+ private void ShowHUD()
+ {
+ var electrifiedQuery = AllEntityQuery();
+ while (electrifiedQuery.MoveNext(out var uid, out var _, out var appearanceComp, out var spriteComp))
+ {
+ if (!AppearanceSystem.TryGetData(uid, ElectrifiedVisuals.IsElectrified, out var electrified, appearanceComp))
+ continue;
+
+ if (electrified)
+ spriteComp.LayerSetVisible(ElectrifiedLayers.HUD, true);
+ else
+ spriteComp.LayerSetVisible(ElectrifiedLayers.HUD, false);
+ }
+ }
+
+ // Remove the HUD from the client.
+ // Find all current entities that can be electrified and hide the HUD layer.
+ private void RemoveHUD()
+ {
+ var electrifiedQuery = AllEntityQuery();
+ while (electrifiedQuery.MoveNext(out var uid, out var _, out var appearanceComp, out var spriteComp))
+ {
+ spriteComp.LayerSetVisible(ElectrifiedLayers.HUD, false);
+ }
+ }
+
+ // Toggle the HUD layer if an entity becomes (de-)electrified
+ protected override void OnAppearanceChange(EntityUid uid, ElectrocutionHUDVisualsComponent comp, ref AppearanceChangeEvent args)
+ {
+ if (args.Sprite == null)
+ return;
+
+ if (!AppearanceSystem.TryGetData(uid, ElectrifiedVisuals.IsElectrified, out var electrified, args.Component))
+ return;
+
+ var player = _playerMan.LocalEntity;
+ if (electrified && HasComp(player))
+ args.Sprite.LayerSetVisible(ElectrifiedLayers.HUD, true);
+ else
+ args.Sprite.LayerSetVisible(ElectrifiedLayers.HUD, false);
+ }
+}
diff --git a/Content.Client/Electrocution/ElectrocutionOverlaySystem.cs b/Content.Client/Electrocution/ElectrocutionOverlaySystem.cs
deleted file mode 100644
index 2751c498de3..00000000000
--- a/Content.Client/Electrocution/ElectrocutionOverlaySystem.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-using Content.Shared.Electrocution;
-using Robust.Client.GameObjects;
-using Robust.Client.Player;
-using Robust.Shared.Player;
-
-namespace Content.Client.Electrocution;
-
-///
-/// Shows the ElectrocutionOverlay to entities with the ElectrocutionOverlayComponent.
-///
-public sealed class ElectrocutionOverlaySystem : EntitySystem
-{
-
- [Dependency] private readonly AppearanceSystem _appearance = default!;
- [Dependency] private readonly IPlayerManager _playerMan = default!;
-
- ///
- public override void Initialize()
- {
- SubscribeLocalEvent(OnInit);
- SubscribeLocalEvent(OnShutdown);
- SubscribeLocalEvent(OnPlayerAttached);
- SubscribeLocalEvent(OnPlayerDetached);
-
- SubscribeLocalEvent(OnAppearanceChange);
- }
-
- private void OnPlayerAttached(Entity ent, ref LocalPlayerAttachedEvent args)
- {
- ShowOverlay();
- }
-
- private void OnPlayerDetached(Entity ent, ref LocalPlayerDetachedEvent args)
- {
- RemoveOverlay();
- }
-
- private void OnInit(Entity ent, ref ComponentInit args)
- {
- if (_playerMan.LocalEntity == ent)
- {
- ShowOverlay();
- }
- }
-
- private void OnShutdown(Entity ent, ref ComponentShutdown args)
- {
- if (_playerMan.LocalEntity == ent)
- {
- RemoveOverlay();
- }
- }
-
- private void ShowOverlay()
- {
- var electrifiedQuery = AllEntityQuery();
- while (electrifiedQuery.MoveNext(out var uid, out var _, out var appearanceComp, out var spriteComp))
- {
- if (!_appearance.TryGetData(uid, ElectrifiedVisuals.IsElectrified, out var electrified, appearanceComp))
- continue;
-
- if (!spriteComp.LayerMapTryGet(ElectrifiedLayers.Overlay, out var layer))
- continue;
-
- if (electrified)
- spriteComp.LayerSetVisible(ElectrifiedLayers.Overlay, true);
- else
- spriteComp.LayerSetVisible(ElectrifiedLayers.Overlay, false);
- }
- }
-
- private void RemoveOverlay()
- {
- var electrifiedQuery = AllEntityQuery();
- while (electrifiedQuery.MoveNext(out var uid, out var _, out var appearanceComp, out var spriteComp))
- {
- if (!spriteComp.LayerMapTryGet(ElectrifiedLayers.Overlay, out var layer))
- continue;
-
- spriteComp.LayerSetVisible(layer, false);
- }
- }
-
- private void OnAppearanceChange(Entity ent, ref AppearanceChangeEvent args)
- {
- if (args.Sprite == null)
- return;
-
- if (!_appearance.TryGetData(ent.Owner, ElectrifiedVisuals.IsElectrified, out var electrified, args.Component))
- return;
-
- if (!args.Sprite.LayerMapTryGet(ElectrifiedLayers.Overlay, out var layer))
- return;
-
- var player = _playerMan.LocalEntity;
- if (electrified && HasComp(player))
- args.Sprite.LayerSetVisible(layer, true);
- else
- args.Sprite.LayerSetVisible(layer, false);
- }
-}
diff --git a/Content.Server/Chat/SuicideSystem.cs b/Content.Server/Chat/SuicideSystem.cs
index 0b850971b9b..0d324f2e426 100644
--- a/Content.Server/Chat/SuicideSystem.cs
+++ b/Content.Server/Chat/SuicideSystem.cs
@@ -147,7 +147,7 @@ private void OnDamageableSuicide(Entity victim, ref Suicide
return;
}
- args.DamageType ??= "Blunt";
+ args.DamageType ??= "Slash";
_suicide.ApplyLethalDamage(victim, args.DamageType);
args.Handled = true;
}
diff --git a/Content.Shared/Electrocution/Components/ElectrocutionHUDVisualsComponent.cs b/Content.Shared/Electrocution/Components/ElectrocutionHUDVisualsComponent.cs
new file mode 100644
index 00000000000..a48b1e3e5a3
--- /dev/null
+++ b/Content.Shared/Electrocution/Components/ElectrocutionHUDVisualsComponent.cs
@@ -0,0 +1,7 @@
+namespace Content.Shared.Electrocution;
+
+///
+/// Handles toggling sprite layers for the electrocution HUD to show if an entity with the ElectrifiedComponent is electrified.
+///
+[RegisterComponent]
+public sealed partial class ElectrocutionHUDVisualsComponent : Component;
diff --git a/Content.Shared/Electrocution/Components/ShowElectrocutionHUDComponent.cs b/Content.Shared/Electrocution/Components/ShowElectrocutionHUDComponent.cs
new file mode 100644
index 00000000000..a6d9f380da3
--- /dev/null
+++ b/Content.Shared/Electrocution/Components/ShowElectrocutionHUDComponent.cs
@@ -0,0 +1,9 @@
+using Robust.Shared.GameStates;
+
+namespace Content.Shared.Electrocution;
+
+///
+/// Allow an entity to see the Electrocution HUD showing electrocuted doors.
+///
+[RegisterComponent, NetworkedComponent]
+public sealed partial class ShowElectrocutionHUDComponent : Component;
diff --git a/Content.Shared/Electrocution/SharedElectrocution.cs b/Content.Shared/Electrocution/SharedElectrocution.cs
index b00fb1afdb7..5422049874d 100644
--- a/Content.Shared/Electrocution/SharedElectrocution.cs
+++ b/Content.Shared/Electrocution/SharedElectrocution.cs
@@ -6,7 +6,7 @@ namespace Content.Shared.Electrocution;
public enum ElectrifiedLayers : byte
{
Sparks,
- Overlay,
+ HUD,
}
[Serializable, NetSerializable]
diff --git a/Resources/Locale/en-US/random-barks/hissing.ftl b/Resources/Locale/en-US/random-barks/hissing.ftl
index d9f97d984e5..10a48797910 100644
--- a/Resources/Locale/en-US/random-barks/hissing.ftl
+++ b/Resources/Locale/en-US/random-barks/hissing.ftl
@@ -3,6 +3,7 @@ bark-hissing-1 = Hsssss
bark-hissing-2 = Hssssssss
bark-hissing-3 = I sssee you
bark-hissing-4 = I will catch you
+bark-hissing-5 = Meat...
bark-hissing-6 = I'm hhhungry!
bark-hissing-7 = Ssseek... food...
bark-hissing-8 = Hsss... Get there
diff --git a/Resources/Prototypes/DeltaV/Catalog/Shipyard/civilian.yml b/Resources/Prototypes/DeltaV/Catalog/Shipyard/civilian.yml
index 4e1a127bdd8..e3de53f999d 100644
--- a/Resources/Prototypes/DeltaV/Catalog/Shipyard/civilian.yml
+++ b/Resources/Prototypes/DeltaV/Catalog/Shipyard/civilian.yml
@@ -25,7 +25,7 @@
id: Helix
name: NTMC Helix
description: A large mobile health clinic for servicing distant outposts.
- price: 46000
+ price: 47000
path: /Maps/Shuttles/DeltaV/helix.yml
categories:
- Civilian
@@ -36,7 +36,7 @@
id: Prospector
name: NT-7 Prospector
description: A small mining vessel designed to assist salvage operations.
- price: 21000
+ price: 22000
path: /Maps/Shuttles/DeltaV/prospector.yml
categories:
- Civilian
diff --git a/Resources/Prototypes/Entities/Mobs/Player/observer.yml b/Resources/Prototypes/Entities/Mobs/Player/observer.yml
index a44518ff3de..dab58099a31 100644
--- a/Resources/Prototypes/Entities/Mobs/Player/observer.yml
+++ b/Resources/Prototypes/Entities/Mobs/Player/observer.yml
@@ -59,7 +59,7 @@
skipChecks: true
- type: Ghost
- type: GhostHearing
- - type: ElectrocutionOverlay
+ - type: ShowElectrocutionHUD
- type: IntrinsicRadioReceiver
- type: ActiveRadio
receiveAllChannels: true
diff --git a/Resources/Prototypes/Entities/Mobs/Player/silicon.yml b/Resources/Prototypes/Entities/Mobs/Player/silicon.yml
index d9a54b2c1cd..bbd3f7ef5f9 100644
--- a/Resources/Prototypes/Entities/Mobs/Player/silicon.yml
+++ b/Resources/Prototypes/Entities/Mobs/Player/silicon.yml
@@ -22,7 +22,7 @@
- type: IgnoreUIRange
- type: StationAiHeld
- type: StationAiOverlay
- - type: ElectrocutionOverlay
+ - type: ShowElectrocutionHUD
- type: ActionGrant
actions:
- ActionJumpToCore
diff --git a/Resources/Prototypes/Entities/Structures/Doors/Airlocks/base_structureairlocks.yml b/Resources/Prototypes/Entities/Structures/Doors/Airlocks/base_structureairlocks.yml
index fd907a0ff26..1b1c2fb74ca 100644
--- a/Resources/Prototypes/Entities/Structures/Doors/Airlocks/base_structureairlocks.yml
+++ b/Resources/Prototypes/Entities/Structures/Doors/Airlocks/base_structureairlocks.yml
@@ -34,7 +34,7 @@
sprite: Interface/Misc/ai_hud.rsi
shader: unshaded
visible: false
- map: ["enum.ElectrifiedLayers.Overlay"]
+ map: ["enum.ElectrifiedLayers.HUD"]
- type: AnimationPlayer
- type: Physics
- type: Fixtures
@@ -77,6 +77,7 @@
- type: DoorBolt
- type: Appearance
- type: WiresVisuals
+ - type: ElectrocutionHUDVisuals
- type: ApcPowerReceiver
powerLoad: 20
- type: ExtensionCableReceiver
diff --git a/Resources/Prototypes/Entities/Structures/Doors/Airlocks/shuttle.yml b/Resources/Prototypes/Entities/Structures/Doors/Airlocks/shuttle.yml
index 43d1228a408..80f18992cce 100644
--- a/Resources/Prototypes/Entities/Structures/Doors/Airlocks/shuttle.yml
+++ b/Resources/Prototypes/Entities/Structures/Doors/Airlocks/shuttle.yml
@@ -31,22 +31,6 @@
- type: Sprite
sprite: Structures/Doors/Airlocks/Standard/shuttle.rsi
snapCardinals: false
- layers:
- - state: closed
- map: ["enum.DoorVisualLayers.Base"]
- - state: closed_unlit
- shader: unshaded
- map: ["enum.DoorVisualLayers.BaseUnlit"]
- - state: welded
- map: ["enum.WeldableLayers.BaseWelded"]
- - state: bolted_unlit
- shader: unshaded
- map: ["enum.DoorVisualLayers.BaseBolted"]
- - state: emergency_unlit
- shader: unshaded
- map: ["enum.DoorVisualLayers.BaseEmergencyAccess"]
- - state: panel_open
- map: ["enum.WiresVisualLayers.MaintenancePanel"]
- type: Wires
layoutId: Docking
- type: Door
@@ -63,6 +47,8 @@
path: /Audio/Machines/airlock_deny.ogg
- type: Airtight
noAirWhenFullyAirBlocked: false
+ airBlockedDirection:
+ - South
- type: Tag
tags:
- ForceNoFixRotations
@@ -72,6 +58,8 @@
- type: Construction
graph: AirlockShuttle
node: airlock
+ - type: StaticPrice
+ price: 350
- type: entity
id: AirlockGlassShuttle
@@ -82,29 +70,17 @@
components:
- type: Sprite
sprite: Structures/Doors/Airlocks/Glass/shuttle.rsi
- snapCardinals: false
- layers:
- - state: closed
- map: ["enum.DoorVisualLayers.Base"]
- - state: closed_unlit
- shader: unshaded
- map: ["enum.DoorVisualLayers.BaseUnlit"]
- - state: welded
- map: ["enum.WeldableLayers.BaseWelded"]
- - state: bolted_unlit
- shader: unshaded
- map: ["enum.DoorVisualLayers.BaseBolted"]
- - state: emergency_unlit
- shader: unshaded
- map: ["enum.DoorVisualLayers.BaseEmergencyAccess"]
- - state: panel_open
- map: ["enum.WiresVisualLayers.MaintenancePanel"]
- type: Occluder
enabled: false
- type: PaintableAirlock
group: ShuttleGlass
- type: Door
occludes: false
+ - type: Fixtures
+ fixtures:
+ fix1:
+ layer: #removed opaque from the layer, allowing lasers to pass through glass airlocks
+ - GlassAirlockLayer
- type: entity
id: AirlockShuttleAssembly
@@ -120,42 +96,20 @@
- type: Sprite
sprite: Structures/Doors/Airlocks/Glass/shuttle.rsi
state: closed
+ snapCardinals: false
- type: Construction
graph: AirlockShuttle
node: assembly
- type: entity
id: AirlockGlassShuttleSyndicate
- parent: AirlockShuttle
+ parent: AirlockGlassShuttle
name: external airlock
suffix: Glass, Docking
description: Necessary for connecting two space craft together.
components:
- type: Sprite
sprite: Structures/Doors/Airlocks/Glass/shuttle_syndicate.rsi
- snapCardinals: false
- layers:
- - state: closed
- map: ["enum.DoorVisualLayers.Base"]
- - state: closed_unlit
- shader: unshaded
- map: ["enum.DoorVisualLayers.BaseUnlit"]
- - state: welded
- map: ["enum.WeldableLayers.BaseWelded"]
- - state: bolted_unlit
- shader: unshaded
- map: ["enum.DoorVisualLayers.BaseBolted"]
- - state: emergency_unlit
- shader: unshaded
- map: ["enum.DoorVisualLayers.BaseEmergencyAccess"]
- - state: panel_open
- map: ["enum.WiresVisualLayers.MaintenancePanel"]
- - type: Occluder
- enabled: false
- - type: PaintableAirlock
- group: ShuttleGlass
- - type: Door
- occludes: false
- type: entity
parent: AirlockShuttle
@@ -165,4 +119,4 @@
description: Necessary for connecting two space craft together.
components:
- type: Sprite
- sprite: Structures/Doors/Airlocks/Standard/shuttle_syndicate.rsi
+ sprite: Structures/Doors/Airlocks/Standard/shuttle_syndicate.rsi
\ No newline at end of file