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:
Bright0
2022-12-06 16:59:59 -06:00
committed by GitHub
parent 14599c0a90
commit f55d85a975
4 changed files with 40 additions and 13 deletions

View File

@@ -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)