Selectively randomisable characters (#46108)

* Selectively randomisable characters

* it's a list now

* this doesn't work

* it's totally fucking fucked mate big time

* it works

* so sick of this goddamn pull request and yes i know this is a retarded way to do this it didn't work the other way

* anturk forestalls the inevitable suicide

'associative lists are more performant'

* final changes anturk requested

'remove all the "in randomise" and it's ready'
This commit is contained in:
cacogen
2019-09-06 18:50:12 +12:00
committed by AnturK
parent 37c5663b5b
commit 1f010e7144
35 changed files with 378 additions and 309 deletions
+120 -101
View File
@@ -49,25 +49,23 @@ GLOBAL_LIST_EMPTY(preferences_datums)
//character preferences
var/real_name //our character's name
var/be_random_name = 0 //whether we'll have a random name every round
var/be_random_body = 0 //whether we'll have a random body every round
var/be_random_species = 0 //whether we'll be a random species every round
var/gender = MALE //gender of character (well duh)
var/age = 30 //age of character
var/underwear = "Nude" //underwear type
var/underwear_color = "000" //underwear color
var/undershirt = "Nude" //undershirt type
var/socks = "Nude" //socks type
var/backbag = DBACKPACK //backpack type
var/backpack = DBACKPACK //backpack type
var/jumpsuit_style = PREF_SUIT //suit/skirt
var/hair_style = "Bald" //Hair type
var/hairstyle = "Bald" //Hair type
var/hair_color = "000" //Hair color
var/facial_hair_style = "Shaved" //Face hair type
var/facial_hairstyle = "Shaved" //Face hair type
var/facial_hair_color = "000" //Facial hair color
var/skin_tone = "caucasian1" //Skin color
var/eye_color = "000" //Eye color
var/datum/species/pref_species = new /datum/species/human() //Mutant race
var/list/features = list("mcolor" = "FFF", "ethcolor" = "9c3030", "tail_lizard" = "Smooth", "tail_human" = "None", "snout" = "Round", "horns" = "None", "ears" = "None", "wings" = "None", "frills" = "None", "spines" = "None", "body_markings" = "None", "legs" = "Normal Legs", "moth_wings" = "Plain", "moth_markings" = "None")
var/list/randomise = list(RANDOM_UNDERWEAR = TRUE, RANDOM_UNDERWEAR_COLOR = TRUE, RANDOM_UNDERSHIRT = TRUE, RANDOM_SOCKS = TRUE, RANDOM_BACKPACK = TRUE, RANDOM_JUMPSUIT_STYLE = TRUE, RANDOM_HAIRSTYLE = TRUE, RANDOM_HAIR_COLOR = TRUE, RANDOM_FACIAL_HAIRSTYLE = TRUE, RANDOM_FACIAL_HAIR_COLOR = TRUE, RANDOM_SKIN_TONE = TRUE, RANDOM_EYE_COLOR = TRUE)
var/list/genders = list(MALE, FEMALE, PLURAL)
var/list/friendlyGenders = list("Male" = "male", "Female" = "female", "Other" = "plural")
@@ -182,13 +180,10 @@ GLOBAL_LIST_EMPTY(preferences_datums)
dat += "<table width='100%'><tr><td width='75%' valign='top'>"
if(is_banned_from(user.ckey, "Appearance"))
dat += "<b>You are banned from using custom names and appearances. You can continue to adjust your characters, but you will be randomised once you join the game.</b><br>"
if (!be_random_species) // don't let random species choose their name
dat += "<a href='?_src_=prefs;preference=name;task=random'>Random Name</A> "
dat += "<a href='?_src_=prefs;preference=name'>Always Random Name: [be_random_name ? "Yes" : "No"]</a><BR>"
dat += "<b>Name:</b> "
dat += "<a href='?_src_=prefs;preference=name;task=input'>[real_name]</a><BR>"
else
dat += "<b>Name Randomized (always random species)</b><br>"
dat += "<a href='?_src_=prefs;preference=name;task=random'>Random Name</A> "
dat += "<a href='?_src_=prefs;preference=toggle_random;random_type=[RANDOM_NAME]'>Always Random Name: [(randomise[RANDOM_NAME]) ? "Yes" : "No"]</a><BR>"
dat += "<b>Name:</b> "
dat += "<a href='?_src_=prefs;preference=name;task=input'>[real_name]</a><BR>"
if(!(AGENDER in pref_species.species_traits))
var/dispGender
@@ -198,10 +193,13 @@ GLOBAL_LIST_EMPTY(preferences_datums)
dispGender = "Female"
else
dispGender = "Other"
dat += "<b>Gender:</b> <a href='?_src_=prefs;preference=gender'>[dispGender]</a><BR>"
dat += "<b>Age:</b> <a href='?_src_=prefs;preference=age;task=input'>[age]</a><BR>"
dat += "<b>Gender:</b> <a href='?_src_=prefs;preference=gender'>[dispGender]</a>"
dat += "<a href='?_src_=prefs;preference=toggle_random;random_type=[RANDOM_GENDER]'>Always Random Gender: [(randomise[RANDOM_GENDER]) ? "Yes" : "No"]</A>"
dat += "<b>Special Names:</b><BR>"
dat += "<br><b>Age:</b> <a href='?_src_=prefs;preference=age;task=input'>[age]</a>"
dat += "<a href='?_src_=prefs;preference=toggle_random;random_type=[RANDOM_AGE]'>Always Random Age: [(randomise[RANDOM_AGE]) ? "Yes" : "No"]</A>"
dat += "<br><br><b>Special Names:</b><BR>"
var/old_group
for(var/custom_name_id in GLOB.preferences_custom_names)
var/namedata = GLOB.preferences_custom_names[custom_name_id]
@@ -221,21 +219,37 @@ GLOBAL_LIST_EMPTY(preferences_datums)
dat += "<h2>Body</h2>"
dat += "<a href='?_src_=prefs;preference=all;task=random'>Random Body</A> "
dat += "<a href='?_src_=prefs;preference=all'>Always Random Body: [be_random_body ? "Yes" : "No"]</A><br>"
dat += "<a href='?_src_=prefs;preference=toggle_random;random_type=[RANDOM_BODY]'>Always Random Body: [(randomise[RANDOM_BODY]) ? "Yes" : "No"]</A><br>"
dat += "<table width='100%'><tr><td width='24%' valign='top'>"
dat += "<b>Species:</b><BR><a href='?_src_=prefs;preference=species;task=input'>[pref_species.name]</a><BR>"
dat += "<a href='?_src_=prefs;preference=rand_species;task=random_race'>Random Species</A> "
dat += "<a href='?_src_=prefs;preference=rand_species'>Always Random Species: [be_random_species ? "Yes" : "No"]</A><br>"
dat += "<a href='?_src_=prefs;preference=species;task=random'>Random Species</A> "
dat += "<a href='?_src_=prefs;preference=toggle_random;random_type=[RANDOM_SPECIES]'>Always Random Species: [(randomise[RANDOM_SPECIES]) ? "Yes" : "No"]</A><br>"
dat += "<b>Underwear:</b><BR><a href ='?_src_=prefs;preference=underwear;task=input'>[underwear]</a><BR>"
dat += "<b>Underwear Color:</b><BR><span style='border: 1px solid #161616; background-color: #[underwear_color];'>&nbsp;&nbsp;&nbsp;</span> <a href='?_src_=prefs;preference=underwear_color;task=input'>Change</a><BR>"
dat += "<b>Undershirt:</b><BR><a href ='?_src_=prefs;preference=undershirt;task=input'>[undershirt]</a><BR>"
dat += "<b>Socks:</b><BR><a href ='?_src_=prefs;preference=socks;task=input'>[socks]</a><BR>"
dat += "<b>Backpack:</b><BR><a href ='?_src_=prefs;preference=bag;task=input'>[backbag]</a><BR>"
dat += "<b>Jumpsuit:</b><BR><a href ='?_src_=prefs;preference=suit;task=input'>[jumpsuit_style]</a><BR>"
dat += "<b>Uplink Spawn Location:</b><BR><a href ='?_src_=prefs;preference=uplink_loc;task=input'>[uplink_spawn_loc]</a><BR></td>"
dat += "<b>Underwear:</b><BR><a href ='?_src_=prefs;preference=underwear;task=input'>[underwear]</a>"
dat += "<a href='?_src_=prefs;preference=toggle_random;random_type=[RANDOM_UNDERWEAR]'>[(randomise[RANDOM_UNDERWEAR]) ? "Lock" : "Unlock"]</A>"
dat += "<br><b>Underwear Color:</b><BR><span style='border: 1px solid #161616; background-color: #[underwear_color];'>&nbsp;&nbsp;&nbsp;</span> <a href='?_src_=prefs;preference=underwear_color;task=input'>Change</a>"
dat += "<a href='?_src_=prefs;preference=toggle_random;random_type=[RANDOM_UNDERWEAR_COLOR]'>[(randomise[RANDOM_UNDERWEAR_COLOR]) ? "Lock" : "Unlock"]</A>"
dat += "<BR><b>Undershirt:</b><BR><a href ='?_src_=prefs;preference=undershirt;task=input'>[undershirt]</a>"
dat += "<a href='?_src_=prefs;preference=toggle_random;random_type=[RANDOM_UNDERSHIRT]'>[(randomise[RANDOM_UNDERSHIRT]) ? "Lock" : "Unlock"]</A>"
dat += "<br><b>Socks:</b><BR><a href ='?_src_=prefs;preference=socks;task=input'>[socks]</a>"
dat += "<a href='?_src_=prefs;preference=toggle_random;random_type=[RANDOM_SOCKS]'>[(randomise[RANDOM_SOCKS]) ? "Lock" : "Unlock"]</A>"
dat += "<br><b>Backpack:</b><BR><a href ='?_src_=prefs;preference=bag;task=input'>[backpack]</a>"
dat += "<a href='?_src_=prefs;preference=toggle_random;random_type=[RANDOM_BACKPACK]'>[(randomise[RANDOM_BACKPACK]) ? "Lock" : "Unlock"]</A>"
dat += "<br><b>Jumpsuit Style:</b><BR><a href ='?_src_=prefs;preference=suit;task=input'>[jumpsuit_style]</a>"
dat += "<a href='?_src_=prefs;preference=toggle_random;random_type=[RANDOM_JUMPSUIT_STYLE]'>[(randomise[RANDOM_JUMPSUIT_STYLE]) ? "Lock" : "Unlock"]</A>"
dat += "<br><b>Uplink Spawn Location:</b><BR><a href ='?_src_=prefs;preference=uplink_loc;task=input'>[uplink_spawn_loc]</a><BR></td>"
var/use_skintones = pref_species.use_skintones
if(use_skintones)
@@ -244,7 +258,9 @@ GLOBAL_LIST_EMPTY(preferences_datums)
dat += "<h3>Skin Tone</h3>"
dat += "<a href='?_src_=prefs;preference=s_tone;task=input'>[skin_tone]</a><BR>"
dat += "<a href='?_src_=prefs;preference=s_tone;task=input'>[skin_tone]</a>"
dat += "<a href='?_src_=prefs;preference=toggle_random;random_type=[RANDOM_SKIN_TONE]'>[(randomise[RANDOM_SKIN_TONE]) ? "Lock" : "Unlock"]</A>"
dat += "<br>"
var/mutant_colors
if((MUTCOLORS in pref_species.species_traits) || (MUTCOLORS_PARTSONLY in pref_species.species_traits))
@@ -274,10 +290,10 @@ GLOBAL_LIST_EMPTY(preferences_datums)
dat += APPEARANCE_CATEGORY_COLUMN
dat += "<h3>Eye Color</h3>"
dat += "<span style='border: 1px solid #161616; background-color: #[eye_color];'>&nbsp;&nbsp;&nbsp;</span> <a href='?_src_=prefs;preference=eyes;task=input'>Change</a>"
dat += "<a href='?_src_=prefs;preference=toggle_random;random_type=[RANDOM_EYE_COLOR]'>[(randomise[RANDOM_EYE_COLOR]) ? "Lock" : "Unlock"]</A>"
dat += "<span style='border: 1px solid #161616; background-color: #[eye_color];'>&nbsp;&nbsp;&nbsp;</span> <a href='?_src_=prefs;preference=eyes;task=input'>Change</a><BR>"
dat += "</td>"
dat += "<br></td>"
else if(use_skintones || mutant_colors)
dat += "</td>"
@@ -285,19 +301,24 @@ GLOBAL_LIST_EMPTY(preferences_datums)
dat += APPEARANCE_CATEGORY_COLUMN
dat += "<h3>Hair Style</h3>"
dat += "<h3>Hairstyle</h3>"
dat += "<a href='?_src_=prefs;preference=hair_style;task=input'>[hair_style]</a><BR>"
dat += "<a href='?_src_=prefs;preference=previous_hair_style;task=input'>&lt;</a> <a href='?_src_=prefs;preference=next_hair_style;task=input'>&gt;</a><BR>"
dat += "<span style='border:1px solid #161616; background-color: #[hair_color];'>&nbsp;&nbsp;&nbsp;</span> <a href='?_src_=prefs;preference=hair;task=input'>Change</a><BR>"
dat += "<a href='?_src_=prefs;preference=hairstyle;task=input'>[hairstyle]</a>"
dat += "<a href='?_src_=prefs;preference=previous_hairstyle;task=input'>&lt;</a> <a href='?_src_=prefs;preference=next_hairstyle;task=input'>&gt;</a>"
dat += "<a href='?_src_=prefs;preference=toggle_random;random_type=[RANDOM_HAIRSTYLE]'>[(randomise[RANDOM_HAIRSTYLE]) ? "Lock" : "Unlock"]</A>"
dat += "<h3>Facial Hair Style</h3>"
dat += "<br><span style='border:1px solid #161616; background-color: #[hair_color];'>&nbsp;&nbsp;&nbsp;</span> <a href='?_src_=prefs;preference=hair;task=input'>Change</a>"
dat += "<a href='?_src_=prefs;preference=toggle_random;random_type=[RANDOM_HAIR_COLOR]'>[(randomise[RANDOM_HAIR_COLOR]) ? "Lock" : "Unlock"]</A>"
dat += "<a href='?_src_=prefs;preference=facial_hair_style;task=input'>[facial_hair_style]</a><BR>"
dat += "<a href='?_src_=prefs;preference=previous_facehair_style;task=input'>&lt;</a> <a href='?_src_=prefs;preference=next_facehair_style;task=input'>&gt;</a><BR>"
dat += "<span style='border: 1px solid #161616; background-color: #[facial_hair_color];'>&nbsp;&nbsp;&nbsp;</span> <a href='?_src_=prefs;preference=facial;task=input'>Change</a><BR>"
dat += "<BR><h3>Facial Hairstyle</h3>"
dat += "</td>"
dat += "<a href='?_src_=prefs;preference=facial_hairstyle;task=input'>[facial_hairstyle]</a>"
dat += "<a href='?_src_=prefs;preference=previous_facehairstyle;task=input'>&lt;</a> <a href='?_src_=prefs;preference=next_facehairstyle;task=input'>&gt;</a>"
dat += "<a href='?_src_=prefs;preference=toggle_random;random_type=[RANDOM_FACIAL_HAIRSTYLE]'>[(randomise[RANDOM_FACIAL_HAIRSTYLE]) ? "Lock" : "Unlock"]</A>"
dat += "<br><span style='border: 1px solid #161616; background-color: #[facial_hair_color];'>&nbsp;&nbsp;&nbsp;</span> <a href='?_src_=prefs;preference=facial;task=input'>Change</a>"
dat += "<a href='?_src_=prefs;preference=toggle_random;random_type=[RANDOM_FACIAL_HAIR_COLOR]'>[(randomise[RANDOM_FACIAL_HAIR_COLOR]) ? "Lock" : "Unlock"]</A>"
dat += "<br></td>"
//Mutant stuff
var/mutant_category = 0
@@ -1006,9 +1027,6 @@ GLOBAL_LIST_EMPTY(preferences_datums)
return TRUE
switch(href_list["task"])
if ("random_race")
random_species()
if("random")
switch(href_list["preference"])
if("name")
@@ -1017,12 +1035,12 @@ GLOBAL_LIST_EMPTY(preferences_datums)
age = rand(AGE_MIN, AGE_MAX)
if("hair")
hair_color = random_short_color()
if("hair_style")
hair_style = random_hair_style(gender)
if("hairstyle")
hairstyle = random_hairstyle(gender)
if("facial")
facial_hair_color = random_short_color()
if("facial_hair_style")
facial_hair_style = random_facial_hair_style(gender)
if("facial_hairstyle")
facial_hairstyle = random_facial_hairstyle(gender)
if("underwear")
underwear = random_underwear(gender)
if("underwear_color")
@@ -1035,12 +1053,14 @@ GLOBAL_LIST_EMPTY(preferences_datums)
eye_color = random_eye_color()
if("s_tone")
skin_tone = random_skin_tone()
if("species")
random_species()
if("bag")
backbag = pick(GLOB.backbaglist)
backpack = pick(GLOB.backpacklist)
if("suit")
jumpsuit_style = pick(GLOB.jumpsuitlist)
if("all")
random_character()
random_character(gender)
if("input")
@@ -1099,64 +1119,64 @@ GLOBAL_LIST_EMPTY(preferences_datums)
if(new_hair)
hair_color = sanitize_hexcolor(new_hair)
if("hair_style")
var/new_hair_style
if("hairstyle")
var/new_hairstyle
if(gender == MALE)
new_hair_style = input(user, "Choose your character's hair style:", "Character Preference") as null|anything in GLOB.hair_styles_male_list
new_hairstyle = input(user, "Choose your character's hairstyle:", "Character Preference") as null|anything in GLOB.hairstyles_male_list
else if(gender == FEMALE)
new_hair_style = input(user, "Choose your character's hair style:", "Character Preference") as null|anything in GLOB.hair_styles_female_list
new_hairstyle = input(user, "Choose your character's hairstyle:", "Character Preference") as null|anything in GLOB.hairstyles_female_list
else
new_hair_style = input(user, "Choose your character's hair style:", "Character Preference") as null|anything in GLOB.hair_styles_list
if(new_hair_style)
hair_style = new_hair_style
new_hairstyle = input(user, "Choose your character's hairstyle:", "Character Preference") as null|anything in GLOB.hairstyles_list
if(new_hairstyle)
hairstyle = new_hairstyle
if("next_hair_style")
if("next_hairstyle")
if (gender == MALE)
hair_style = next_list_item(hair_style, GLOB.hair_styles_male_list)
hairstyle = next_list_item(hairstyle, GLOB.hairstyles_male_list)
else if(gender == FEMALE)
hair_style = next_list_item(hair_style, GLOB.hair_styles_female_list)
hairstyle = next_list_item(hairstyle, GLOB.hairstyles_female_list)
else
hair_style = next_list_item(hair_style, GLOB.hair_styles_list)
hairstyle = next_list_item(hairstyle, GLOB.hairstyles_list)
if("previous_hair_style")
if("previous_hairstyle")
if (gender == MALE)
hair_style = previous_list_item(hair_style, GLOB.hair_styles_male_list)
hairstyle = previous_list_item(hairstyle, GLOB.hairstyles_male_list)
else if(gender == FEMALE)
hair_style = previous_list_item(hair_style, GLOB.hair_styles_female_list)
hairstyle = previous_list_item(hairstyle, GLOB.hairstyles_female_list)
else
hair_style = previous_list_item(hair_style, GLOB.hair_styles_list)
hairstyle = previous_list_item(hairstyle, GLOB.hairstyles_list)
if("facial")
var/new_facial = input(user, "Choose your character's facial-hair colour:", "Character Preference","#"+facial_hair_color) as color|null
if(new_facial)
facial_hair_color = sanitize_hexcolor(new_facial)
if("facial_hair_style")
var/new_facial_hair_style
if("facial_hairstyle")
var/new_facial_hairstyle
if(gender == MALE)
new_facial_hair_style = input(user, "Choose your character's facial-hair style:", "Character Preference") as null|anything in GLOB.facial_hair_styles_male_list
new_facial_hairstyle = input(user, "Choose your character's facial-hairstyle:", "Character Preference") as null|anything in GLOB.facial_hairstyles_male_list
else if(gender == FEMALE)
new_facial_hair_style = input(user, "Choose your character's facial-hair style:", "Character Preference") as null|anything in GLOB.facial_hair_styles_female_list
new_facial_hairstyle = input(user, "Choose your character's facial-hairstyle:", "Character Preference") as null|anything in GLOB.facial_hairstyles_female_list
else
new_facial_hair_style = input(user, "Choose your character's facial-hair style:", "Character Preference") as null|anything in GLOB.facial_hair_styles_list
if(new_facial_hair_style)
facial_hair_style = new_facial_hair_style
new_facial_hairstyle = input(user, "Choose your character's facial-hairstyle:", "Character Preference") as null|anything in GLOB.facial_hairstyles_list
if(new_facial_hairstyle)
facial_hairstyle = new_facial_hairstyle
if("next_facehair_style")
if("next_facehairstyle")
if (gender == MALE)
facial_hair_style = next_list_item(facial_hair_style, GLOB.facial_hair_styles_male_list)
facial_hairstyle = next_list_item(facial_hairstyle, GLOB.facial_hairstyles_male_list)
else if(gender == FEMALE)
facial_hair_style = next_list_item(facial_hair_style, GLOB.facial_hair_styles_female_list)
facial_hairstyle = next_list_item(facial_hairstyle, GLOB.facial_hairstyles_female_list)
else
facial_hair_style = next_list_item(facial_hair_style, GLOB.facial_hair_styles_list)
facial_hairstyle = next_list_item(facial_hairstyle, GLOB.facial_hairstyles_list)
if("previous_facehair_style")
if("previous_facehairstyle")
if (gender == MALE)
facial_hair_style = previous_list_item(facial_hair_style, GLOB.facial_hair_styles_male_list)
facial_hairstyle = previous_list_item(facial_hairstyle, GLOB.facial_hairstyles_male_list)
else if (gender == FEMALE)
facial_hair_style = previous_list_item(facial_hair_style, GLOB.facial_hair_styles_female_list)
facial_hairstyle = previous_list_item(facial_hairstyle, GLOB.facial_hairstyles_female_list)
else
facial_hair_style = previous_list_item(facial_hair_style, GLOB.facial_hair_styles_list)
facial_hairstyle = previous_list_item(facial_hairstyle, GLOB.facial_hairstyles_list)
if("underwear")
var/new_underwear
@@ -1207,6 +1227,8 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/temp_hsv = RGBtoHSV(features["mcolor"])
if(features["mcolor"] == "#000" || (!(MUTCOLORS_PARTSONLY in pref_species.species_traits) && ReadHSV(temp_hsv)[3] < ReadHSV("#7F7F7F")[3]))
features["mcolor"] = pref_species.default_color
if(randomise[RANDOM_NAME])
real_name = pref_species.random_name(gender)
if("mutant_color")
var/new_mutantcolor = input(user, "Choose your character's alien/mutant color:", "Character Preference","#"+features["mcolor"]) as color|null
@@ -1313,9 +1335,9 @@ GLOBAL_LIST_EMPTY(preferences_datums)
asaycolor = new_asaycolor
if("bag")
var/new_backbag = input(user, "Choose your character's style of bag:", "Character Preference") as null|anything in GLOB.backbaglist
if(new_backbag)
backbag = new_backbag
var/new_backpack = input(user, "Choose your character's style of bag:", "Character Preference") as null|anything in GLOB.backpacklist
if(new_backpack)
backpack = new_backpack
if("suit")
if(jumpsuit_style == PREF_SUIT)
@@ -1388,8 +1410,8 @@ GLOBAL_LIST_EMPTY(preferences_datums)
underwear = random_underwear(gender)
undershirt = random_undershirt(gender)
socks = random_socks()
facial_hair_style = random_facial_hair_style(gender)
hair_style = random_hair_style(gender)
facial_hairstyle = random_facial_hairstyle(gender)
hairstyle = random_hairstyle(gender)
if("hotkeys")
hotkeys = !hotkeys
@@ -1440,14 +1462,12 @@ GLOBAL_LIST_EMPTY(preferences_datums)
else
be_special += be_special_type
if("rand_species")
be_random_species = !be_random_species
if("name")
be_random_name = !be_random_name
if("all")
be_random_body = !be_random_body
if("toggle_random")
var/random_type = href_list["random_type"]
if(randomise[random_type])
randomise -= random_type
else
randomise[random_type] = TRUE
if("hear_midis")
toggles ^= SOUND_MIDI
@@ -1529,18 +1549,17 @@ GLOBAL_LIST_EMPTY(preferences_datums)
ShowChoices(user)
return 1
/datum/preferences/proc/copy_to(mob/living/carbon/human/character, icon_updates = 1, roundstart_checks = TRUE)
/datum/preferences/proc/copy_to(mob/living/carbon/human/character, icon_updates = 1, roundstart_checks = TRUE, character_setup = FALSE)
if(be_random_species)
be_random_name = 1
if(randomise[RANDOM_SPECIES] && !character_setup)
random_species()
if(be_random_name)
real_name = pref_species.random_name(gender)
if(be_random_body)
if(randomise[RANDOM_BODY] && !character_setup)
random_character(gender)
if(randomise[RANDOM_NAME] && !character_setup)
real_name = pref_species.random_name(gender)
if(roundstart_checks)
if(CONFIG_GET(flag/humans_need_surnames) && (pref_species.id == "human"))
var/firstspace = findtext(real_name, " ")
@@ -1566,14 +1585,14 @@ GLOBAL_LIST_EMPTY(preferences_datums)
character.facial_hair_color = facial_hair_color
character.skin_tone = skin_tone
character.hair_style = hair_style
character.facial_hair_style = facial_hair_style
character.hairstyle = hairstyle
character.facial_hairstyle = facial_hairstyle
character.underwear = underwear
character.underwear_color = underwear_color
character.undershirt = undershirt
character.socks = socks
character.backbag = backbag
character.backpack = backpack
character.jumpsuit_style = jumpsuit_style
+37 -30
View File
@@ -5,7 +5,7 @@
// You do not need to raise this if you are adding new values that have sane defaults.
// Only raise this value when changing the meaning/format/name/layout of an existing value
// where you would want the updater procs below to run
#define SAVEFILE_VERSION_MAX 24
#define SAVEFILE_VERSION_MAX 25
/*
SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Carn
@@ -112,6 +112,20 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
if(current_version < 24)
if (!(underwear in GLOB.underwear_list))
underwear = "Nude"
if(current_version < 25)
randomise = list(RANDOM_UNDERWEAR = TRUE, RANDOM_UNDERWEAR_COLOR = TRUE, RANDOM_UNDERSHIRT = TRUE, RANDOM_SOCKS = TRUE, RANDOM_BACKPACK = TRUE, RANDOM_JUMPSUIT_STYLE = TRUE, RANDOM_HAIRSTYLE = TRUE, RANDOM_HAIR_COLOR = TRUE, RANDOM_FACIAL_HAIRSTYLE = TRUE, RANDOM_FACIAL_HAIR_COLOR = TRUE, RANDOM_SKIN_TONE = TRUE, RANDOM_EYE_COLOR = TRUE)
if(S["name_is_always_random"] == 1)
randomise[RANDOM_NAME] = TRUE
if(S["body_is_always_random"] == 1)
randomise[RANDOM_BODY] = TRUE
if(S["species_is_always_random"] == 1)
randomise[RANDOM_SPECIES] = TRUE
if(S["backbag"])
S["backbag"] >> backpack
if(S["hair_style_name"])
S["hair_style_name"] >> hairstyle
if(S["facial_style_name"])
S["facial_style_name"] >> facial_hairstyle
/datum/preferences/proc/load_path(ckey,filename="preferences.sav")
if(!ckey)
@@ -284,24 +298,22 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
//Character
S["real_name"] >> real_name
S["name_is_always_random"] >> be_random_name
S["body_is_always_random"] >> be_random_body
S["species_is_always_random"] >> be_random_species
S["gender"] >> gender
S["age"] >> age
S["hair_color"] >> hair_color
S["facial_hair_color"] >> facial_hair_color
S["eye_color"] >> eye_color
S["skin_tone"] >> skin_tone
S["hair_style_name"] >> hair_style
S["facial_style_name"] >> facial_hair_style
S["hairstyle_name"] >> hairstyle
S["facial_style_name"] >> facial_hairstyle
S["underwear"] >> underwear
S["underwear_color"] >> underwear_color
S["undershirt"] >> undershirt
S["socks"] >> socks
S["backbag"] >> backbag
S["backpack"] >> backpack
S["jumpsuit_style"] >> jumpsuit_style
S["uplink_loc"] >> uplink_spawn_loc
S["randomise"] >> randomise
S["feature_mcolor"] >> features["mcolor"]
S["feature_ethcolor"] >> features["ethcolor"]
S["feature_lizard_tail"] >> features["tail_lizard"]
@@ -359,27 +371,24 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
if(!features["ethcolor"] || features["ethcolor"] == "#000")
features["ethcolor"] = GLOB.color_list_ethereal[pick(GLOB.color_list_ethereal)]
be_random_name = sanitize_integer(be_random_name, 0, 1, initial(be_random_name))
be_random_body = sanitize_integer(be_random_body, 0, 1, initial(be_random_body))
be_random_species = sanitize_integer(be_random_species, 0, 1, initial(be_random_species))
randomise = SANITIZE_LIST(randomise)
if(gender == MALE)
hair_style = sanitize_inlist(hair_style, GLOB.hair_styles_male_list)
facial_hair_style = sanitize_inlist(facial_hair_style, GLOB.facial_hair_styles_male_list)
hairstyle = sanitize_inlist(hairstyle, GLOB.hairstyles_male_list)
facial_hairstyle = sanitize_inlist(facial_hairstyle, GLOB.facial_hairstyles_male_list)
underwear = sanitize_inlist(underwear, GLOB.underwear_m)
undershirt = sanitize_inlist(undershirt, GLOB.undershirt_m)
else if(gender == FEMALE)
hair_style = sanitize_inlist(hair_style, GLOB.hair_styles_female_list)
facial_hair_style = sanitize_inlist(facial_hair_style, GLOB.facial_hair_styles_female_list)
hairstyle = sanitize_inlist(hairstyle, GLOB.hairstyles_female_list)
facial_hairstyle = sanitize_inlist(facial_hairstyle, GLOB.facial_hairstyles_female_list)
underwear = sanitize_inlist(underwear, GLOB.underwear_f)
undershirt = sanitize_inlist(undershirt, GLOB.undershirt_f)
else
hair_style = sanitize_inlist(hair_style, GLOB.hair_styles_list)
facial_hair_style = sanitize_inlist(facial_hair_style, GLOB.facial_hair_styles_list)
hairstyle = sanitize_inlist(hairstyle, GLOB.hairstyles_list)
facial_hairstyle = sanitize_inlist(facial_hairstyle, GLOB.facial_hairstyles_list)
underwear = sanitize_inlist(underwear, GLOB.underwear_list)
undershirt = sanitize_inlist(undershirt, GLOB.undershirt_list)
socks = sanitize_inlist(socks, GLOB.socks_list)
age = sanitize_integer(age, AGE_MIN, AGE_MAX, initial(age))
hair_color = sanitize_hexcolor(hair_color, 3, 0)
@@ -387,7 +396,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
underwear_color = sanitize_hexcolor(underwear_color, 3, 0)
eye_color = sanitize_hexcolor(eye_color, 3, 0)
skin_tone = sanitize_inlist(skin_tone, GLOB.skin_tones)
backbag = sanitize_inlist(backbag, GLOB.backbaglist, initial(backbag))
backpack = sanitize_inlist(backpack, GLOB.backpacklist, initial(backpack))
jumpsuit_style = sanitize_inlist(jumpsuit_style, GLOB.jumpsuitlist, initial(jumpsuit_style))
uplink_spawn_loc = sanitize_inlist(uplink_spawn_loc, GLOB.uplink_spawn_loc_list, initial(uplink_spawn_loc))
features["mcolor"] = sanitize_hexcolor(features["mcolor"], 3, 0)
@@ -426,24 +435,22 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
//Character
WRITE_FILE(S["real_name"] , real_name)
WRITE_FILE(S["name_is_always_random"] , be_random_name)
WRITE_FILE(S["body_is_always_random"] , be_random_body)
WRITE_FILE(S["species_is_always_random"] , be_random_species)
WRITE_FILE(S["gender"] , gender)
WRITE_FILE(S["age"] , age)
WRITE_FILE(S["gender"] , gender)
WRITE_FILE(S["age"] , age)
WRITE_FILE(S["hair_color"] , hair_color)
WRITE_FILE(S["facial_hair_color"] , facial_hair_color)
WRITE_FILE(S["facial_hair_color"] , facial_hair_color)
WRITE_FILE(S["eye_color"] , eye_color)
WRITE_FILE(S["skin_tone"] , skin_tone)
WRITE_FILE(S["hair_style_name"] , hair_style)
WRITE_FILE(S["facial_style_name"] , facial_hair_style)
WRITE_FILE(S["hairstyle_name"] , hairstyle)
WRITE_FILE(S["facial_style_name"] , facial_hairstyle)
WRITE_FILE(S["underwear"] , underwear)
WRITE_FILE(S["underwear_color"] , underwear_color)
WRITE_FILE(S["underwear_color"] , underwear_color)
WRITE_FILE(S["undershirt"] , undershirt)
WRITE_FILE(S["socks"] , socks)
WRITE_FILE(S["backbag"] , backbag)
WRITE_FILE(S["jumpsuit_style"] , jumpsuit_style)
WRITE_FILE(S["socks"] , socks)
WRITE_FILE(S["backpack"] , backpack)
WRITE_FILE(S["jumpsuit_style"] , jumpsuit_style)
WRITE_FILE(S["uplink_loc"] , uplink_spawn_loc)
WRITE_FILE(S["randomise"] , randomise)
WRITE_FILE(S["species"] , pref_species.id)
WRITE_FILE(S["feature_mcolor"] , features["mcolor"])
WRITE_FILE(S["feature_ethcolor"] , features["ethcolor"])