Adds TTS to the game. Players can select their own voices in preferences. (#74775)

Co-authored-by: Watermelon914 <3052169-Watermelon914@users.noreply.gitlab.com>
Co-authored-by: Kyle Spier-Swenson <kyleshome@gmail.com>
Co-authored-by: Iamgoofball <iamgoofball@gmail.com>
Co-authored-by: Zephyr <12817816+ZephyrTFA@users.noreply.github.com>
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
This commit is contained in:
Watermelon914
2023-05-15 16:21:54 -07:00
committed by GitHub
co-authored by Watermelon914 Kyle Spier-Swenson Iamgoofball Zephyr Mothblocks
parent cb38c9d429
commit a98706ff8b
39 changed files with 783 additions and 32 deletions
@@ -3,6 +3,9 @@
alert_type = null
remove_on_fullheal = TRUE
var/make_tts_message_original = FALSE
var/tts_filter = ""
/datum/status_effect/speech/on_creation(mob/living/new_owner, duration = 10 SECONDS)
src.duration = duration
return ..()
@@ -23,10 +26,15 @@
/datum/status_effect/speech/proc/handle_message(datum/source, list/message_args)
SIGNAL_HANDLER
var/phrase = html_decode(message_args[TREAT_MESSAGE_MESSAGE])
var/phrase = html_decode(message_args[TREAT_MESSAGE_ARG])
if(!length(phrase))
return
if(length(tts_filter) > 0)
message_args[TREAT_TTS_FILTER_ARG] += tts_filter
if(make_tts_message_original)
message_args[TREAT_TTS_MESSAGE_ARG] = message_args[TREAT_MESSAGE_ARG]
var/final_phrase = ""
var/original_char = ""
@@ -35,7 +43,7 @@
final_phrase += apply_speech(original_char, original_char)
message_args[TREAT_MESSAGE_MESSAGE] = sanitize(final_phrase)
message_args[TREAT_MESSAGE_ARG] = sanitize(final_phrase)
/**
* Applies the speech effects on the past character, changing
@@ -54,6 +62,9 @@
/// Regex of characters we won't apply a stutter to
var/static/regex/no_stutter
make_tts_message_original = TRUE
tts_filter = "tremolo=f=10:d=0.8,rubberband=tempo=0.5"
/datum/status_effect/speech/stutter/on_creation(mob/living/new_owner, ...)
. = ..()
if(!.)
@@ -83,7 +94,7 @@
/datum/status_effect/speech/stutter/derpspeech/handle_message(datum/source, list/message_args)
var/message = html_decode(message_args[TREAT_MESSAGE_MESSAGE])
var/message = html_decode(message_args[TREAT_MESSAGE_ARG])
message = replacetext(message, " am ", " ")
message = replacetext(message, " is ", " ")
@@ -100,7 +111,7 @@
message = uppertext(message)
message += "[apply_speech(exclamation, exclamation)]"
message_args[1] = message
message_args[TREAT_MESSAGE_ARG] = message
var/mob/living/living_source = source
if(!isliving(source) || living_source.has_status_effect(/datum/status_effect/speech/stutter))
@@ -207,6 +218,8 @@
doubletext_prob = 0
text_modification_file = "slurring_cult_text.json"
tts_filter = "rubberband=pitch=0.5,vibrato=5"
/datum/status_effect/speech/slurring/heretic
id = "heretic_slurring"
common_prob = 50