From b1beace4eae4bd2ea138f8685a26f35d675cbf93 Mon Sep 17 00:00:00 2001 From: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com> Date: Mon, 24 Jul 2023 09:36:56 -0500 Subject: [PATCH] stealth implant cooldown balancing (#21713) --- .../items/weapons/implants/implant_stealth.dm | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/code/game/objects/items/weapons/implants/implant_stealth.dm b/code/game/objects/items/weapons/implants/implant_stealth.dm index 17ca24b2ecf..f964335adbf 100644 --- a/code/game/objects/items/weapons/implants/implant_stealth.dm +++ b/code/game/objects/items/weapons/implants/implant_stealth.dm @@ -35,13 +35,9 @@ recall_box_animation() return // Box closing from here on out. - if(on_cooldown) - return FALSE if(!isturf(owner.loc)) //Don't let the player use this to escape mechs/welded closets. to_chat(owner, "You need more space to activate this implant!") return - addtimer(VARSET_CALLBACK(src, on_cooldown, FALSE), 10 SECONDS) - on_cooldown = TRUE owner.playsound_local(owner, 'sound/misc/box_deploy.ogg', 50, TRUE) spawn_box() @@ -61,6 +57,22 @@ INVOKE_ASYNC(box, TYPE_PROC_REF(/obj/structure/closet/cardboard/agent, go_invisible), 1.7 SECONDS) box.create_fake_box() owner.forceMove(box) + RegisterSignal(box, COMSIG_PARENT_QDELETING, PROC_REF(start_cooldown)) + +/datum/action/item_action/agent_box/proc/start_cooldown(datum/source) + SIGNAL_HANDLER + on_cooldown = TRUE + addtimer(CALLBACK(src, PROC_REF(end_cooldown)), 10 SECONDS) + UpdateButtonIcon() + +/datum/action/item_action/agent_box/proc/end_cooldown() + on_cooldown = FALSE + UpdateButtonIcon() + +/datum/action/item_action/agent_box/IsAvailable() + if(..() && !on_cooldown) + return TRUE + return FALSE /datum/action/item_action/agent_box/proc/recall_box_animation() var/image/fake_box = image('icons/obj/cardboard_boxes.dmi', owner, "agentbox", ABOVE_MOB_LAYER)