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:
MrMelbert
2026-04-04 07:25:12 -05:00
committed by GitHub
parent 0f450388cb
commit b79743df08
8 changed files with 27 additions and 11 deletions
+18
View File
@@ -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