Files
Bubberstation/code/modules/client/preferences/middleware/tts.dm
SkyratBot 6c9be73f51 [MIRROR] Adds TTS to the game. Players can select their own voices in preferences. [MDB IGNORE] (#21232)
* Adds TTS to the game. Players can select their own voices in preferences.

* [SEMI-MODULAR] [MIRROR FIX] Fixes the TTS PR. (#21267)

Fixes the TTS PR.

---------

Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com>
Co-authored-by: Iamgoofball <iamgoofball@gmail.com>
2023-05-19 01:47:19 +01:00

17 lines
655 B
Plaintext

/// Middleware to handle quirks
/datum/preference_middleware/tts
/// Cooldown on requesting a TTS preview.
COOLDOWN_DECLARE(tts_test_cooldown)
action_delegations = list(
"play_voice" = PROC_REF(play_voice),
)
/datum/preference_middleware/tts/proc/play_voice(list/params, mob/user)
if(!COOLDOWN_FINISHED(src, tts_test_cooldown))
return TRUE
var/speaker = preferences.read_preference(/datum/preference/choiced/voice)
COOLDOWN_START(src, tts_test_cooldown, 0.5 SECONDS)
INVOKE_ASYNC(SStts, TYPE_PROC_REF(/datum/controller/subsystem/tts, queue_tts_message), user.client, "Hello, this is my voice.", speaker = speaker, local = TRUE)
return TRUE