Generic morgue visualizer (#9696)
This commit is contained in:
7
Content.Client/Morgue/Visualizers/MorgueVisualLayers.cs
Normal file
7
Content.Client/Morgue/Visualizers/MorgueVisualLayers.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Content.Client.Morgue.Visualizers;
|
||||
|
||||
public enum MorgueVisualLayers : byte
|
||||
{
|
||||
Base,
|
||||
Light,
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using Content.Shared.Morgue;
|
||||
using Content.Shared.Storage;
|
||||
using Robust.Client.GameObjects;
|
||||
|
||||
namespace Content.Client.Morgue.Visualizers;
|
||||
|
||||
public sealed class MorgueVisualizerSystem : VisualizerSystem<MorgueVisualsComponent>
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
}
|
||||
|
||||
protected override void OnAppearanceChange(EntityUid uid, MorgueVisualsComponent component, ref AppearanceChangeEvent args)
|
||||
{
|
||||
if (args.Sprite == null)
|
||||
return;
|
||||
|
||||
string? lightState = null;
|
||||
if (args.Component.TryGetData(MorgueVisuals.HasSoul, out bool hasSoul) && hasSoul)
|
||||
lightState = component.LightSoul;
|
||||
else if (args.Component.TryGetData(MorgueVisuals.HasMob, out bool hasMob) && hasMob)
|
||||
lightState = component.LightMob;
|
||||
else if (args.Component.TryGetData(StorageVisuals.HasContents, out bool hasContents) && hasContents)
|
||||
lightState = component.LightContents;
|
||||
|
||||
if (lightState != null)
|
||||
{
|
||||
args.Sprite.LayerSetState(MorgueVisualLayers.Light, lightState);
|
||||
args.Sprite.LayerSetVisible(MorgueVisualLayers.Light, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
args.Sprite.LayerSetVisible(MorgueVisualLayers.Light, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
namespace Content.Client.Morgue.Visualizers;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed class MorgueVisualsComponent : Component
|
||||
{
|
||||
[DataField("lightContents", required: true)]
|
||||
public string LightContents = default!;
|
||||
[DataField("lightMob", required: true)]
|
||||
public string LightMob = default!;
|
||||
[DataField("lightSoul", required: true)]
|
||||
public string LightSoul = default!;
|
||||
}
|
||||
|
||||
public enum MorgueVisualLayers : byte
|
||||
{
|
||||
Base,
|
||||
Light,
|
||||
}
|
||||
Reference in New Issue
Block a user