Port wires/maintenance panel visualizer (#10543)

This commit is contained in:
Andreas Kämper
2022-08-16 12:04:07 +02:00
committed by GitHub
parent 34bcbc9500
commit 3c3a44ec49
15 changed files with 94 additions and 93 deletions

View File

@@ -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));
}
}

View File

@@ -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))
{

View File

@@ -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<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner);
if (component.TryGetData<bool>(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,
}
}
}

View File

@@ -0,0 +1,32 @@
using Content.Shared.Wires;
using Robust.Client.GameObjects;
namespace Content.Client.Wires.Visualizers
{
public sealed class WiresVisualizerSystem : VisualizerSystem<WiresVisualsComponent>
{
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
}
}

View File

@@ -0,0 +1,7 @@
namespace Content.Client.Wires
{
[RegisterComponent]
public sealed class WiresVisualsComponent : Component
{
}
}

View File

@@ -160,8 +160,7 @@
- state: daw-panel
map: ["enum.WiresVisualLayers.MaintenancePanel"]
- type: Appearance
visuals:
- type: WiresVisualizer
- type: WiresVisuals
- type: Construction
graph: Machine
node: machine

View File

@@ -61,7 +61,7 @@
- type: Appearance
visuals:
- type: AirlockVisualizer
- type: WiresVisualizer
- type: WiresVisuals
- type: ApcPowerReceiver
powerLoad: 20
- type: ExtensionCableReceiver

View File

@@ -20,7 +20,7 @@
- type: Appearance
visuals:
- type: AirlockVisualizer
- type: WiresVisualizer
- type: WiresVisuals
- type: PaintableAirlock
group: External

View File

@@ -53,7 +53,7 @@
- type: Appearance
visuals:
- type: AirlockVisualizer
- type: WiresVisualizer
- type: WiresVisuals
- type: ApcPowerReceiver
powerLoad: 20
- type: ExtensionCableReceiver

View File

@@ -77,7 +77,7 @@
- type: AirlockVisualizer
animationTime: 0.6
emergencyAccessLayer: false
- type: WiresVisualizer
- type: WiresVisuals
- type: Wires
BoardName: "Firelock Control"
LayoutId: Firelock

View File

@@ -101,7 +101,7 @@
denyAnimationTime: 0.4
animatedPanel: false
openUnlitVisible: true
- type: WiresVisualizer
- type: WiresVisuals
- type: Airtight
fixVacuum: true
noAirWhenFullyAirBlocked: false

View File

@@ -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

View File

@@ -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"]]

View File

@@ -56,7 +56,7 @@
Danger: alarm1
setOnDepowered:
airAlarmBase: alarmp
- type: WiresVisualizer
- type: WiresVisuals
- type: Sprite
sprite: Structures/Wallmounts/air_monitors.rsi
layers:

View File

@@ -33,7 +33,7 @@
Danger: fire_on
Emagged: fire_emagged
hideOnDepowered: ["fireAlarmState"]
- type: WiresVisualizer
- type: WiresVisuals
- type: AlertLevelDisplay
alertVisuals:
green: fire_0