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
This commit is contained in:
MilenVolf
2024-02-17 02:52:31 +03:00
committed by GitHub
parent 19a7b0592c
commit c7870882f6
27 changed files with 98 additions and 110 deletions

View File

@@ -17,7 +17,6 @@ using Content.Shared.Hands.EntitySystems;
using Content.Shared.Interaction;
using Content.Shared.Lock;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Containers;
using Robust.Shared.Player;
@@ -54,7 +53,6 @@ public sealed class GasCanisterSystem : EntitySystem
SubscribeLocalEvent<GasCanisterComponent, GasCanisterHoldingTankEjectMessage>(OnHoldingTankEjectMessage);
SubscribeLocalEvent<GasCanisterComponent, GasCanisterChangeReleasePressureMessage>(OnCanisterChangeReleasePressure);
SubscribeLocalEvent<GasCanisterComponent, GasCanisterChangeReleaseValveMessage>(OnCanisterChangeReleaseValve);
SubscribeLocalEvent<GasCanisterComponent, LockToggledEvent>(OnLockToggled);
}
/// <summary>
@@ -78,11 +76,6 @@ public sealed class GasCanisterSystem : EntitySystem
{
// Ensure container
_slots.AddItemSlot(uid, comp.ContainerName, comp.GasTankSlot);
if (TryComp<LockComponent>(uid, out var lockComp))
{
_appearance.SetData(uid, GasCanisterVisuals.Locked, lockComp.Locked);
}
}
private void DirtyUI(EntityUid uid,
@@ -309,11 +302,6 @@ public sealed class GasCanisterSystem : EntitySystem
args.GasMixtures = new Dictionary<string, GasMixture?> { {Name(uid), component.Air} };
}
private void OnLockToggled(EntityUid uid, GasCanisterComponent component, ref LockToggledEvent args)
{
_appearance.SetData(uid, GasCanisterVisuals.Locked, args.Locked);
}
/// <summary>
/// Check if the canister is locked, playing its sound and popup if so.
/// </summary>