From 78e293308f81fc325c01f3a6f06e2317c6fbae41 Mon Sep 17 00:00:00 2001 From: ClairionCM <115504494+ClairionCM@users.noreply.github.com> Date: Tue, 16 Jan 2024 05:10:22 +0100 Subject: [PATCH 1/2] Whistle Cooldown.dm Adds a 10 second cooldown to the whistles to make them less spammy --- code/game/objects/items/devices/whistle.dm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/code/game/objects/items/devices/whistle.dm b/code/game/objects/items/devices/whistle.dm index 4eb61a48b903..c0196568b593 100644 --- a/code/game/objects/items/devices/whistle.dm +++ b/code/game/objects/items/devices/whistle.dm @@ -8,7 +8,8 @@ actions_types = list(/datum/action/item_action) var/volume = 60 - var/spamcheck = 0 + var/spam_cooldown_time = 10 SECONDS + COOLDOWN_DECLARE(spam_cooldown) /obj/item/device/whistle/attack_self(mob/user) ..() @@ -28,14 +29,14 @@ ..() /obj/item/device/whistle/proc/whistle_playsound(mob/user) - if (spamcheck) + if(!COOLDOWN_FINISHED(src, spam_cooldown)) + to_chat(user, SPAN_DANGER("\ You are out of breath after using [src]! Wait [COOLDOWN_SECONDSLEFT(src, spam_cooldown)] second(s).")) return user.visible_message(SPAN_WARNING("[user] blows into [src]!")) playsound(get_turf(src), 'sound/items/whistle.ogg', volume, 1, vary = 0) - spamcheck = 1 - addtimer(VARSET_CALLBACK(src, spamcheck, FALSE), 3 SECONDS) + COOLDOWN_START(src, spam_cooldown, spam_cooldown_time) /obj/item/device/whistle/MouseDrop(obj/over_object) if(ishuman(usr) || isrobot(usr)) From b98c2b59b60275484fdae9072ff494e9dae4456d Mon Sep 17 00:00:00 2001 From: ClairionCM <115504494+ClairionCM@users.noreply.github.com> Date: Tue, 16 Jan 2024 05:46:29 +0100 Subject: [PATCH 2/2] Update code/game/objects/items/devices/whistle.dm Co-authored-by: Zonespace <41448081+Zonespace27@users.noreply.github.com> --- code/game/objects/items/devices/whistle.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/objects/items/devices/whistle.dm b/code/game/objects/items/devices/whistle.dm index c0196568b593..7abc5d760590 100644 --- a/code/game/objects/items/devices/whistle.dm +++ b/code/game/objects/items/devices/whistle.dm @@ -30,7 +30,7 @@ /obj/item/device/whistle/proc/whistle_playsound(mob/user) if(!COOLDOWN_FINISHED(src, spam_cooldown)) - to_chat(user, SPAN_DANGER("\ You are out of breath after using [src]! Wait [COOLDOWN_SECONDSLEFT(src, spam_cooldown)] second(s).")) + to_chat(user, SPAN_DANGER("You are out of breath after using [src]! Wait [COOLDOWN_SECONDSLEFT(src, spam_cooldown)] second\s.")) return user.visible_message(SPAN_WARNING("[user] blows into [src]!"))