From 85fbada8a769a0c0731f31136ead2cc723a1abab Mon Sep 17 00:00:00 2001 From: datlo Date: Wed, 12 Jun 2024 20:42:11 +0200 Subject: [PATCH] Increase opening speed of jani keyring on repeated airlock use (#25689) * Buff jani keyring * remove repeated code * update to UIDs for GC * Apply suggestions from code review Signed-off-by: Luc <89928798+lewcc@users.noreply.github.com> --------- Signed-off-by: Luc <89928798+lewcc@users.noreply.github.com> Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> --- code/game/objects/items/control_wand.dm | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/code/game/objects/items/control_wand.dm b/code/game/objects/items/control_wand.dm index 33510ccccf5..4cec5362129 100644 --- a/code/game/objects/items/control_wand.dm +++ b/code/game/objects/items/control_wand.dm @@ -210,6 +210,8 @@ var/cooldown = 0 /// How fast does the keyring open an airlock. It is not set here so that it can be set via the user's role. var/hack_speed + /// Stores the last airlock opened, opens faster on repeated use + var/last_airlock_uid additional_access = list(ACCESS_MEDICAL, ACCESS_RESEARCH, ACCESS_CONSTRUCTION, ACCESS_MAILSORTING, ACCESS_CARGO, ACCESS_MINING, ACCESS_KITCHEN, ACCESS_BAR, ACCESS_JANITOR, ACCESS_CHAPEL_OFFICE) /obj/item/door_remote/janikeyring/examine(mob/user) @@ -232,16 +234,20 @@ to_chat(user, "You are already using [src] on the [D]'s access panel!") return busy = TRUE - to_chat(user, "You fiddle with [src], trying different keys to open the [D]...") - playsound(src, 'sound/items/keyring_unlock.ogg', 50) - var/mob/living/carbon/human/H = user - if(H.mind.assigned_role != "Janitor") - hack_speed = rand(30, 60) SECONDS + if(H.mind.assigned_role == "Janitor" && last_airlock_uid == D.UID()) + to_chat(user, "You recognize [D] and look for the key you used...") + hack_speed = 5 SECONDS else - hack_speed = rand(5, 20) SECONDS - + to_chat(user, "You fiddle with [src], trying different keys to open [D]...") + if(H.mind.assigned_role != "Janitor") + hack_speed = rand(30, 60) SECONDS + else + hack_speed = rand(5, 20) SECONDS + playsound(src, 'sound/items/keyring_unlock.ogg', 50) if(do_after(user, hack_speed, target = D, progress = 0)) + if(D.check_access(ID)) + last_airlock_uid = D.UID() . = ..() busy = FALSE