Port wires/maintenance panel visualizer (#10543)
This commit is contained in:
32
Content.Client/Wires/Visualizers/WiresVisualizerSystem.cs
Normal file
32
Content.Client/Wires/Visualizers/WiresVisualizerSystem.cs
Normal 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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user