Large patch to Slime/IPC PR - Character Creator + General Imitation Fixes (#28348)

* add: slimify icon proc, clamps L in HSL.
fix: skin tones, corrupted character slots, species subtype accessories, and spawning without the proper DNA set.
character creator fixes.
reduces the eye strain from super bright slime people :pain:

* fix
This commit is contained in:
Spaghetti-bit
2025-02-11 17:08:39 -07:00
committed by GitHub
parent 2793a1c7f4
commit 3fe1cd3521
8 changed files with 87 additions and 61 deletions
+19 -5
View File
@@ -833,6 +833,7 @@
var/icon/icobase
var/datum/species/current_species = GLOB.all_species[species]
var/will_slimify = FALSE
//Icon-based species colour.
var/coloured_tail
@@ -844,12 +845,17 @@
if(subtype_species) // Take certain attributes from our subtype to apply to our current species.
H.dna.species.updatespeciessubtype(H, subtype_species)
current_species = H.dna.species
icobase = current_species.icobase
else if(current_species.bodyflags & HAS_ICON_SKIN_TONE) //Handling species-specific icon-based skin tones by flagged race.
H.s_tone = s_tone
H.dna.species.updatespeciescolor(H, 0) //The mob's species wasn't set, so it's almost certainly different than the character's species at the moment. Thus, we need to be owner-insensitive.
var/obj/item/organ/external/chest/C = H.get_organ("chest")
icobase = C.icobase ? C.icobase : C.dna.species.icobase
if(H.dna.species.bodyflags & HAS_TAIL)
coloured_tail = H.tail ? H.tail : H.dna.species.tail
icobase = current_species.icobase
else
icobase = current_species.icobase
will_slimify = (istype(current_species, /datum/species/slime) && current_species.species_subtype != "None")
qdel(H)
else
icobase = 'icons/mob/human_races/r_human.dmi'
@@ -882,9 +888,8 @@
bodypart.Blend(new /icon(R.icon, "[name]"), ICON_OVERLAY)
preview_icon.Blend(bodypart, ICON_OVERLAY)
continue
if(istype(current_species, /datum/species/slime) && current_species.species_subtype != "None") // Applies to limbs that are not robotic.
bodypart.GrayScale()
bodypart.Blend("[s_colour]DC", ICON_AND) //DC = 220 alpha.
if(will_slimify) // Applies to limbs that are not robotic.
bodypart.slimify(s_colour, "A0")
else
// Skin color
if(current_species && (current_species.bodyflags & HAS_SKIN_COLOR))
@@ -936,6 +941,10 @@
t_marking_s.Blend(m_colours["tail"], ICON_ADD)
temp.Blend(t_marking_s, ICON_OVERLAY)
if(will_slimify)
temp.slimify(s_colour, "A0")
if(underlay)
underlay.slimify(s_colour, "A0")
// Body accessory has an underlay, add it too.
if(underlay)
ICON_SHIFT_XY(underlay, offset_x, offset_y)
@@ -952,6 +961,8 @@
if(body_marking_style && body_marking_style.species_allowed)
var/icon/b_marking_s = new/icon("icon" = body_marking_style.icon, "icon_state" = "[body_marking_style.icon_state]_s")
b_marking_s.Blend(m_colours["body"], ICON_ADD)
if(will_slimify)
b_marking_s.slimify(s_colour, "A0")
preview_icon.Blend(b_marking_s, ICON_OVERLAY)
if(current_species.bodyflags & HAS_HEAD_MARKINGS) //Head markings.
var/head_marking = m_styles["head"]
@@ -959,6 +970,8 @@
if(head_marking_style && head_marking_style.species_allowed)
var/icon/h_marking_s = new/icon("icon" = head_marking_style.icon, "icon_state" = "[head_marking_style.icon_state]_s")
h_marking_s.Blend(m_colours["head"], ICON_ADD)
if(will_slimify)
h_marking_s.slimify(s_colour, "A0")
preview_icon.Blend(h_marking_s, ICON_OVERLAY)
var/icon/hands_icon = icon(preview_icon)
@@ -1005,6 +1018,8 @@
if(head_accessory_style && head_accessory_style.species_allowed)
var/icon/head_accessory_s = new/icon("icon" = head_accessory_style.icon, "icon_state" = "[head_accessory_style.icon_state]_s")
head_accessory_s.Blend(hacc_colour, ICON_ADD)
if(will_slimify)
head_accessory_s.slimify(s_colour, "A0")
face_s.Blend(head_accessory_s, ICON_OVERLAY)
var/datum/sprite_accessory/facial_hair_style = GLOB.facial_hair_styles_list[f_style]
@@ -1857,7 +1872,6 @@
character.species_subtype = "None"
if(be_random_name)
real_name = random_name(gender, species)
character.add_language(language)
@@ -8,7 +8,8 @@
subtype = S
else
S = new S.type()
S.bodyflags |= subtype.bodyflags
S.bodyflags |= subtype.bodyflags // Used for finding valid styles.
S.species_subtype = subtype.name // Used for finding valid styles.
if(href_list["preference"] == "job")
switch(href_list["task"])
if("close")
@@ -203,13 +204,15 @@
to_chat(user, "<span class='warning'>Invalid species, please pick something else.</span>")
return
if(prev_species != active_character.species)
if(isnull(NS))
NS = GLOB.all_species[active_character.species]
S = new NS.type()
active_character.species_subtype = "None"
active_character.age = clamp(active_character.age, S.min_age, S.max_age)
NS = GLOB.all_species[active_character.species_subtype] // Changing species resets subtype.
if(isnull(NS))
NS = GLOB.all_species[active_character.species]
subtype = new NS.type()
subtype = GLOB.all_species[active_character.species_subtype] // Changing species resets subtype.
if(isnull(subtype))
subtype = GLOB.all_species[active_character.species]
subtype = new subtype.type()
reset_styles(S)
if("species_subtype")
if(S.bodyflags & HAS_SPECIES_SUBTYPE)
@@ -217,11 +220,17 @@
if(isnull(new_subtype) || active_character.species_subtype == new_subtype)
return
active_character.species_subtype = new_subtype
var/datum/species/NS = GLOB.all_species[active_character.species_subtype]
if(isnull(NS))
NS = GLOB.all_species[active_character.species]
subtype = new NS.type()
reset_styles(subtype, S)
subtype = GLOB.all_species[active_character.species_subtype]
if(isnull(subtype))
subtype = GLOB.all_species[active_character.species]
subtype = new subtype.type()
S = new S.type() // Always make a new species before editing it, as datums get messy.
if(S.name != subtype.name)
S.bodyflags |= subtype.bodyflags // Add our body flags of the new subtype.
S.species_subtype = subtype.name
reset_styles(subtype, S)
else
reset_styles(S)
if("speciesprefs")
active_character.speciesprefs = !active_character.speciesprefs //Starts 0, so if someone clicks the button up top there, this won't be 0 anymore. If they click it again, it'll go back to 0.
if("language")
@@ -1275,51 +1284,51 @@
var/head_model = "[!active_character.rlimb_data["head"] ? "Morpheus Cyberkinetics" : active_character.rlimb_data["head"]]"
robohead = GLOB.all_robolimbs[head_model]
//grab one of the valid hair styles for the newly chosen species
active_character.h_style = random_hair_style(active_character.gender, NS, robohead)
active_character.h_style = random_hair_style(active_character.gender, NS.name, robohead)
//grab one of the valid facial hair styles for the newly chosen species
active_character.f_style = random_facial_hair_style(active_character.gender, NS, robohead)
active_character.f_style = random_facial_hair_style(active_character.gender, NS.name, robohead)
if(NS.bodyflags & HAS_HEAD_ACCESSORY) //Species that have head accessories.
active_character.ha_style = random_head_accessory(NS)
active_character.ha_style = random_head_accessory(NS.name)
else
active_character.ha_style = "None" // No Vulp ears on Unathi
active_character.hacc_colour = rand_hex_color()
if(NS.bodyflags & HAS_HEAD_MARKINGS) //Species with head markings.
active_character.m_styles["head"] = random_marking_style("head", NS, robohead, null, active_character.alt_head)
active_character.m_styles["head"] = random_marking_style("head", NS.name, robohead, null, active_character.alt_head)
else
active_character.m_styles["head"] = "None"
active_character.m_colours["head"] = "#000000"
if(NS.bodyflags & HAS_BODY_MARKINGS) //Species with body markings/tattoos.
active_character.m_styles["body"] = random_marking_style("body", NS)
active_character.m_styles["body"] = random_marking_style("body", NS.name)
else
active_character.m_styles["body"] = "None"
active_character.m_colours["body"] = "#000000"
if(NS.bodyflags & HAS_TAIL_MARKINGS) //Species with tail markings.
active_character.m_styles["tail"] = random_marking_style("tail", NS, null, active_character.body_accessory)
active_character.m_styles["tail"] = random_marking_style("tail", NS.name, null, active_character.body_accessory)
else
active_character.m_styles["tail"] = "None"
active_character.m_colours["tail"] = "#000000"
// Don't wear another species' underwear!
var/datum/sprite_accessory/SA = GLOB.underwear_list[active_character.underwear]
if(!SA || !(NS in SA.species_allowed))
active_character.underwear = random_underwear(active_character.body_type, NS)
if(!SA || !(NS.name in SA.species_allowed))
active_character.underwear = random_underwear(active_character.body_type, NS.name)
SA = GLOB.undershirt_list[active_character.undershirt]
if(!SA || !(NS in SA.species_allowed))
active_character.undershirt = random_undershirt(active_character.body_type, NS)
if(!SA || !(NS.name in SA.species_allowed))
active_character.undershirt = random_undershirt(active_character.body_type, NS.name)
SA = GLOB.socks_list[active_character.socks]
if(!SA || !(NS in SA.species_allowed))
active_character.socks = random_socks(active_character.body_type, NS)
if(!SA || !(NS.name in SA.species_allowed))
active_character.socks = random_socks(active_character.body_type, NS.name)
//reset skin tone and colour
if(NS.bodyflags & (HAS_SKIN_TONE|HAS_ICON_SKIN_TONE))
random_skin_tone(NS)
random_skin_tone(NS.name)
else
active_character.s_tone = 0
@@ -182,6 +182,11 @@ GLOBAL_LIST_INIT(special_role_times, list(
switch(current_tab)
if(TAB_CHAR) // Character Settings
var/datum/species/S = GLOB.all_species[active_character.species]
var/datum/species/subtype = GLOB.all_species[active_character.species_subtype]
if(istype(S) && istype(subtype))
subtype = new subtype.type()
S = new S.type()
S.bodyflags |= subtype.bodyflags
if(!istype(S)) //The species was invalid. Set the species to the default, fetch the datum for that species and generate a random character.
active_character.species = initial(active_character.species)
S = GLOB.all_species[active_character.species]