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>
This commit is contained in:
datlo
2024-06-12 20:42:11 +02:00
committed by GitHub
parent 37280f6404
commit 85fbada8a7
+13 -7
View File
@@ -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, "<span class='warning'>You are already using [src] on the [D]'s access panel!</span>")
return
busy = TRUE
to_chat(user, "<span class='notice'>You fiddle with [src], trying different keys to open the [D]...</span>")
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, "<span class='notice'>You recognize [D] and look for the key you used...</span>")
hack_speed = 5 SECONDS
else
hack_speed = rand(5, 20) SECONDS
to_chat(user, "<span class='notice'>You fiddle with [src], trying different keys to open [D]...</span>")
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