Skip to content

Commit

Permalink
Randomize mid-round role appearance (#8298)
Browse files Browse the repository at this point in the history
* Randomizes Conscript Appearances.
Sets conscript appearance to a limited range of random values for skin tone, hair color (head and face) and hairstyle
Sets or limits certain traits by gender (facial hair, first name, TTS seeds)
TTS seeds are set to default values until we have a way to get a list of valid TTS seeds.

* Tested for proper randomizing of genders
Ensured that pronouns match genders

* Bugfix
Fixed issue where spawning while having an empty list of pickable TTS seeds spawned the conscript without any gear

* Per request curate the hair color
Hair colors should now be less saturated/neon-whatever.
Not much I can do with the hair style and at a certain point I'm just gonna say it is a skill issue, print a hand mirror

* moved randomization to appearance.dm
Moved randomization to human appearance file so it can be referenced by any newly created human.
Replaced randomization script from ex_teleporter to appearance as randomize_appearance()

* Add appearnace randomization to last shelter spawn

* attempt to fix integration test failure on gender

* fixes for spider and names
spider_core generate_body proc calls randomize_appearance
names are generated based on the spawn's gender

* increase skin tone range
range lacked dark skin tones, apparently -200 should be the upper end

* Update code/modules/mob/living/carbon/human/appearance.dm

* newline

---------

Co-authored-by: Eugene Shih <[email protected]>
Co-authored-by: hyperioo <[email protected]>
  • Loading branch information
3 people authored Sep 15, 2023
1 parent abb8a6f commit eca0b32
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions code/game/machinery/excelsior/ex_teleporter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ var/global/excelsior_last_draft = 0
conscript.stats.setStat(STAT_ROB, 30)
conscript.stats.setStat(STAT_MEC, 10)
conscript.stats.setStat(STAT_BIO, 10)
conscript.randomize_appearance()
conscript.equip_to_appropriate_slot(new /obj/item/clothing/under/excelsior())
conscript.equip_to_appropriate_slot(new /obj/item/clothing/shoes/workboots())
conscript.equip_to_appropriate_slot(new /obj/item/device/radio/headset())
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items/devices/last_shelter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ GLOBAL_DATUM(last_shelter, /obj/item/device/last_shelter)
if(!MN)
return FALSE
var/mob/living/carbon/human/H = new /mob/living/carbon/human(src)
H.randomize_appearance()
for(var/stat in ALL_STATS)
H.stats.changeStat(stat, rand(STAT_LEVEL_ADEPT, STAT_LEVEL_PROF))
var/datum/perk/perk_random = pick(subtypesof(/datum/perk/oddity))
Expand Down
24 changes: 24 additions & 0 deletions code/modules/mob/living/carbon/human/appearance.dm
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,27 @@
for(var/obj/item/organ/external/O in organs)
O.sync_colour_to_human(src)
update_body(0)

/mob/living/carbon/human/proc/randomize_appearance()
hair_color = rgb(25 * rand(3,8),25 * rand(1,3),25 * rand(1,3)) //curated hair color
change_skin_tone(roll("1d20") * -10) //skintone randomization borrowed from corpse spawner. Increment by 10 to increase variance
change_hair(pick(GLOB.hair_styles_list)) //pick from hairstyles
change_hair_color(hair_color)
change_facial_hair_color(hair_color)
age = rand(20,50)
//set gender and gender specific traits
var/gender = pick(MALE, FEMALE)
var/list/tts_voices = new()
if(gender == FEMALE) //defaults are MALE so check for FEMALE first, use MALE as default case
change_gender(gender)
tts_voices += TTS_SEED_DEFAULT_FEMALE //Failsafe voice
else
change_facial_hair(pick(GLOB.facial_hair_styles_list)) //pick a random facial hair
tts_voices += TTS_SEED_DEFAULT_MALE //Failsafe voice
real_name = species.get_random_name(gender) //set name according to gender
//Set voice based on gender
for(var/i in tts_seeds) //from tts_seeds, add voices that match gender tag to list tts_voices
var/list/V = tts_seeds[i]
if((V["gender"] == gender || V["category"] == "any") && (V["category"] == "human" || V["gender"] == "any")) //cribbed from /code/modules/client/preference_setup/general/01_basic.dm
tts_voices += i
tts_seed = pick(tts_voices) //pick a random voice from list tts_voices
1 change: 1 addition & 0 deletions code/modules/mob/living/simple_animal/spider_core.dm
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
return

var/mob/living/carbon/human/H = new /mob/living/carbon/human(loc)
H.randomize_appearance()
visible_message(SPAN_DANGER("[src] morphs into a human body!"))
gibs(loc, null)
var/obj/item/organ/internal/carrion/core/core = locate(/obj/item/organ/internal/carrion/core) in contents
Expand Down

0 comments on commit eca0b32

Please sign in to comment.