Skip to content

Commit

Permalink
Adds a semi-big whistle cooldown. (#5469)
Browse files Browse the repository at this point in the history
Adds a 10 second cooldown to the whistles to make them less spammy
# About the pull request

This PR gives the whistles a 10 second cooldown to have people spam them
less. It also sends a message telling the player how long they need to
wait before they can use it again.

# Explain why it's good for the game

Right now what often ends up happening is people deleting all of the
whistles because they are VERY loud and VERY spammy. This should make
that less of an issue.


# Testing Photographs and Procedure
<details>
It works :D


![image](https://github.com/cmss13-devs/cmss13/assets/115504494/58487e7c-3584-4ff1-ad63-c8fc918fa5a0)

</details>


# Changelog

:cl:
qol: made whistles less spammy
/:cl:

---------

Co-authored-by: Zonespace <[email protected]>
  • Loading branch information
ClairionCM and Zonespace27 committed Jan 20, 2024
1 parent cb1d612 commit a34b1c3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions code/game/objects/items/devices/whistle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
..()
Expand All @@ -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))
Expand Down

0 comments on commit a34b1c3

Please sign in to comment.