diff --git a/Content.Client/Electrocution/ElectrocutionOverlaySystem.cs b/Content.Client/Electrocution/ElectrocutionOverlaySystem.cs
index 2751c498de..bcfc51acc1 100644
--- a/Content.Client/Electrocution/ElectrocutionOverlaySystem.cs
+++ b/Content.Client/Electrocution/ElectrocutionOverlaySystem.cs
@@ -6,96 +6,90 @@ using Robust.Shared.Player;
namespace Content.Client.Electrocution;
///
-/// Shows the ElectrocutionOverlay to entities with the ElectrocutionOverlayComponent.
+/// Shows the Electrocution HUD to entities with the ShowElectrocutionHUDComponent.
///
-public sealed class ElectrocutionOverlaySystem : EntitySystem
+public sealed class ElectrifiedVisualizerSystem : VisualizerSystem
{
-
- [Dependency] private readonly AppearanceSystem _appearance = default!;
[Dependency] private readonly IPlayerManager _playerMan = default!;
- ///
public override void Initialize()
{
- SubscribeLocalEvent(OnInit);
- SubscribeLocalEvent(OnShutdown);
- SubscribeLocalEvent(OnPlayerAttached);
- SubscribeLocalEvent(OnPlayerDetached);
+ base.Initialize();
- SubscribeLocalEvent(OnAppearanceChange);
+ SubscribeLocalEvent(OnInit);
+ SubscribeLocalEvent(OnShutdown);
+ SubscribeLocalEvent(OnPlayerAttached);
+ SubscribeLocalEvent(OnPlayerDetached);
}
- private void OnPlayerAttached(Entity ent, ref LocalPlayerAttachedEvent args)
+ private void OnPlayerAttached(Entity ent, ref LocalPlayerAttachedEvent args)
{
- ShowOverlay();
+ ShowHUD();
}
- private void OnPlayerDetached(Entity ent, ref LocalPlayerDetachedEvent args)
+ private void OnPlayerDetached(Entity ent, ref LocalPlayerDetachedEvent args)
{
- RemoveOverlay();
+ RemoveHUD();
}
- private void OnInit(Entity ent, ref ComponentInit args)
+ private void OnInit(Entity ent, ref ComponentInit args)
{
if (_playerMan.LocalEntity == ent)
{
- ShowOverlay();
+ ShowHUD();
}
}
- private void OnShutdown(Entity ent, ref ComponentShutdown args)
+ private void OnShutdown(Entity ent, ref ComponentShutdown args)
{
if (_playerMan.LocalEntity == ent)
{
- RemoveOverlay();
+ RemoveHUD();
}
}
- private void ShowOverlay()
+ // 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();
+ 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))
+ if (!AppearanceSystem.TryGetData(uid, ElectrifiedVisuals.IsElectrified, out var electrified, appearanceComp))
continue;
if (electrified)
- spriteComp.LayerSetVisible(ElectrifiedLayers.Overlay, true);
+ spriteComp.LayerSetVisible(ElectrifiedLayers.HUD, true);
else
- spriteComp.LayerSetVisible(ElectrifiedLayers.Overlay, false);
+ spriteComp.LayerSetVisible(ElectrifiedLayers.HUD, false);
}
}
- private void RemoveOverlay()
+ // 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();
+ 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);
+ spriteComp.LayerSetVisible(ElectrifiedLayers.HUD, false);
}
}
- private void OnAppearanceChange(Entity ent, ref AppearanceChangeEvent args)
+ // 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 (!_appearance.TryGetData(ent.Owner, ElectrifiedVisuals.IsElectrified, out var electrified, args.Component))
- return;
-
- if (!args.Sprite.LayerMapTryGet(ElectrifiedLayers.Overlay, out var layer))
+ if (!AppearanceSystem.TryGetData(uid, ElectrifiedVisuals.IsElectrified, out var electrified, args.Component))
return;
var player = _playerMan.LocalEntity;
- if (electrified && HasComp(player))
- args.Sprite.LayerSetVisible(layer, true);
+ if (electrified && HasComp(player))
+ args.Sprite.LayerSetVisible(ElectrifiedLayers.HUD, true);
else
- args.Sprite.LayerSetVisible(layer, false);
+ args.Sprite.LayerSetVisible(ElectrifiedLayers.HUD, false);
}
}
diff --git a/Content.Shared/Electrocution/Components/ElectrocutionHUDVisualsComponent.cs b/Content.Shared/Electrocution/Components/ElectrocutionHUDVisualsComponent.cs
new file mode 100644
index 0000000000..a48b1e3e5a
--- /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/ElectrocutionOverlayComponent.cs b/Content.Shared/Electrocution/Components/ShowElectrocutionHUDComponent.cs
similarity index 51%
rename from Content.Shared/Electrocution/Components/ElectrocutionOverlayComponent.cs
rename to Content.Shared/Electrocution/Components/ShowElectrocutionHUDComponent.cs
index e03e8cb934..a6d9f380da 100644
--- a/Content.Shared/Electrocution/Components/ElectrocutionOverlayComponent.cs
+++ b/Content.Shared/Electrocution/Components/ShowElectrocutionHUDComponent.cs
@@ -3,7 +3,7 @@ using Robust.Shared.GameStates;
namespace Content.Shared.Electrocution;
///
-/// Allow an entity to see the ElectrocutionOverlay showing electrocuted doors.
+/// Allow an entity to see the Electrocution HUD showing electrocuted doors.
///
[RegisterComponent, NetworkedComponent]
-public sealed partial class ElectrocutionOverlayComponent : Component;
+public sealed partial class ShowElectrocutionHUDComponent : Component;
diff --git a/Content.Shared/Electrocution/SharedElectrocution.cs b/Content.Shared/Electrocution/SharedElectrocution.cs
index b00fb1afdb..5422049874 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/Prototypes/Entities/Mobs/Player/observer.yml b/Resources/Prototypes/Entities/Mobs/Player/observer.yml
index dc89e635bf..32a481491c 100644
--- a/Resources/Prototypes/Entities/Mobs/Player/observer.yml
+++ b/Resources/Prototypes/Entities/Mobs/Player/observer.yml
@@ -55,7 +55,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 dee11f0451..b694b245b2 100644
--- a/Resources/Prototypes/Entities/Mobs/Player/silicon.yml
+++ b/Resources/Prototypes/Entities/Mobs/Player/silicon.yml
@@ -30,7 +30,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 8d8c69c6ad..90224d3136 100644
--- a/Resources/Prototypes/Entities/Structures/Doors/Airlocks/base_structureairlocks.yml
+++ b/Resources/Prototypes/Entities/Structures/Doors/Airlocks/base_structureairlocks.yml
@@ -35,7 +35,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
@@ -78,6 +78,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 e6905d61cc..630027384c 100644
--- a/Resources/Prototypes/Entities/Structures/Doors/Airlocks/shuttle.yml
+++ b/Resources/Prototypes/Entities/Structures/Doors/Airlocks/shuttle.yml
@@ -30,24 +30,6 @@
hard: false
- 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"]
- visible: false
- - 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