Generalizes lizard parts to "features" for future non-lizard fields, at the same time merging mutant color into this list

Random lizard bodies will finally have color!

Pushes features almost all the way to the DNA side of thing, the mob side is only needed during character creation.

Note that changes to the save file will invoke a one time per character runtime for legacy characters as the save file purges mutant_color, this is as far as I can tell harmless, has no effect on the player, and is self correcting.
This commit is contained in:
Incoming
2015-06-12 00:43:35 -04:00
parent bff351c555
commit 595bb0c8e4
21 changed files with 91 additions and 111 deletions
+21 -23
View File
@@ -61,8 +61,7 @@ var/global/list/special_roles = list( //keep synced with the defines BE_* in set
var/skin_tone = "caucasian1" //Skin color
var/eye_color = "000" //Eye color
var/datum/species/pref_species = new /datum/species/human() //Mutant race
var/mutant_color = "FFF" //Mutant race skin color
var/list/lizard_parts = list("tail" = "Smooth", "snout" = "Round", "horns" = "None", "frills" = "None", "spines" = "None", "body_markings" = "None")
var/list/features = list("mcolor" = "FFF", "tail" = "Smooth", "snout" = "Round", "horns" = "None", "frills" = "None", "spines" = "None", "body_markings" = "None")
var/list/custom_names = list("clown", "mime", "ai", "cyborg", "religion", "deity")
@@ -245,7 +244,7 @@ var/global/list/special_roles = list( //keep synced with the defines BE_* in set
dat += "<h3>Alien Color</h3>"
dat += "<span style='border: 1px solid #161616; background-color: #[mutant_color];'>&nbsp;&nbsp;&nbsp;</span> <a href='?_src_=prefs;preference=mutant_color;task=input'>Change</a><BR>"
dat += "<span style='border: 1px solid #161616; background-color: #[features["mcolor"]];'>&nbsp;&nbsp;&nbsp;</span> <a href='?_src_=prefs;preference=mutant_color;task=input'>Change</a><BR>"
dat += "</td>"
@@ -254,7 +253,7 @@ var/global/list/special_roles = list( //keep synced with the defines BE_* in set
dat += "<h3>Tail</h3>"
dat += "<a href='?_src_=prefs;preference=tail;task=input'>[lizard_parts["tail"]]</a><BR>"
dat += "<a href='?_src_=prefs;preference=tail;task=input'>[features["tail"]]</a><BR>"
dat += "</td>"
@@ -263,7 +262,7 @@ var/global/list/special_roles = list( //keep synced with the defines BE_* in set
dat += "<h3>Snout</h3>"
dat += "<a href='?_src_=prefs;preference=snout;task=input'>[lizard_parts["snout"]]</a><BR>"
dat += "<a href='?_src_=prefs;preference=snout;task=input'>[features["snout"]]</a><BR>"
dat += "</td>"
@@ -272,7 +271,7 @@ var/global/list/special_roles = list( //keep synced with the defines BE_* in set
dat += "<h3>Horns</h3>"
dat += "<a href='?_src_=prefs;preference=horns;task=input'>[lizard_parts["horns"]]</a><BR>"
dat += "<a href='?_src_=prefs;preference=horns;task=input'>[features["horns"]]</a><BR>"
dat += "</td>"
@@ -281,7 +280,7 @@ var/global/list/special_roles = list( //keep synced with the defines BE_* in set
dat += "<h3>Frills</h3>"
dat += "<a href='?_src_=prefs;preference=frills;task=input'>[lizard_parts["frills"]]</a><BR>"
dat += "<a href='?_src_=prefs;preference=frills;task=input'>[features["frills"]]</a><BR>"
dat += "</td>"
@@ -290,7 +289,7 @@ var/global/list/special_roles = list( //keep synced with the defines BE_* in set
dat += "<h3>Spines</h3>"
dat += "<a href='?_src_=prefs;preference=spines;task=input'>[lizard_parts["spines"]]</a><BR>"
dat += "<a href='?_src_=prefs;preference=spines;task=input'>[features["spines"]]</a><BR>"
dat += "</td>"
@@ -299,7 +298,7 @@ var/global/list/special_roles = list( //keep synced with the defines BE_* in set
dat += "<h3>Body Markings</h3>"
dat += "<a href='?_src_=prefs;preference=body_markings;task=input'>[lizard_parts["body_markings"]]</a><BR>"
dat += "<a href='?_src_=prefs;preference=body_markings;task=input'>[features["body_markings"]]</a><BR>"
dat += "</td>"
@@ -792,54 +791,54 @@ var/global/list/special_roles = list( //keep synced with the defines BE_* in set
if(result)
var/newtype = roundstart_species[result]
pref_species = new newtype()
if(mutant_color == "#000")
mutant_color = pref_species.default_color
if(features["mcolor"] == "#000")
features["mcolor"] = pref_species.default_color
if("mutant_color")
var/new_mutantcolor = input(user, "Choose your character's alien skin color:", "Character Preference") as color|null
if(new_mutantcolor)
var/temp_hsv = RGBtoHSV(new_mutantcolor)
if(new_mutantcolor == "#000000")
mutant_color = pref_species.default_color
features["mcolor"] = pref_species.default_color
else if(ReadHSV(temp_hsv)[3] >= ReadHSV("#7F7F7F")[3]) // mutantcolors must be bright
mutant_color = sanitize_hexcolor(new_mutantcolor)
features["mcolor"] = sanitize_hexcolor(new_mutantcolor)
else
user << "<span class='danger'>Invalid color. Your color is not bright enough.</span>"
if("tail")
var/new_tail
new_tail = input(user, "Choose your character's tail:", "Character Preference") as null|anything in tails_list
if(new_tail)
lizard_parts["tail"] = new_tail
features["tail"] = new_tail
if("snout")
var/new_snout
new_snout = input(user, "Choose your character's snout:", "Character Preference") as null|anything in snouts_list
if(new_snout)
lizard_parts["snout"] = new_snout
features["snout"] = new_snout
if("horns")
var/new_horns
new_horns = input(user, "Choose your character's horns:", "Character Preference") as null|anything in horns_list
if(new_horns)
lizard_parts["horns"] = new_horns
features["horns"] = new_horns
if("frills")
var/new_frills
new_frills = input(user, "Choose your character's frills:", "Character Preference") as null|anything in frills_list
if(new_frills)
lizard_parts["frills"] = new_frills
features["frills"] = new_frills
if("spines")
var/new_spines
new_spines = input(user, "Choose your character's spines:", "Character Preference") as null|anything in spines_list
if(new_spines)
lizard_parts["spines"] = new_spines
features["spines"] = new_spines
if("body_markings")
var/new_body_markings
new_body_markings = input(user, "Choose your character's body markings:", "Character Preference") as null|anything in body_markings_list
if(new_body_markings)
lizard_parts["body_markings"] = new_body_markings
features["body_markings"] = new_body_markings
if("s_tone")
var/new_s_tone = input(user, "Choose your character's skin-tone:", "Character Preference") as null|anything in skin_tones
@@ -1010,10 +1009,9 @@ var/global/list/special_roles = list( //keep synced with the defines BE_* in set
if(character.dna)
character.dna.real_name = character.real_name
if(pref_species != /datum/species/human && config.mutant_races)
hardset_dna(character, null, null, null, null, pref_species.type)
hardset_dna(character, null, null, null, null, pref_species.type, features)
else
hardset_dna(character, null, null, null, null, /datum/species/human)
character.dna.mutant_color = mutant_color
hardset_dna(character, null, null, null, null, /datum/species/human, features)
character.update_mutcolor()
character.gender = gender
@@ -1031,7 +1029,7 @@ var/global/list/special_roles = list( //keep synced with the defines BE_* in set
character.undershirt = undershirt
character.socks = socks
character.lizard_parts = lizard_parts
character.features = features
if(backbag > 3 || backbag < 1)
backbag = 1 //Same as above
+13 -15
View File
@@ -166,8 +166,8 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
else
pref_species = new /datum/species/human()
if(!S["mutant_color"] || S["mutant_color"] == "#000")
S["mutant_color"] << "#FFF"
if(!S["features["mcolor"]"] || S["features["mcolor"]"] == "#000")
S["features["mcolor"]"] << "#FFF"
//Character
S["OOC_Notes"] >> metadata
@@ -186,8 +186,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
S["undershirt"] >> undershirt
S["socks"] >> socks
S["backbag"] >> backbag
S["mutant_color"] >> mutant_color
S["lizard_parts"] >> lizard_parts
S["features"] >> features
S["clown_name"] >> custom_names["clown"]
S["mime_name"] >> custom_names["mime"]
S["ai_name"] >> custom_names["ai"]
@@ -214,8 +213,8 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
//Sanitize
metadata = sanitize_text(metadata, initial(metadata))
real_name = reject_bad_name(real_name)
if(!mutant_color || mutant_color == "#000")
mutant_color = "#FFF"
if(!features["mcolor"] || features["mcolor"] == "#000")
features["mcolor"] = "#FFF"
if(!real_name) real_name = random_name(gender)
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))
@@ -239,13 +238,13 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
eye_color = sanitize_hexcolor(eye_color, 3, 0)
skin_tone = sanitize_inlist(skin_tone, skin_tones)
backbag = sanitize_integer(backbag, 1, backbaglist.len, initial(backbag))
mutant_color = sanitize_hexcolor(mutant_color, 3, 0)
lizard_parts["tail"] = sanitize_inlist(lizard_parts["tail"], tails_list)
lizard_parts["snout"] = sanitize_inlist(lizard_parts["snout"], snouts_list)
lizard_parts["horns"] = sanitize_inlist(lizard_parts["horns"], horns_list)
lizard_parts["frills"] = sanitize_inlist(lizard_parts["frills"], frills_list)
lizard_parts["spines"] = sanitize_inlist(lizard_parts["spines"], spines_list)
lizard_parts["body_markings"] = sanitize_inlist(lizard_parts["body_markings"], body_markings_list)
features["mcolor"] = sanitize_hexcolor(features["mcolor"], 3, 0)
features["tail"] = sanitize_inlist(features["tail"], tails_list)
features["snout"] = sanitize_inlist(features["snout"], snouts_list)
features["horns"] = sanitize_inlist(features["horns"], horns_list)
features["frills"] = sanitize_inlist(features["frills"], frills_list)
features["spines"] = sanitize_inlist(features["spines"], spines_list)
features["body_markings"] = sanitize_inlist(features["body_markings"], body_markings_list)
userandomjob = sanitize_integer(userandomjob, 0, 1, initial(userandomjob))
job_civilian_high = sanitize_integer(job_civilian_high, 0, 65535, initial(job_civilian_high))
@@ -286,8 +285,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
S["socks"] << socks
S["backbag"] << backbag
S["species"] << pref_species.name
S["mutant_color"] << mutant_color
S["lizard_parts"] << lizard_parts
S["features"] << features
S["clown_name"] << custom_names["clown"]
S["mime_name"] << custom_names["mime"]
S["ai_name"] << custom_names["ai"]