mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-09-29 23:57:29 +00:00
LockVisualizer (#25224)
* LockVisualizer
* Fix state
* Clean some code
* Make it component, fix tests fail
* Fix for StateUnlocked
Now it is possible to manually set the unlocked state and it will work!
* Optimize LockVisualizer, add check for unlocked state
* No todo I guess
(cherry picked from commit c7870882f6)
This commit is contained in:
@@ -70,25 +70,11 @@ public sealed class EntityStorageVisualizerSystem : VisualizerSystem<EntityStora
|
||||
args.Sprite.LayerSetState(StorageVisualLayers.Base, comp.StateBaseClosed);
|
||||
}
|
||||
}
|
||||
|
||||
// Lock state for the storage entity. TODO: Split into its own visualizer.
|
||||
if (AppearanceSystem.TryGetData<bool>(uid, StorageVisuals.CanLock, out var canLock, args.Component) && canLock)
|
||||
{
|
||||
if (!AppearanceSystem.TryGetData<bool>(uid, StorageVisuals.Locked, out var locked, args.Component))
|
||||
locked = true;
|
||||
|
||||
args.Sprite.LayerSetVisible(StorageVisualLayers.Lock, !open);
|
||||
if (!open)
|
||||
{
|
||||
args.Sprite.LayerSetState(StorageVisualLayers.Lock, locked ? comp.StateLocked : comp.StateUnlocked);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum StorageVisualLayers : byte
|
||||
{
|
||||
Base,
|
||||
Door,
|
||||
Lock
|
||||
Door
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user