Merge pull request #8247 from Poojawa/custom-race

Custom Species names
This commit is contained in:
kevinz000
2019-04-22 21:41:31 -07:00
committed by GitHub
6 changed files with 97 additions and 59 deletions
+12
View File
@@ -82,6 +82,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/list/custom_names = list()
var/prefered_security_department = SEC_DEPT_RANDOM
var/custom_species = null
//Quirk list
var/list/positive_quirks = list()
@@ -269,6 +270,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
dat += "<h2>Body</h2>"
dat += "<b>Gender:</b><a style='display:block;width:100px' href='?_src_=prefs;preference=gender'>[gender == MALE ? "Male" : (gender == FEMALE ? "Female" : (gender == PLURAL ? "Non-binary" : "Object"))]</a><BR>"
dat += "<b>Species:</b><a style='display:block;width:100px' href='?_src_=prefs;preference=species;task=input'>[pref_species.id]</a><BR>"
dat += "<b>Custom Species Name:</b><a style='display:block;width:100px' href='?_src_=prefs;preference=custom_species;task=input'>[custom_species ? custom_species : "None"]</a><BR>"
dat += "<a style='display:block;width:100px' href='?_src_=prefs;preference=all;task=random'>Random Body</A><BR>"
dat += "<b>Always Random Body:</b><a href='?_src_=prefs;preference=all'>[be_random_body ? "Yes" : "No"]</A><BR>"
dat += "<br><b>Cycle background:</b><a style='display:block;width:100px' href='?_src_=prefs;preference=cycle_bg;task=input'>[bgstate]</a><BR>"
@@ -1456,6 +1458,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/newtype = GLOB.species_list[result]
pref_species = new newtype()
//let's ensure that no weird shit happens on species swapping.
custom_species = null
if(!("body_markings" in pref_species.default_features))
features["body_markings"] = "None"
if(!("mam_body_markings" in pref_species.default_features))
@@ -1477,6 +1480,13 @@ GLOBAL_LIST_EMPTY(preferences_datums)
if(features["mcolor3"] == "#000" || (!(MUTCOLORS_PARTSONLY in pref_species.species_traits) && ReadHSV(temp_hsv)[3] < ReadHSV("#202020")[3]))
features["mcolor3"] = pref_species.default_color
if("custom_species")
var/new_species = reject_bad_name(input(user, "Choose your species subtype, if unique. This will show up on examinations and health scans. Do not abuse this:", "Character Preference", custom_species) as null|text)
if(new_species)
custom_species = new_species
else
custom_species = null
if("mutant_color")
var/new_mutantcolor = input(user, "Choose your character's alien/mutant color:", "Character Preference","#"+features["mcolor"]) as color|null
if(new_mutantcolor)
@@ -2115,6 +2125,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
character.real_name = nameless ? "[real_name] #[rand(10000, 99999)]" : real_name
character.name = character.real_name
character.nameless = nameless
character.custom_species = custom_species
character.gender = gender
character.age = age
@@ -2149,6 +2160,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
character.dna.features = features.Copy()
character.dna.real_name = character.real_name
character.dna.nameless = character.nameless
character.dna.custom_species = character.custom_species
if("tail_lizard" in pref_species.default_features)
character.dna.species.mutant_bodyparts |= "tail_lizard"
+3 -1
View File
@@ -236,6 +236,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
//Character
S["real_name"] >> real_name
S["nameless"] >> nameless
S["custom_species"] >> custom_species
S["name_is_always_random"] >> be_random_name
S["body_is_always_random"] >> be_random_body
S["gender"] >> gender
@@ -350,7 +351,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
gender = sanitize_gender(gender, TRUE, TRUE)
if(!real_name)
real_name = random_unique_name(gender)
custom_species = reject_bad_name(custom_species)
for(var/custom_name_id in GLOB.preferences_custom_names)
var/namedata = GLOB.preferences_custom_names[custom_name_id]
custom_names[custom_name_id] = reject_bad_name(custom_names[custom_name_id],namedata["allow_numbers"])
@@ -427,6 +428,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
//Character
WRITE_FILE(S["real_name"] , real_name)
WRITE_FILE(S["nameless"] , nameless)
WRITE_FILE(S["custom_species"] , custom_species)
WRITE_FILE(S["name_is_always_random"] , be_random_name)
WRITE_FILE(S["body_is_always_random"] , be_random_body)
WRITE_FILE(S["gender"] , gender)
@@ -18,6 +18,16 @@
var/list/obscured = check_obscured_slots()
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
if(ishuman(src)) //user just returned, y'know, the user's own species. dumb.
var/mob/living/carbon/human/H = src
var/datum/species/pref_species = H.dna.species
if(get_visible_name() == "Unknown") // same as flavor text, but hey it works.
msg += "You can't make out what species they are.\n"
else if(skipface)
msg += "You can't make out what species they are.\n"
else
msg += "[t_He] [t_is] a [H.dna.custom_species ? H.dna.custom_species : pref_species.name]!\n"
//uniform
if(w_uniform && !(SLOT_W_UNIFORM in obscured))
//accessory
@@ -47,6 +47,8 @@
var/nameless = FALSE //For drones of both the insectoid and robotic kind. And other types of nameless critters.
var/custom_species = null
var/datum/personal_crafting/handcrafting
var/datum/physiology/physiology