diff --git a/Content.Client/Doors/AirlockVisualizer.cs b/Content.Client/Doors/AirlockVisualizer.cs index 6769568f71..e2ff79362a 100644 --- a/Content.Client/Doors/AirlockVisualizer.cs +++ b/Content.Client/Doors/AirlockVisualizer.cs @@ -85,7 +85,7 @@ namespace Content.Client.Doors { var flickMaintenancePanel = new AnimationTrackSpriteFlick(); CloseAnimation.AnimationTracks.Add(flickMaintenancePanel); - flickMaintenancePanel.LayerKey = WiresVisualizer.WiresVisualLayers.MaintenancePanel; + flickMaintenancePanel.LayerKey = WiresVisualLayers.MaintenancePanel; flickMaintenancePanel.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame("panel_closing", 0f)); } } @@ -109,7 +109,7 @@ namespace Content.Client.Doors { var flickMaintenancePanel = new AnimationTrackSpriteFlick(); OpenAnimation.AnimationTracks.Add(flickMaintenancePanel); - flickMaintenancePanel.LayerKey = WiresVisualizer.WiresVisualLayers.MaintenancePanel; + flickMaintenancePanel.LayerKey = WiresVisualLayers.MaintenancePanel; flickMaintenancePanel.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame("panel_opening", 0f)); } } diff --git a/Content.Client/Lathe/LatheSystem.cs b/Content.Client/Lathe/LatheSystem.cs index 4f7f9ad485..514c851fac 100644 --- a/Content.Client/Lathe/LatheSystem.cs +++ b/Content.Client/Lathe/LatheSystem.cs @@ -2,8 +2,6 @@ using Robust.Client.GameObjects; using Content.Shared.Lathe; using Content.Shared.Power; using Content.Client.Power; -using Content.Client.Wires.Visualizers; -using Content.Shared.Wires; namespace Content.Client.Lathe { @@ -20,12 +18,6 @@ namespace Content.Client.Lathe args.Sprite.LayerSetVisible(PowerDeviceVisualLayers.Powered, powered); } - if (args.Component.TryGetData(WiresVisuals.MaintenancePanelState, out bool panel) - && args.Sprite.LayerMapTryGet(WiresVisualizer.WiresVisualLayers.MaintenancePanel, out _)) - { - args.Sprite.LayerSetVisible(WiresVisualizer.WiresVisualLayers.MaintenancePanel, panel); - } - // Lathe specific stuff if (args.Component.TryGetData(LatheVisuals.IsRunning, out bool isRunning)) { diff --git a/Content.Client/Wires/Visualizers/WiresVisualizer.cs b/Content.Client/Wires/Visualizers/WiresVisualizer.cs deleted file mode 100644 index 0431735daf..0000000000 --- a/Content.Client/Wires/Visualizers/WiresVisualizer.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Content.Shared.Wires; -using Robust.Client.GameObjects; -using Robust.Shared.GameObjects; -using Robust.Shared.IoC; - -namespace Content.Client.Wires.Visualizers -{ - public sealed class WiresVisualizer : AppearanceVisualizer - { - [Obsolete("Subscribe to AppearanceChangeEvent instead.")] - public override void OnChangeData(AppearanceComponent component) - { - base.OnChangeData(component); - var sprite = IoCManager.Resolve().GetComponent(component.Owner); - if (component.TryGetData(WiresVisuals.MaintenancePanelState, out var state)) - { - sprite.LayerSetVisible(WiresVisualLayers.MaintenancePanel, state); - } - // Mainly for spawn window - else - { - sprite.LayerSetVisible(WiresVisualLayers.MaintenancePanel, false); - } - } - - public enum WiresVisualLayers : byte - { - MaintenancePanel, - } - } -} diff --git a/Content.Client/Wires/Visualizers/WiresVisualizerSystem.cs b/Content.Client/Wires/Visualizers/WiresVisualizerSystem.cs new file mode 100644 index 0000000000..ffc8b09a1a --- /dev/null +++ b/Content.Client/Wires/Visualizers/WiresVisualizerSystem.cs @@ -0,0 +1,32 @@ +using Content.Shared.Wires; +using Robust.Client.GameObjects; + +namespace Content.Client.Wires.Visualizers +{ + public sealed class WiresVisualizerSystem : VisualizerSystem + { + protected override void OnAppearanceChange(EntityUid uid, WiresVisualsComponent component, ref AppearanceChangeEvent args) + { + if (args.Sprite == null) + return; + + var layer = args.Sprite.LayerMapReserveBlank(WiresVisualLayers.MaintenancePanel); + + if(args.AppearanceData.TryGetValue(WiresVisuals.MaintenancePanelState, out var panelStateObject) && + panelStateObject is bool panelState) + { + args.Sprite.LayerSetVisible(layer, panelState); + } + else + { + //Mainly for spawn window + args.Sprite.LayerSetVisible(layer, false); + } + } + } + + public enum WiresVisualLayers : byte + { + MaintenancePanel + } +} diff --git a/Content.Client/Wires/WiresVisualsComponent.cs b/Content.Client/Wires/WiresVisualsComponent.cs new file mode 100644 index 0000000000..f2c7e47740 --- /dev/null +++ b/Content.Client/Wires/WiresVisualsComponent.cs @@ -0,0 +1,7 @@ +namespace Content.Client.Wires +{ + [RegisterComponent] + public sealed class WiresVisualsComponent : Component + { + } +} diff --git a/Resources/Prototypes/Entities/Objects/Fun/Instruments/instruments_structures.yml b/Resources/Prototypes/Entities/Objects/Fun/Instruments/instruments_structures.yml index 5296e7f346..3f35f6945a 100644 --- a/Resources/Prototypes/Entities/Objects/Fun/Instruments/instruments_structures.yml +++ b/Resources/Prototypes/Entities/Objects/Fun/Instruments/instruments_structures.yml @@ -160,8 +160,7 @@ - state: daw-panel map: ["enum.WiresVisualLayers.MaintenancePanel"] - type: Appearance - visuals: - - type: WiresVisualizer + - type: WiresVisuals - type: Construction graph: Machine node: machine diff --git a/Resources/Prototypes/Entities/Structures/Doors/Airlocks/base_structureairlocks.yml b/Resources/Prototypes/Entities/Structures/Doors/Airlocks/base_structureairlocks.yml index dbf6905b16..7ac55d69a6 100644 --- a/Resources/Prototypes/Entities/Structures/Doors/Airlocks/base_structureairlocks.yml +++ b/Resources/Prototypes/Entities/Structures/Doors/Airlocks/base_structureairlocks.yml @@ -61,7 +61,7 @@ - type: Appearance visuals: - type: AirlockVisualizer - - type: WiresVisualizer + - type: WiresVisuals - type: ApcPowerReceiver powerLoad: 20 - type: ExtensionCableReceiver diff --git a/Resources/Prototypes/Entities/Structures/Doors/Airlocks/external.yml b/Resources/Prototypes/Entities/Structures/Doors/Airlocks/external.yml index dd8e261dc5..7eeddc9dd2 100644 --- a/Resources/Prototypes/Entities/Structures/Doors/Airlocks/external.yml +++ b/Resources/Prototypes/Entities/Structures/Doors/Airlocks/external.yml @@ -20,7 +20,7 @@ - type: Appearance visuals: - type: AirlockVisualizer - - type: WiresVisualizer + - type: WiresVisuals - type: PaintableAirlock group: External diff --git a/Resources/Prototypes/Entities/Structures/Doors/Airlocks/highsec.yml b/Resources/Prototypes/Entities/Structures/Doors/Airlocks/highsec.yml index 42f6a79afd..fa04042d57 100644 --- a/Resources/Prototypes/Entities/Structures/Doors/Airlocks/highsec.yml +++ b/Resources/Prototypes/Entities/Structures/Doors/Airlocks/highsec.yml @@ -53,7 +53,7 @@ - type: Appearance visuals: - type: AirlockVisualizer - - type: WiresVisualizer + - type: WiresVisuals - type: ApcPowerReceiver powerLoad: 20 - type: ExtensionCableReceiver diff --git a/Resources/Prototypes/Entities/Structures/Doors/Firelocks/firelock.yml b/Resources/Prototypes/Entities/Structures/Doors/Firelocks/firelock.yml index 3e63d5e4b2..7581e6c749 100644 --- a/Resources/Prototypes/Entities/Structures/Doors/Firelocks/firelock.yml +++ b/Resources/Prototypes/Entities/Structures/Doors/Firelocks/firelock.yml @@ -77,7 +77,7 @@ - type: AirlockVisualizer animationTime: 0.6 emergencyAccessLayer: false - - type: WiresVisualizer + - type: WiresVisuals - type: Wires BoardName: "Firelock Control" LayoutId: Firelock diff --git a/Resources/Prototypes/Entities/Structures/Doors/Windoors/base_structurewindoors.yml b/Resources/Prototypes/Entities/Structures/Doors/Windoors/base_structurewindoors.yml index 749c898ffe..eec19ea444 100644 --- a/Resources/Prototypes/Entities/Structures/Doors/Windoors/base_structurewindoors.yml +++ b/Resources/Prototypes/Entities/Structures/Doors/Windoors/base_structurewindoors.yml @@ -101,7 +101,7 @@ denyAnimationTime: 0.4 animatedPanel: false openUnlitVisible: true - - type: WiresVisualizer + - type: WiresVisuals - type: Airtight fixVacuum: true noAirWhenFullyAirBlocked: false diff --git a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml index ee968f1bc6..87e213238c 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml @@ -21,6 +21,7 @@ - type: LatheVisuals idleState: icon runningState: building + - type: WiresVisuals - type: Physics bodyType: Static - type: Fixtures @@ -107,6 +108,7 @@ - type: LatheVisuals idleState: icon runningState: building + - type: WiresVisuals - type: Physics bodyType: Static - type: Fixtures diff --git a/Resources/Prototypes/Entities/Structures/Machines/vending_machines.yml b/Resources/Prototypes/Entities/Structures/Machines/vending_machines.yml index f9f2d4f45a..ddd8eac90c 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/vending_machines.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/vending_machines.yml @@ -95,7 +95,7 @@ - type: VendingMachineVisualizer normalUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: entity parent: VendingMachine @@ -123,7 +123,7 @@ - type: VendingMachineVisualizer normalUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: AccessReader access: [["Bar"]] @@ -152,7 +152,7 @@ ejectUnshaded: true denyUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: PointLight radius: 1 energy: 1.3 @@ -190,7 +190,7 @@ ejectUnshaded: true denyUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: entity parent: VendingMachine @@ -222,7 +222,7 @@ normalUnshaded: true denyUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: PointLight radius: 1.8 energy: 1.6 @@ -262,7 +262,7 @@ ejectUnshaded: true denyUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: PointLight radius: 1.5 energy: 1.3 @@ -298,7 +298,7 @@ ejectUnshaded: true denyUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: PointLight radius: 1.5 energy: 1.6 @@ -330,7 +330,7 @@ normalUnshaded: true ejectUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: AccessReader access: [["Service"]] - type: PointLight @@ -364,7 +364,7 @@ normalUnshaded: true ejectUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: PointLight radius: 1.5 energy: 1.6 @@ -398,7 +398,7 @@ - type: VendingMachineVisualizer normalUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: PointLight radius: 1.5 energy: 1.6 @@ -429,7 +429,7 @@ ejectUnshaded: true denyUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: AccessReader access: [["Engineering"]] - type: PointLight @@ -464,7 +464,7 @@ ejectUnshaded: true denyUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: AccessReader access: [["Medical"]] - type: PointLight @@ -499,7 +499,7 @@ ejectUnshaded: true denyUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: AccessReader access: [["Hydroponics"]] - type: PointLight @@ -534,7 +534,7 @@ ejectUnshaded: true denyUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: AccessReader access: [["Security"]] - type: PointLight @@ -569,7 +569,7 @@ normalUnshaded: true ejectUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: PointLight radius: 1.5 energy: 1.6 @@ -609,7 +609,7 @@ - type: VendingMachineVisualizer normalUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: PointLight radius: 1.5 energy: 1.6 @@ -645,7 +645,7 @@ ejectUnshaded: true denyUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: PointLight radius: 1.5 energy: 1.6 @@ -681,7 +681,7 @@ ejectUnshaded: true denyUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: PointLight radius: 1.5 energy: 1.6 @@ -719,7 +719,7 @@ ejectUnshaded: true denyUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: PointLight radius: 1.5 energy: 1.6 @@ -757,7 +757,7 @@ ejectUnshaded: true denyUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: PointLight radius: 1.5 energy: 1.6 @@ -787,7 +787,7 @@ normalUnshaded: true denyUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: AccessReader access: [["Medical"]] @@ -819,7 +819,7 @@ ejectUnshaded: true denyUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: PointLight radius: 1.5 energy: 1.6 @@ -854,7 +854,7 @@ normalUnshaded: true ejectUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: PointLight radius: 1.5 energy: 1.6 @@ -888,7 +888,7 @@ - type: VendingMachineVisualizer normalUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: PointLight radius: 1.5 energy: 1.6 @@ -920,7 +920,7 @@ ejectUnshaded: false denyUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: PointLight radius: 1.5 energy: 1.6 @@ -954,7 +954,7 @@ - type: VendingMachineVisualizer normalUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: PointLight radius: 1.5 energy: 1.6 @@ -987,7 +987,7 @@ - type: VendingMachineVisualizer normalUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: AccessReader access: [["Hydroponics"]] @@ -1016,7 +1016,7 @@ - type: VendingMachineVisualizer normalUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: AccessReader access: [["Brig"]] @@ -1045,7 +1045,7 @@ - type: VendingMachineVisualizer normalUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: AccessReader access: [["Security"]] @@ -1074,7 +1074,7 @@ - type: VendingMachineVisualizer normalUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: AccessReader access: [["Bar"]] @@ -1103,7 +1103,7 @@ normalUnshaded: true denyUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: PointLight radius: 1.5 energy: 1.6 @@ -1134,7 +1134,7 @@ - type: VendingMachineVisualizer normalUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: AccessReader access: [["Cargo"]] @@ -1163,7 +1163,7 @@ - type: VendingMachineVisualizer normalUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: AccessReader access: [["Medical"]] @@ -1192,7 +1192,7 @@ - type: VendingMachineVisualizer normalUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: AccessReader access: [["Chemistry"]] @@ -1221,7 +1221,7 @@ - type: VendingMachineVisualizer normalUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: AccessReader access: [["Engineering"]] @@ -1250,7 +1250,7 @@ - type: VendingMachineVisualizer normalUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: AccessReader access: [["Engineering"]] @@ -1279,7 +1279,7 @@ - type: VendingMachineVisualizer normalUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: AccessReader access: [["Kitchen"]] @@ -1308,7 +1308,7 @@ - type: VendingMachineVisualizer normalUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: AccessReader access: [["Security"]] @@ -1337,7 +1337,7 @@ - type: VendingMachineVisualizer normalUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: AccessReader access: [["Janitor"]] @@ -1366,7 +1366,7 @@ - type: VendingMachineVisualizer normalUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: AccessReader access: [["Research"]] @@ -1395,7 +1395,7 @@ - type: VendingMachineVisualizer normalUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: AccessReader access: [["Research"]] @@ -1424,7 +1424,7 @@ - type: VendingMachineVisualizer normalUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: AccessReader access: [["Medical"]] @@ -1453,7 +1453,7 @@ - type: VendingMachineVisualizer normalUnshaded: true broken: true - - type: WiresVisualizer + - type: WiresVisuals - type: AccessReader access: [["Medical"]] diff --git a/Resources/Prototypes/Entities/Structures/Wallmounts/air_alarm.yml b/Resources/Prototypes/Entities/Structures/Wallmounts/air_alarm.yml index 1b82ae3696..6d990bf5c4 100644 --- a/Resources/Prototypes/Entities/Structures/Wallmounts/air_alarm.yml +++ b/Resources/Prototypes/Entities/Structures/Wallmounts/air_alarm.yml @@ -56,7 +56,7 @@ Danger: alarm1 setOnDepowered: airAlarmBase: alarmp - - type: WiresVisualizer + - type: WiresVisuals - type: Sprite sprite: Structures/Wallmounts/air_monitors.rsi layers: diff --git a/Resources/Prototypes/Entities/Structures/Wallmounts/fire_alarm.yml b/Resources/Prototypes/Entities/Structures/Wallmounts/fire_alarm.yml index fc6ebe558d..1a213aa0ad 100644 --- a/Resources/Prototypes/Entities/Structures/Wallmounts/fire_alarm.yml +++ b/Resources/Prototypes/Entities/Structures/Wallmounts/fire_alarm.yml @@ -33,7 +33,7 @@ Danger: fire_on Emagged: fire_emagged hideOnDepowered: ["fireAlarmState"] - - type: WiresVisualizer + - type: WiresVisuals - type: AlertLevelDisplay alertVisuals: green: fire_0