diff --git a/code/controllers/subsystem/text_to_speech.dm b/code/controllers/subsystem/text_to_speech.dm index 667b4904034..cdfb8adc4a7 100644 --- a/code/controllers/subsystem/text_to_speech.dm +++ b/code/controllers/subsystem/text_to_speech.dm @@ -292,6 +292,7 @@ SUBSYSTEM_DEF(tts) var/dirty_text = message var/text = sanitize_tts_input(dirty_text) + var/whisper = FALSE if(!text || length_char(text) > MAX_MESSAGE_LEN) return @@ -304,6 +305,7 @@ SUBSYSTEM_DEF(tts) if(traits & TTS_TRAIT_PITCH_WHISPER) text = provider.pitch_whisper(text) + whisper = TRUE var/hash = rustg_hash_string(RUSTG_HASH_MD5, lowertext(text)) var/filename = "sound/tts_cache/[seed.name]/[hash]" @@ -311,10 +313,10 @@ SUBSYSTEM_DEF(tts) if(fexists("[filename].ogg")) tts_reused++ tts_rrps_counter++ - play_tts(speaker, listener, filename, is_local, effect, preSFX, postSFX) + play_tts(speaker, listener, filename, is_local, effect, preSFX, postSFX, whisper) return - var/datum/callback/play_tts_cb = CALLBACK(src, PROC_REF(play_tts), speaker, listener, filename, is_local, effect, preSFX, postSFX) + var/datum/callback/play_tts_cb = CALLBACK(src, PROC_REF(play_tts), speaker, listener, filename, is_local, effect, preSFX, postSFX, whisper) if(LAZYLEN(tts_queue[filename])) tts_reused++ @@ -371,7 +373,7 @@ SUBSYSTEM_DEF(tts) tts_queue -= filename -/datum/controller/subsystem/tts/proc/play_tts(atom/speaker, mob/listener, filename, is_local = TRUE, effect = SOUND_EFFECT_NONE, preSFX = null, postSFX = null) +/datum/controller/subsystem/tts/proc/play_tts(atom/speaker, mob/listener, filename, is_local = TRUE, effect = SOUND_EFFECT_NONE, preSFX = null, postSFX = null, whisper = FALSE) if(isnull(listener) || !listener.client) return @@ -393,7 +395,7 @@ SUBSYSTEM_DEF(tts) CRASH("Invalid sound effect chosen.") if(effect != SOUND_EFFECT_NONE) if(!fexists(voice)) - var/datum/callback/play_tts_cb = CALLBACK(src, PROC_REF(play_tts), speaker, listener, filename, is_local, effect, preSFX, postSFX) + var/datum/callback/play_tts_cb = CALLBACK(src, PROC_REF(play_tts), speaker, listener, filename, is_local, effect, preSFX, postSFX, whisper) if(LAZYLEN(tts_effects_queue[voice])) LAZYADD(tts_effects_queue[voice], play_tts_cb) return @@ -411,7 +413,7 @@ SUBSYSTEM_DEF(tts) var/volume = 100 var/channel = CHANNEL_TTS_RADIO if(is_local) - volume = 100 * listener.client.prefs.get_channel_volume(CHANNEL_TTS_LOCAL) + volume = 100 * listener.client.prefs.get_channel_volume(CHANNEL_TTS_LOCAL) / (whisper ? 3 : 1) channel = get_local_channel_by_owner(speaker) var/sound/output = sound(voice) @@ -420,7 +422,7 @@ SUBSYSTEM_DEF(tts) if(isnull(speaker)) output.wait = TRUE output.channel = channel - output.volume = volume * listener.client.prefs.get_channel_volume(CHANNEL_GENERAL) * listener.client.prefs.get_channel_volume(channel) + output.volume = volume * listener.client.prefs.get_channel_volume(CHANNEL_GENERAL) * listener.client.prefs.get_channel_volume(channel) / (whisper ? 3 : 1) output.environment = -1 if(output.volume <= 0) diff --git a/code/modules/flufftext/Hallucination.dm b/code/modules/flufftext/Hallucination.dm index 597d12cc4bc..f9aede1bd6b 100644 --- a/code/modules/flufftext/Hallucination.dm +++ b/code/modules/flufftext/Hallucination.dm @@ -781,7 +781,7 @@ GLOBAL_LIST_INIT(non_fakeattack_weapons, list(/obj/item/gun/projectile, /obj/ite if(person) //Basic talk var/image/speech_overlay = image('icons/mob/talk.dmi', person, "h0", layer = ABOVE_MOB_LAYER) SET_PLANE_EXPLICIT(speech_overlay, ABOVE_GAME_PLANE, src) - target.hear_say(message_to_multilingual(pick(speak_messages), safepick(person.languages)), speaker = person) + target.hear_say(message_to_multilingual(pick(speak_messages), safepick(person.languages)), speaker = person, is_whisper = TRUE) if(target.client) target.client.images |= speech_overlay sleep(30) diff --git a/code/modules/mob/hear_say.dm b/code/modules/mob/hear_say.dm index 9afe767d2e9..c0e99de82c6 100644 --- a/code/modules/mob/hear_say.dm +++ b/code/modules/mob/hear_say.dm @@ -95,11 +95,11 @@ return message return "[verb], \"[message]\"" -/mob/proc/hear_say(list/message_pieces, verb = "says", italics = FALSE, mob/speaker = null, sound/speech_sound, sound_vol, sound_frequency, use_voice = TRUE) +/mob/proc/hear_say(list/message_pieces, verb = "says", italics = FALSE, mob/speaker = null, sound/speech_sound, sound_vol, sound_frequency, use_voice = TRUE, is_whisper = FALSE) if(!client) return 0 - var/is_whisper = verb == "whispers" + if(isobserver(src) && client.prefs.toggles & PREFTOGGLE_CHAT_GHOSTEARS) if(speaker && !speaker.client && !(speaker in view(src))) diff --git a/code/modules/mob/living/living_say.dm b/code/modules/mob/living/living_say.dm index 4f98f9aeb9e..aaf15b54f22 100644 --- a/code/modules/mob/living/living_say.dm +++ b/code/modules/mob/living/living_say.dm @@ -390,7 +390,7 @@ GLOBAL_LIST_EMPTY(channel_to_radio_key) var/speech_bubble_test = say_test(message) for(var/mob/M in listening) - M.hear_say(message_pieces, verb, italics, src, speech_sound, sound_vol, sound_frequency) + M.hear_say(message_pieces, verb, italics, src, speech_sound, sound_vol, sound_frequency, FALSE) if(M.client) speech_bubble_recipients.Add(M.client) @@ -550,14 +550,14 @@ GLOBAL_LIST_EMPTY(channel_to_radio_key) var/speech_bubble_test = say_test(message) for(var/mob/M in listening) - M.hear_say(message_pieces, verb, italics, src, use_voice = FALSE) + M.hear_say(message_pieces, verb, italics, src, use_voice = FALSE, is_whisper = TRUE) if(M.client) speech_bubble_recipients.Add(M.client) if(eavesdropping.len) stars_all(message_pieces) //hopefully passing the message twice through stars() won't hurt... I guess if you already don't understand the language, when they speak it too quietly to hear normally you would be able to catch even less. for(var/mob/M in eavesdropping) - M.hear_say(message_pieces, verb, italics, src, use_voice = FALSE) + M.hear_say(message_pieces, verb, italics, src, use_voice = FALSE, is_whisper = TRUE) if(M.client) speech_bubble_recipients.Add(M.client) diff --git a/code/modules/mob/living/silicon/ai/freelook/eye.dm b/code/modules/mob/living/silicon/ai/freelook/eye.dm index 1db3c6566cb..003bba26bf5 100644 --- a/code/modules/mob/living/silicon/ai/freelook/eye.dm +++ b/code/modules/mob/living/silicon/ai/freelook/eye.dm @@ -176,7 +176,7 @@ to_chat(src, span_notice("You move down.")) -/mob/camera/aiEye/hear_say(list/message_pieces, verb = "says", italics = 0, mob/speaker = null, sound/speech_sound, sound_vol, sound_frequency, use_voice = TRUE) +/mob/camera/aiEye/hear_say(list/message_pieces, verb = "says", italics = 0, mob/speaker = null, sound/speech_sound, sound_vol, sound_frequency, use_voice = TRUE, is_whisper = FALSE) if(relay_speech) if(istype(ai)) ai.relay_speech(speaker, message_pieces, verb) diff --git a/code/modules/mob/living/simple_animal/hostile/gorilla/gorilla_actions.dm b/code/modules/mob/living/simple_animal/hostile/gorilla/gorilla_actions.dm index cbcb20e1b22..79e7a3878a0 100644 --- a/code/modules/mob/living/simple_animal/hostile/gorilla/gorilla_actions.dm +++ b/code/modules/mob/living/simple_animal/hostile/gorilla/gorilla_actions.dm @@ -93,7 +93,7 @@ return ..() -/mob/living/simple_animal/hostile/gorilla/hear_say(list/message_pieces, verb = "says", italics = FALSE, mob/speaker = null, sound/speech_sound, sound_vol, sound_frequency, use_voice = TRUE) +/mob/living/simple_animal/hostile/gorilla/hear_say(list/message_pieces, verb = "says", italics = FALSE, mob/speaker = null, sound/speech_sound, sound_vol, sound_frequency, use_voice = TRUE, is_whisper = FALSE) if(client || !can_befriend || !ishuman(speaker) || speaker == src || incapacitated() || is_on_cooldown()) return ..() diff --git a/code/modules/mob/living/simple_animal/parrot.dm b/code/modules/mob/living/simple_animal/parrot.dm index 8e3c8d08245..82704ca80e9 100644 --- a/code/modules/mob/living/simple_animal/parrot.dm +++ b/code/modules/mob/living/simple_animal/parrot.dm @@ -840,7 +840,7 @@ used_radios += ears -/mob/living/simple_animal/parrot/hear_say(list/message_pieces, verb = "says", italics = 0, mob/speaker = null, sound/speech_sound, sound_vol, sound_frequency, use_voice = TRUE) +/mob/living/simple_animal/parrot/hear_say(list/message_pieces, verb = "says", italics = 0, mob/speaker = null, sound/speech_sound, sound_vol, sound_frequency, use_voice = TRUE, is_whisper = FALSE) if(speaker != src && prob(50)) parrot_hear(html_decode(multilingual_to_message(message_pieces))) ..() diff --git a/code/modules/mob/living/simple_animal/slime/say.dm b/code/modules/mob/living/simple_animal/slime/say.dm index 5c3ccd7558d..f61609ffd48 100644 --- a/code/modules/mob/living/simple_animal/slime/say.dm +++ b/code/modules/mob/living/simple_animal/slime/say.dm @@ -1,4 +1,4 @@ -/mob/living/simple_animal/slime/hear_say(list/message_pieces, verb = "says", italics = 0, mob/speaker = null, sound/speech_sound, sound_vol, sound_frequency, use_voice = TRUE) +/mob/living/simple_animal/slime/hear_say(list/message_pieces, verb = "says", italics = 0, mob/speaker = null, sound/speech_sound, sound_vol, sound_frequency, use_voice = TRUE, is_whisper = FALSE) if(speaker != src && !stat) if(speaker in Friends) speech_buffer = list()