From 932d5cd82563f0224da1b8d9c4f424da2ecdb0d3 Mon Sep 17 00:00:00 2001 From: grungussuss <96586172+Sadboysuss@users.noreply.github.com> Date: Thu, 17 Oct 2024 21:09:52 +0300 Subject: [PATCH] Gives audible emotes an emote specific audio cooldown alongside the general audio cooldown (#87210) ## About The Pull Request defaults: ```php /// How long is the shared emote cooldown triggered by this emote? var/general_emote_audio_cooldown = 2 SECONDS /// How long is the specific emote cooldown triggered by this emote? var/specific_emote_audio_cooldown = 5 SECONDS ``` specific cooldown only checks for the emote, while the general is a shared cooldown, gave laugh and scream longer specific cooldowns. ## Why It's Good For The Game The general emote cooldown fixed the problem of multiple emotes getting used at once, now we have a problem with people using the same emote too many times, I want to give the players ability to use sounds in their emotes, but spamming the same emote over and over again makes me regret it and hesitant about it, this way we can have the best of both worlds. ## Changelog :cl: grungussuss sound: along with the shared emote cooldown, specific emote audio cooldown has returned. /:cl: # Conflicts: # code/datums/emotes.dm --- code/datums/emotes.dm | 21 ++++++++----------- code/modules/mob/living/carbon/emote.dm | 2 -- code/modules/mob/living/carbon/human/emote.dm | 2 +- code/modules/mob/living/emote.dm | 5 +---- 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/code/datums/emotes.dm b/code/datums/emotes.dm index 9029f6c4e56..57660368c63 100644 --- a/code/datums/emotes.dm +++ b/code/datums/emotes.dm @@ -50,7 +50,7 @@ var/stat_allowed = CONSCIOUS /// Sound to play when emote is called. var/sound - /// Used for the honk borg emote. + /// Does this emote vary in pitch? var/vary = FALSE /// Can only code call this event instead of the player. var/only_forced_audio = FALSE @@ -58,8 +58,10 @@ var/cooldown = 0.8 SECONDS /// Does this message have a message that can be modified by the user? var/can_message_change = FALSE - /// How long is the cooldown on the audio of the emote, if it has one? - var/audio_cooldown = 2 SECONDS + /// How long is the shared emote cooldown triggered by this emote? + var/general_emote_audio_cooldown = 2 SECONDS + /// How long is the specific emote cooldown triggered by this emote? + var/specific_emote_audio_cooldown = 5 SECONDS /// Does this emote's sound ignore walls? var/sound_wall_ignore = FALSE @@ -100,15 +102,10 @@ user.log_message(msg, LOG_EMOTE) var/tmp_sound = get_sound(user) - if(tmp_sound && should_play_sound(user, intentional) && TIMER_COOLDOWN_FINISHED(user, "audible_emote_cooldown")) - TIMER_COOLDOWN_START(user, "audible_emote_cooldown", audio_cooldown) - //SKYRAT EDIT CHANGE BEGIN - //playsound(source = user,soundin = tmp_sound,vol = 50, vary = vary, ignore_walls = sound_wall_ignore) - SKYRAT EDIT - ORIGINAL - if(istype(src, /datum/emote/living/lewd)) - conditional_pref_sound(user, tmp_sound, sound_volume, vary, pref_to_check = /datum/preference/toggle/erp/sounds) - else - playsound(source = user, soundin = tmp_sound, vol = sound_volume, vary = vary, ignore_walls = sound_wall_ignore) - //SKYRAT EDIT CHANGE END + if(tmp_sound && should_play_sound(user, intentional) && TIMER_COOLDOWN_FINISHED(user, "general_emote_audio_cooldown") && TIMER_COOLDOWN_FINISHED(user, type)) + TIMER_COOLDOWN_START(user, type, specific_emote_audio_cooldown) + TIMER_COOLDOWN_START(user, "general_emote_audio_cooldown", general_emote_audio_cooldown) + playsound(source = user,soundin = tmp_sound,vol = 50, vary = vary, ignore_walls = sound_wall_ignore) var/is_important = emote_type & EMOTE_IMPORTANT var/is_visual = emote_type & EMOTE_VISIBLE diff --git a/code/modules/mob/living/carbon/emote.dm b/code/modules/mob/living/carbon/emote.dm index cc1043587a2..d32b146d0cb 100644 --- a/code/modules/mob/living/carbon/emote.dm +++ b/code/modules/mob/living/carbon/emote.dm @@ -24,7 +24,6 @@ message = "claps." hands_use_check = TRUE emote_type = EMOTE_AUDIBLE | EMOTE_VISIBLE - audio_cooldown = 5 SECONDS vary = TRUE /datum/emote/living/carbon/clap/get_sound(mob/living/user) @@ -57,7 +56,6 @@ key_third_person = "cries" message = "cries." message_mime = "sobs silently." - audio_cooldown = 5 SECONDS emote_type = EMOTE_AUDIBLE | EMOTE_VISIBLE vary = TRUE stat_allowed = SOFT_CRIT diff --git a/code/modules/mob/living/carbon/human/emote.dm b/code/modules/mob/living/carbon/human/emote.dm index 334eb5f66ef..e725b867982 100644 --- a/code/modules/mob/living/carbon/human/emote.dm +++ b/code/modules/mob/living/carbon/human/emote.dm @@ -63,7 +63,7 @@ message = "screams!" message_mime = "acts out a scream!" emote_type = EMOTE_AUDIBLE | EMOTE_VISIBLE - audio_cooldown = 5 SECONDS + specific_emote_audio_cooldown = 10 SECONDS vary = TRUE /datum/emote/living/carbon/human/scream/can_run_emote(mob/user, status_check = TRUE , intentional, params) diff --git a/code/modules/mob/living/emote.dm b/code/modules/mob/living/emote.dm index 3df2b8772b9..2b180b804ad 100644 --- a/code/modules/mob/living/emote.dm +++ b/code/modules/mob/living/emote.dm @@ -263,7 +263,7 @@ message = "laughs." message_mime = "laughs silently!" emote_type = EMOTE_VISIBLE | EMOTE_AUDIBLE - audio_cooldown = 5 SECONDS + specific_emote_audio_cooldown = 8 SECONDS vary = TRUE /datum/emote/living/laugh/can_run_emote(mob/living/user, status_check = TRUE , intentional, params) @@ -312,7 +312,6 @@ message = "sneezes." message_mime = "acts out an exaggerated silent sneeze." emote_type = EMOTE_VISIBLE | EMOTE_AUDIBLE - audio_cooldown = 5 SECONDS vary = TRUE /datum/emote/living/sneeze/get_sound(mob/living/carbon/human/user) @@ -326,7 +325,6 @@ message = "coughs!" message_mime = "acts out an exaggerated cough!" vary = TRUE - audio_cooldown = 5 SECONDS emote_type = EMOTE_VISIBLE | EMOTE_AUDIBLE | EMOTE_RUNECHAT /datum/emote/living/cough/can_run_emote(mob/user, status_check = TRUE , intentional, params) @@ -744,7 +742,6 @@ key_third_person = "whistles" message = "whistles." message_mime = "whistles silently!" - audio_cooldown = 5 SECONDS vary = TRUE emote_type = EMOTE_AUDIBLE | EMOTE_VISIBLE