mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
* First impl. of appearance TryGetData cleanup * Handful of fixes * DamageVisuals: fix HandleDamage call, inheritdoc * bunch of unused AppearanceSystem instances * Handful more unused appearance systems, inheritdoc * JetpackSystem: Ent<T> * cleanup roundup, more Ent<T> * a few lingering AppearanceSystem.TryGetData calls * more lingering AppearanceData access * Remove unnecessary inheritdoc * once again, with feeling
34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
using Content.Shared.Storage;
|
|
using Content.Shared.Lock;
|
|
using Robust.Client.GameObjects;
|
|
|
|
namespace Content.Client.Lock.Visualizers;
|
|
|
|
public sealed partial class LockVisualizerSystem : VisualizerSystem<LockVisualsComponent>
|
|
{
|
|
protected override void OnAppearanceChange(EntityUid uid, LockVisualsComponent comp, ref AppearanceChangeEvent args)
|
|
{
|
|
if (args.Sprite == null
|
|
|| !args.TryGetData<bool>(LockVisuals.Locked, out var locked))
|
|
return;
|
|
|
|
var unlockedStateExist = args.Sprite.BaseRSI?.TryGetState(comp.StateUnlocked, out _);
|
|
|
|
if (args.TryGetData<bool>(StorageVisuals.Open, out var open))
|
|
{
|
|
SpriteSystem.LayerSetVisible((uid, args.Sprite), LockVisualLayers.Lock, !open);
|
|
}
|
|
else if (!(bool)unlockedStateExist!)
|
|
SpriteSystem.LayerSetVisible((uid, args.Sprite), LockVisualLayers.Lock, locked);
|
|
|
|
if (!open && (bool)unlockedStateExist!)
|
|
{
|
|
SpriteSystem.LayerSetRsiState((uid, args.Sprite), LockVisualLayers.Lock, locked ? comp.StateLocked : comp.StateUnlocked);
|
|
}
|
|
}
|
|
}
|
|
|
|
public enum LockVisualLayers : byte
|
|
{
|
|
Lock
|
|
}
|