mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 12:41:09 +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:
co-authored by
Watermelon914
parent
0f450388cb
commit
b79743df08
@@ -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
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
human.physique = human.gender
|
||||
human.real_name = human.generate_random_mob_name()
|
||||
human.name = human.get_visible_name()
|
||||
human.voice = SStts.random_tts_voice(human.gender)
|
||||
human.set_eye_color(random_eye_color())
|
||||
human.skin_tone = pick(GLOB.skin_tones)
|
||||
// No underwear generation handled here
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
savefile_identifier = PREFERENCE_CHARACTER
|
||||
savefile_key = "tts_voice"
|
||||
category = PREFERENCE_CATEGORY_NON_CONTEXTUAL
|
||||
priority = PREFERENCE_PRIORITY_BODY_TYPE
|
||||
should_update_preview = FALSE
|
||||
|
||||
/datum/preference/choiced/voice/is_accessible(datum/preferences/preferences)
|
||||
@@ -23,7 +24,7 @@
|
||||
|
||||
/datum/preference/choiced/voice/apply_to_human(mob/living/carbon/human/target, value)
|
||||
if(SStts.tts_enabled && !(value in SStts.available_speakers))
|
||||
value = pick(SStts.available_speakers) // As a failsafe
|
||||
value = SStts.random_tts_voice(target.gender) // As a failsafe
|
||||
target.voice = value
|
||||
|
||||
/datum/preference/numeric/tts_voice_pitch
|
||||
|
||||
@@ -383,9 +383,7 @@
|
||||
. = ..()
|
||||
ADD_TRAIT(src, TRAIT_CONTRABAND, INNATE_TRAIT)
|
||||
register_context()
|
||||
|
||||
if(SStts.tts_enabled) //This capsule informs you on why it cannot be deployed in a sliiiiightly different way.
|
||||
voice = pick(SStts.available_speakers)
|
||||
voice = SStts.random_tts_voice()
|
||||
|
||||
/obj/item/survivalcapsule/fishing/add_context(atom/source, list/context, obj/item/held_item, mob/user)
|
||||
if(!held_item || held_item == src)
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
if(!SStts.tts_enabled)
|
||||
return
|
||||
|
||||
voice = pick(SStts.available_speakers)
|
||||
voice = SStts.random_tts_voice()
|
||||
if(SStts.pitch_enabled)
|
||||
if(findtext(voice, "Woman"))
|
||||
pitch = 12 // up-pitch by one octave
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
dna?.species?.on_owner_login(src)
|
||||
|
||||
if(SStts.tts_enabled && !voice)
|
||||
voice = pick(SStts.available_speakers)
|
||||
voice = SStts.random_tts_voice(gender)
|
||||
|
||||
if(!LAZYLEN(afk_thefts))
|
||||
return
|
||||
|
||||
@@ -53,8 +53,7 @@
|
||||
|
||||
/mob/living/silicon/Initialize(mapload)
|
||||
. = ..()
|
||||
if(SStts.tts_enabled)
|
||||
voice = pick(SStts.available_speakers)
|
||||
voice = SStts.random_tts_voice()
|
||||
GLOB.silicon_mobs += src
|
||||
add_faction(FACTION_SILICON)
|
||||
if(ispath(radio))
|
||||
|
||||
+2
-3
@@ -213,9 +213,8 @@
|
||||
set_wires(new /datum/wires/vending(src))
|
||||
|
||||
if(SStts.tts_enabled)
|
||||
var/static/vendor_voice_by_type = list()
|
||||
if(!vendor_voice_by_type[type])
|
||||
vendor_voice_by_type[type] = pick(SStts.available_speakers)
|
||||
var/static/list/vendor_voice_by_type = list()
|
||||
vendor_voice_by_type[type] ||= SStts.random_tts_voice()
|
||||
voice = vendor_voice_by_type[type]
|
||||
|
||||
slogan_list = splittext(product_slogans, ";")
|
||||
|
||||
Reference in New Issue
Block a user