[MIRROR] Adds a cooldown to the deliver_first crates deny sound [MDB IGNORE] (#12142)

* Adds a cooldown to the deliver_first crates deny sound (#65443)

This is really annoying, byond sound sucks, etc

* Adds a cooldown to the deliver_first crates deny sound

Co-authored-by: Seth Scherer <supernovaa41@gmx.com>
This commit is contained in:
SkyratBot
2022-03-17 08:49:56 -07:00
committed by GitHub
co-authored by Seth Scherer
parent d894533c91
commit 0fbcaaef65
+9 -1
View File
@@ -6,6 +6,8 @@
*
* for the future coders or just me: please convert this into a component to allow for more feedback on the crate's status (clicking when unlocked, overlays, etc)
*/
#define DENY_SOUND_COOLDOWN (2 SECONDS)
/datum/element/deliver_first
element_flags = ELEMENT_DETACH | ELEMENT_BESPOKE
id_arg_index = 2
@@ -13,6 +15,8 @@
var/goal_area_type
///how much is earned on delivery of the crate
var/payment
///cooldown for the deny sound
COOLDOWN_DECLARE(deny_cooldown)
/datum/element/deliver_first/Attach(datum/target, goal_area_type, payment)
. = ..()
@@ -75,7 +79,9 @@
return BLOCK_OPEN
if(user)
target.balloon_alert(user, "access denied until delivery!")
playsound(target, 'sound/machines/buzz-two.ogg', 30, TRUE)
if(COOLDOWN_FINISHED(src, deny_cooldown))
playsound(target, 'sound/machines/buzz-two.ogg', 30, TRUE)
COOLDOWN_START(src, deny_cooldown, DENY_SOUND_COOLDOWN)
return BLOCK_OPEN
///signal called by successfully opening target
@@ -95,3 +101,5 @@
spark_system.start()
playsound(src, SFX_SPARKS, 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
target.RemoveElement(/datum/element/deliver_first, goal_area_type, payment)
#undef DENY_SOUND_COOLDOWN