From 2d668fb9dcf72a3c5149afaee2ba00e718a89909 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Wed, 19 Jul 2023 01:18:06 +0200 Subject: [PATCH] [MIRROR] Fixes ethereals' hair. Separates fixed hair color from the 'fixed_mut_color' var [MDB IGNORE] (#22573) * Fixes ethereals' hair. Separates fixed hair color from the 'fixed_mut_color' var (#76930) The series of "species nuking" prs made it so that the `fixed_mut_color` also applies to hair. The problem with that is you may not want that in some cases. It also introduced a bug where that var prevents ethereals' hair from changing colors when they die. So I have moved hair out of the things that gets `FIXED_MUT_COLOR` trait applied to it in favor of its own thing. `FIXED_HAIR_COLOR` trait is now used for ethereals to get a fixed hair color. Ethereals' hair should go out now when they die again, and it comes back on when they are revived. * Fixes ethereals' hair. Separates fixed hair color from the 'fixed_mut_color' var --------- Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com> --- code/__DEFINES/traits.dm | 2 ++ code/_globalvars/traits.dm | 1 + code/modules/mob/living/carbon/human/_species.dm | 4 +++- .../carbon/human/species_types/ethereal.dm | 16 +++++++++++++--- .../surgery/bodyparts/head_hair_and_lips.dm | 2 +- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm index 67018e5e3e7..27118ae808a 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -244,6 +244,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai #define TRAIT_MUTANT_COLORS "mutcolors" /// Species with this trait have mutant colors that cannot be chosen by the player, nor altered ingame by external means #define TRAIT_FIXED_MUTANT_COLORS "fixed_mutcolors" +/// Species with this trait have a haircolor that cannot be chosen by the player, nor altered ingame by external means +#define TRAIT_FIXED_HAIRCOLOR "fixed_haircolor" /// Humans with this trait won't get bloody hands, nor bloody feet #define TRAIT_NO_BLOOD_OVERLAY "no_blood_overlay" /// Humans with this trait cannot have underwear diff --git a/code/_globalvars/traits.dm b/code/_globalvars/traits.dm index 27a848ea028..6365acd6221 100644 --- a/code/_globalvars/traits.dm +++ b/code/_globalvars/traits.dm @@ -175,6 +175,7 @@ GLOBAL_LIST_INIT(traits_by_type, list( "TRAIT_USES_SKINTONES" = TRAIT_USES_SKINTONES, "TRAIT_MUTANT_COLORS" = TRAIT_MUTANT_COLORS, "TRAIT_FIXED_MUTANT_COLORS" = TRAIT_FIXED_MUTANT_COLORS, + "TRAIT_FIXED_HAIRCOLOR" = TRAIT_FIXED_HAIRCOLOR, "TRAIT_NO_BLOOD_OVERLAY" = TRAIT_NO_BLOOD_OVERLAY, "TRAIT_NO_UNDERWEAR" = TRAIT_NO_UNDERWEAR, "TRAIT_NO_AUGMENTS" = TRAIT_NO_AUGMENTS, diff --git a/code/modules/mob/living/carbon/human/_species.dm b/code/modules/mob/living/carbon/human/_species.dm index fb456b0a8a4..4039d80674e 100644 --- a/code/modules/mob/living/carbon/human/_species.dm +++ b/code/modules/mob/living/carbon/human/_species.dm @@ -121,6 +121,8 @@ GLOBAL_LIST_EMPTY(features_by_species) var/siemens_coeff = 1 ///To use MUTCOLOR with a fixed color that's independent of the mcolor feature in DNA. var/fixed_mut_color = "" + ///A fixed hair color that's independent of the mcolor feature in DNA. + var/fixed_hair_color = "" ///Special mutation that can be found in the genepool exclusively in this species. Dont leave empty or changing species will be a headache var/inert_mutation = /datum/mutation/human/dwarfism ///Used to set the mob's death_sound upon species change @@ -779,7 +781,7 @@ GLOBAL_LIST_EMPTY(features_by_species) if(hair_color == "mutcolor") accessory_overlay.color = source.dna.features["mcolor"] else if(hair_color == "fixedmutcolor") - accessory_overlay.color = fixed_mut_color + accessory_overlay.color = fixed_hair_color else accessory_overlay.color = source.hair_color if(FACIAL_HAIR_COLOR) diff --git a/code/modules/mob/living/carbon/human/species_types/ethereal.dm b/code/modules/mob/living/carbon/human/species_types/ethereal.dm index bdcede165c1..7a0dc44e231 100644 --- a/code/modules/mob/living/carbon/human/species_types/ethereal.dm +++ b/code/modules/mob/living/carbon/human/species_types/ethereal.dm @@ -14,6 +14,7 @@ // TRAIT_NO_UNDERWEAR, // SKYRAT EDIT - LET THEM WEAR PANTIES TRAIT_MUTANT_COLORS, TRAIT_FIXED_MUTANT_COLORS, + TRAIT_FIXED_HAIRCOLOR, TRAIT_AGENDER, ) changesource_flags = MIRROR_BADMIN | WABBAJACK | MIRROR_PRIDE | MIRROR_MAGIC | RACE_SWAP | ERT_SPAWN | SLIME_EXTRACT @@ -60,6 +61,7 @@ return var/mob/living/carbon/human/ethereal = new_ethereal default_color = ethereal.dna.features["ethcolor"] + fixed_hair_color = default_color r1 = GETREDPART(default_color) g1 = GETGREENPART(default_color) b1 = GETBLUEPART(default_color) @@ -119,11 +121,18 @@ ethereal_light.set_light_range_power_color(1 + (2 * healthpercent), 1 + (1 * healthpercent), current_color) ethereal_light.set_light_on(TRUE) fixed_mut_color = current_color + fixed_hair_color = current_color + ethereal.update_body() + ethereal.set_facial_haircolor(current_color, override = TRUE, update = FALSE) + ethereal.set_haircolor(current_color, override = TRUE, update = TRUE) else ethereal_light.set_light_on(FALSE) - fixed_mut_color = rgb(128,128,128) - ethereal.set_facial_haircolor(current_color, update = FALSE) - ethereal.set_haircolor(current_color, update = TRUE) + var/dead_color = rgb(128,128,128) + fixed_mut_color = dead_color + fixed_hair_color = dead_color + ethereal.update_body() + ethereal.set_facial_haircolor(dead_color, override = TRUE, update = FALSE) + ethereal.set_haircolor(dead_color, override = TRUE, update = TRUE) /datum/species/ethereal/proc/on_emp_act(mob/living/carbon/human/H, severity) SIGNAL_HANDLER @@ -247,6 +256,7 @@ TRAIT_NO_UNDERWEAR, TRAIT_MUTANT_COLORS, TRAIT_FIXED_MUTANT_COLORS, + TRAIT_FIXED_HAIRCOLOR, TRAIT_AGENDER, TRAIT_TENACIOUS, TRAIT_NOBREATH, diff --git a/code/modules/surgery/bodyparts/head_hair_and_lips.dm b/code/modules/surgery/bodyparts/head_hair_and_lips.dm index e163a831dcc..ea54ae4581a 100644 --- a/code/modules/surgery/bodyparts/head_hair_and_lips.dm +++ b/code/modules/surgery/bodyparts/head_hair_and_lips.dm @@ -70,7 +70,7 @@ facial_hairstyle = human_head_owner.facial_hairstyle facial_hair_alpha = owner_species.facial_hair_alpha facial_hair_color = human_head_owner.facial_hair_color - fixed_hair_color = owner_species.fixed_mut_color //Can be null + fixed_hair_color = owner_species.fixed_hair_color //Can be null gradient_styles = human_head_owner.grad_style?.Copy() gradient_colors = human_head_owner.grad_color?.Copy()