Fix item cabinet locking while open and locker favoritism (#12508)
Co-authored-by: Moony <moony@hellomouse.net> Fixes https://github.com/space-wizards/space-station-14/issues/12426
This commit is contained in:
@@ -27,6 +27,8 @@ namespace Content.Server.Cabinet
|
||||
|
||||
SubscribeLocalEvent<ItemCabinetComponent, EntInsertedIntoContainerMessage>(OnContainerModified);
|
||||
SubscribeLocalEvent<ItemCabinetComponent, EntRemovedFromContainerMessage>(OnContainerModified);
|
||||
|
||||
SubscribeLocalEvent<ItemCabinetComponent, LockToggleAttemptEvent>(OnLockToggleAttempt);
|
||||
}
|
||||
|
||||
private void OnComponentInit(EntityUid uid, ItemCabinetComponent cabinet, ComponentInit args)
|
||||
@@ -63,6 +65,13 @@ namespace Content.Server.Cabinet
|
||||
UpdateAppearance(uid, cabinet);
|
||||
}
|
||||
|
||||
private void OnLockToggleAttempt(EntityUid uid, ItemCabinetComponent cabinet, ref LockToggleAttemptEvent args)
|
||||
{
|
||||
// Cannot lock or unlock while open.
|
||||
if (cabinet.Opened)
|
||||
args.Cancelled = true;
|
||||
}
|
||||
|
||||
private void AddToggleOpenVerb(EntityUid uid, ItemCabinetComponent cabinet, GetVerbsEvent<ActivationVerb> args)
|
||||
{
|
||||
if (args.Hands == null || !args.CanAccess || !args.CanInteract)
|
||||
|
||||
Reference in New Issue
Block a user