From 44b98df815074177e397d7b5fe808c216cbfe336 Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Sun, 8 Feb 2026 18:58:45 -0500 Subject: [PATCH] Fix right clicking a closet with an ID in hand toggling locks twice in one tick (#95112) `togglelock` is called in both tool_interact and attack_hand. Aborting on the first success here prevents the double toggle :cl: fix: Fixed right clicking a closet with an ID in hand toggling locks twice in one tick /:cl: Co-authored-by: Jordan Dominion --- code/game/objects/structures/crates_lockers/closets.dm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 793a2afa3c3..4484ed1c645 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -1133,7 +1133,7 @@ GLOBAL_LIST_EMPTY(roundstart_station_closets) /obj/structure/closet/proc/togglelock(mob/living/user, silent) if(!secure || broken) - return + return FALSE if(locked) //only apply checks while unlocking else allow anyone to lock it var/error_msg = "" @@ -1145,8 +1145,7 @@ GLOBAL_LIST_EMPTY(roundstart_station_closets) id_card = null req_access = list() req_one_access = null - togglelock(user, silent) - return + return togglelock(user, silent) if(!can_unlock(user, user.get_idcard(), registered_id)) error_msg = "not your locker!" else if(!can_unlock(user, user.get_idcard())) @@ -1154,7 +1153,7 @@ GLOBAL_LIST_EMPTY(roundstart_station_closets) if(error_msg) if(!silent) balloon_alert(user, error_msg) - return + return TRUE if(iscarbon(user)) add_fingerprint(user) @@ -1165,6 +1164,7 @@ GLOBAL_LIST_EMPTY(roundstart_station_closets) span_notice("You [locked ? "locked" : "unlocked"] [src]."), ) update_appearance() + return TRUE /// toggles the lock state of a closet /obj/structure/closet/proc/lock()