locked cabinets actually cant be opened (#11225)
Co-authored-by: CommieFlowers <rasmus.cedergren@hotmail.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
using Content.Server.Storage.Components;
|
||||||
using Content.Shared.Audio;
|
using Content.Shared.Audio;
|
||||||
using Content.Shared.Cabinet;
|
using Content.Shared.Cabinet;
|
||||||
using Content.Shared.Containers.ItemSlots;
|
using Content.Shared.Containers.ItemSlots;
|
||||||
@@ -67,6 +68,9 @@ namespace Content.Server.Cabinet
|
|||||||
if (args.Hands == null || !args.CanAccess || !args.CanInteract)
|
if (args.Hands == null || !args.CanAccess || !args.CanInteract)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (TryComp<LockComponent>(uid, out var lockComponent) && lockComponent.Locked)
|
||||||
|
return;
|
||||||
|
|
||||||
// Toggle open verb
|
// Toggle open verb
|
||||||
ActivationVerb toggleVerb = new();
|
ActivationVerb toggleVerb = new();
|
||||||
toggleVerb.Act = () => ToggleItemCabinet(uid, cabinet);
|
toggleVerb.Act = () => ToggleItemCabinet(uid, cabinet);
|
||||||
@@ -100,6 +104,9 @@ namespace Content.Server.Cabinet
|
|||||||
if (!Resolve(uid, ref cabinet))
|
if (!Resolve(uid, ref cabinet))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (TryComp<LockComponent>(uid, out var lockComponent) && lockComponent.Locked)
|
||||||
|
return;
|
||||||
|
|
||||||
cabinet.Opened = !cabinet.Opened;
|
cabinet.Opened = !cabinet.Opened;
|
||||||
SoundSystem.Play(cabinet.DoorSound.GetSound(), Filter.Pvs(uid), uid, AudioHelpers.WithVariation(0.15f));
|
SoundSystem.Play(cabinet.DoorSound.GetSound(), Filter.Pvs(uid), uid, AudioHelpers.WithVariation(0.15f));
|
||||||
_itemSlotsSystem.SetLock(uid, cabinet.CabinetSlot, !cabinet.Opened);
|
_itemSlotsSystem.SetLock(uid, cabinet.CabinetSlot, !cabinet.Opened);
|
||||||
|
|||||||
Reference in New Issue
Block a user