mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-18 03:26:31 +01:00
Randomize tts voice more appropriately (#95272)
## About The Pull Request Adds a helper `SStts.random_tts_voice(gender)` which attempts to pick an appropriate voice for the passed gender ## Why It's Good For The Game Randomization into a completely wrong voice kinda ruins it ## Changelog 🆑 Melbert qol: TTS voice is more appropriately randomized to gender qol: Getting randomized through means such as mulligan toxin randomizes TTS voices /🆑 --------- Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com>
This commit is contained in:
@@ -311,6 +311,24 @@ SUBSYSTEM_DEF(tts)
|
||||
else
|
||||
queued_http_messages.insert(current_request)
|
||||
|
||||
/// Helper to get a random TTS voice for a certain gender. Passing no gender just results in a random voice.
|
||||
/datum/controller/subsystem/tts/proc/random_tts_voice(gender = NEUTER)
|
||||
if(!tts_enabled)
|
||||
return null
|
||||
|
||||
var/sanity = 0
|
||||
while(sanity < 10)
|
||||
var/voice = pick(available_speakers)
|
||||
if(gender != MALE && gender != FEMALE)
|
||||
return voice
|
||||
if(gender == MALE && findtext(voice, "Man"))
|
||||
return voice
|
||||
if(gender == FEMALE && findtext(voice, "Woman"))
|
||||
return voice
|
||||
sanity += 1
|
||||
|
||||
return pick(available_speakers) // failsafe
|
||||
|
||||
/// A struct containing information on an individual player or mob who has made a TTS request
|
||||
/datum/tts_request
|
||||
/// The mob to play this TTS message on
|
||||
|
||||
Reference in New Issue
Block a user