From 2e942b076c7a749950cf5d6e62f70b7f4cf0a18a Mon Sep 17 00:00:00 2001 From: ShadowLarkens Date: Thu, 7 Aug 2025 03:04:41 -0700 Subject: [PATCH] Simplified version of bloopers (#18173) --- code/modules/mob/living/say.dm | 48 ++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/code/modules/mob/living/say.dm b/code/modules/mob/living/say.dm index 3a3d53f6ef5..6ac72d206d9 100644 --- a/code/modules/mob/living/say.dm +++ b/code/modules/mob/living/say.dm @@ -419,23 +419,61 @@ var/list/channel_to_radio_key = list() C.images -= I qdel(I) - var/ourfreq = null - if(voice_freq > 0 ) - ourfreq = voice_freq //Log the message to file if(message_mode) message = "([message_mode == "headset" ? "Common" : capitalize(message_mode)]) [message]" //Adds radio keys used if available if(whispering) if(do_sound && message) - playsound(T, pick(voice_sounds_list), 25, TRUE, extrarange = -6, falloff = 1 , is_global = TRUE, frequency = ourfreq, ignore_walls = FALSE, preference = /datum/preference/toggle/whisper_sounds) + blooploop(message, extrarange = -6, volume = 25) + // playsound(T, pick(voice_sounds_list), 25, TRUE, extrarange = -6, falloff = 1 , is_global = TRUE, frequency = ourfreq, ignore_walls = FALSE, preference = /datum/preference/toggle/whisper_sounds) log_whisper(message, src) else if(do_sound && message) - playsound(T, pick(voice_sounds_list), 75, TRUE, falloff = 1 , is_global = TRUE, frequency = ourfreq, ignore_walls = FALSE, preference = /datum/preference/toggle/say_sounds) + blooploop(message, volume = 75) + // playsound(T, pick(voice_sounds_list), 75, TRUE, falloff = 1 , is_global = TRUE, frequency = ourfreq, ignore_walls = FALSE, preference = /datum/preference/toggle/say_sounds) log_say(message, src) return 1 +/*************************************************************************/ +/* HEAVILY SIMPLIFIED VARIANT OF BLOOPERS FROM Citadel */ +// https://github.com/Citadel-Station-13/Citadel-Station-13/pull/15677 */ +/*********************(***************************************************/ +#define BLOOPER_SPEED 6 +#define BLOOPER_SPEED_BASELINE 4 +#define BLOOPER_MAX_BLOOPERS 24 +#define BLOOPER_MAX_TIME (1.5 SECONDS) + +/mob/living/proc/blooper(extrarange = 0, volume) + playsound(\ + src,\ + pick(voice_sounds_list),\ + volume,\ + vary = TRUE,\ + extrarange = extrarange,\ + falloff = 1,\ + is_global = TRUE,\ + frequency = voice_freq > 0 ? voice_freq : null,\ + ignore_walls = FALSE,\ + preference = /datum/preference/toggle/say_sounds, + ) + +/mob/living/proc/blooploop(message, extrarange = 0, volume) + var/bloopers = min(round((LAZYLEN(message) / BLOOPER_SPEED)) + 1, BLOOPER_MAX_BLOOPERS) + var/total_delay + for(var/i in 1 to bloopers) + if(total_delay > BLOOPER_MAX_TIME) + break + addtimer(CALLBACK(src, PROC_REF(blooper), extrarange, volume), total_delay) + total_delay += rand(\ + DS2TICKS(BLOOPER_SPEED / BLOOPER_SPEED_BASELINE), \ + DS2TICKS(BLOOPER_SPEED / BLOOPER_SPEED_BASELINE) + DS2TICKS(BLOOPER_SPEED / BLOOPER_SPEED_BASELINE)) TICKS + +#undef BLOOPER_SPEED +#undef BLOOPER_SPEED_BASELINE +#undef BLOOPER_MAX_BLOOPERS +#undef BLOOPER_MAX_TIME + /mob/living/proc/say_signlang(var/message, var/verb="gestures", var/verb_understood="gestures", var/datum/language/language, var/type = 1) var/turf/T = get_turf(src) //We're in something, gesture to people inside the same thing