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