It's 2 am and im having a manic episode so i fixed hair (#69092)

* 2 am coding

* lazylists like this are stupid

* reviews
This commit is contained in:
Kapu1178
2022-08-17 17:20:04 -07:00
committed by GitHub
parent 89341c100c
commit dcd84e1bdc
36 changed files with 239 additions and 202 deletions
+1 -3
View File
@@ -30,8 +30,6 @@
var/limb_id = SPECIES_HUMAN
//Defines what sprite the limb should use if it is also sexually dimorphic.
VAR_PROTECTED/limb_gender = "m"
///Does this limb have a greyscale version?
var/uses_mutcolor = TRUE
///Is there a sprite difference between male and female?
var/is_dimorphic = FALSE
///The actual color a limb is drawn as, set by /proc/update_limb()
@@ -660,7 +658,7 @@
else
skin_tone = ""
if(((MUTCOLORS in owner_species.species_traits) || (DYNCOLORS in owner_species.species_traits)) && uses_mutcolor) //Ethereal code. Motherfuckers.
if(((MUTCOLORS in owner_species.species_traits) || (DYNCOLORS in owner_species.species_traits))) //Ethereal code. Motherfuckers.
if(owner_species.fixed_mut_color)
species_color = owner_species.fixed_mut_color
else
@@ -140,7 +140,7 @@
synchronize_bodytypes(phantom_owner)
phantom_owner.update_health_hud() //update the healthdoll
phantom_owner.update_body()
phantom_owner.update_hair()
phantom_owner.update_body_parts()
if(!drop_loc) // drop_loc = null happens when a "dummy human" used for rendering icons on prefs screen gets its limbs replaced.
qdel(src)
@@ -418,6 +418,21 @@
pill_action.Grant(new_head_owner)
break
///Transfer existing hair properties to the new human.
if(!special && ishuman(new_head_owner))
var/mob/living/carbon/human/sexy_chad = new_head_owner
sexy_chad.hairstyle = hair_style
sexy_chad.hair_color = hair_color
sexy_chad.facial_hair_color = facial_hair_color
sexy_chad.facial_hairstyle = facial_hairstyle
if(hair_gradient_style || facial_hair_gradient_style)
LAZYSETLEN(sexy_chad.grad_style, GRADIENTS_LEN)
LAZYSETLEN(sexy_chad.grad_color, GRADIENTS_LEN)
sexy_chad.grad_style[GRADIENT_HAIR_KEY] = hair_gradient_style
sexy_chad.grad_color[GRADIENT_HAIR_KEY] = hair_gradient_color
sexy_chad.grad_style[GRADIENT_FACIAL_HAIR_KEY] = facial_hair_gradient_style
sexy_chad.grad_color[GRADIENT_FACIAL_HAIR_KEY] = facial_hair_gradient_color
new_head_owner.updatehealth()
new_head_owner.update_body()
new_head_owner.update_damage_overlays()
+111
View File
@@ -0,0 +1,111 @@
#define SET_OVERLAY_VALUE(X,Y,Z) if(X) X.Y = Z
///Part of `update_limb()`, this proc does what the name implies.
/obj/item/bodypart/head/proc/update_hair_and_lips()
var/mob/living/carbon/human/human_head_owner = owner
var/datum/species/owner_species = human_head_owner.dna.species
if(human_head_owner.lip_style && (LIPS in owner_species.species_traits))
lip_style = human_head_owner.lip_style
lip_color = human_head_owner.lip_color
else
lip_style = null
lip_color = "white"
///FACIAL HAIR CHECKS START
//we check if our hat or helmet hides our facial hair.
facial_hair_hidden = FALSE
if(human_head_owner.head)
var/obj/item/hat = human_head_owner.head
if(hat.flags_inv & HIDEFACIALHAIR)
facial_hair_hidden = TRUE
if(human_head_owner.wear_mask)
var/obj/item/mask = human_head_owner.wear_mask
if(mask.flags_inv & HIDEFACIALHAIR)
facial_hair_hidden = TRUE
///FACIAL HAIR CHECKS END
///HAIR CHECKS START
hair_hidden = FALSE
if(human_head_owner.head)
var/obj/item/hat = human_head_owner.head
if(hat.flags_inv & HIDEHAIR)
hair_hidden = TRUE
if(human_head_owner.w_uniform)
var/obj/item/item_uniform = human_head_owner.w_uniform
if(item_uniform.flags_inv & HIDEHAIR)
hair_hidden = TRUE
if(human_head_owner.wear_mask)
var/obj/item/mask = human_head_owner.wear_mask
if(mask.flags_inv & HIDEHAIR)
hair_hidden = TRUE
///HAIR CHECKS END
if(!hair_hidden && !owner.getorganslot(ORGAN_SLOT_BRAIN) && !(NOBLOOD in species_flags_list))
show_debrained = TRUE
else
show_debrained = FALSE
var/datum/sprite_accessory/sprite_accessory
facial_overlay = null
facial_gradient_overlay = null
hair_overlay = null
hair_gradient_overlay = null
hair_alpha = owner_species.hair_alpha
hair_color = human_head_owner.hair_color
facial_hair_color = human_head_owner.facial_hair_color
fixed_hair_color = owner_species.fixed_mut_color //Can be null
hair_style = human_head_owner.hairstyle
facial_hairstyle = human_head_owner.facial_hairstyle
if(facial_hairstyle && !facial_hair_hidden && (FACEHAIR in species_flags_list))
sprite_accessory = GLOB.facial_hairstyles_list[facial_hairstyle]
if(sprite_accessory)
//Create the overlay
facial_overlay = mutable_appearance(sprite_accessory.icon, sprite_accessory.icon_state, -HAIR_LAYER)
facial_overlay.overlays += emissive_blocker(facial_overlay.icon, facial_overlay.icon_state, alpha = hair_alpha)
//Gradients
facial_hair_gradient_style = LAZYACCESS(human_head_owner.grad_style, GRADIENT_FACIAL_HAIR_KEY)
if(facial_hair_gradient_style)
facial_hair_gradient_color = LAZYACCESS(human_head_owner.grad_color, GRADIENT_FACIAL_HAIR_KEY)
facial_gradient_overlay = make_gradient_overlay(sprite_accessory.icon, sprite_accessory.icon_state, HAIR_LAYER, GLOB.facial_hair_gradients_list[facial_hair_gradient_style], facial_hair_gradient_color)
facial_overlay.overlays += emissive_blocker(sprite_accessory.icon, sprite_accessory.icon_state, alpha = hair_alpha)
if(!hair_hidden && !show_debrained && (HAIR in species_flags_list))
sprite_accessory = GLOB.hairstyles_list[hair_style]
if(sprite_accessory)
hair_overlay = mutable_appearance(sprite_accessory.icon, sprite_accessory.icon_state, -HAIR_LAYER)
hair_overlay.overlays += emissive_blocker(hair_overlay.icon, hair_overlay.icon_state, alpha = hair_alpha)
hair_gradient_style = LAZYACCESS(human_head_owner.grad_style, GRADIENT_HAIR_KEY)
if(hair_gradient_style)
hair_gradient_color = LAZYACCESS(human_head_owner.grad_color, GRADIENT_HAIR_KEY)
hair_gradient_overlay = make_gradient_overlay(sprite_accessory.icon, sprite_accessory.icon_state, HAIR_LAYER, GLOB.hair_gradients_list[hair_gradient_style], hair_gradient_color)
//CREATION-ONLY END
//HAIR COLOR START
if(!override_hair_color)
if(hair_color_source)
if(hair_color_source == "fixedmutcolor")
SET_OVERLAY_VALUE(facial_overlay, color, fixed_hair_color)
SET_OVERLAY_VALUE(hair_overlay, color, fixed_hair_color)
else if(hair_color_source == "mutcolor")
SET_OVERLAY_VALUE(facial_overlay, color, facial_hair_color)
SET_OVERLAY_VALUE(hair_overlay, color, hair_color)
else
SET_OVERLAY_VALUE(facial_overlay, color, hair_color_source)
SET_OVERLAY_VALUE(hair_overlay, color, hair_color_source)
else
SET_OVERLAY_VALUE(facial_overlay, color, facial_hair_color)
SET_OVERLAY_VALUE(hair_overlay, color, hair_color)
else
SET_OVERLAY_VALUE(facial_overlay, color, override_hair_color)
SET_OVERLAY_VALUE(hair_overlay, color, override_hair_color)
//HAIR COLOR END
#undef SET_OVERLAY_VALUE
+7 -114
View File
@@ -166,7 +166,6 @@
return ..()
#define SET_OVERLAY_VALUE(X,Y,Z) if(X) X.Y = Z
/obj/item/bodypart/head/update_limb(dropping_limb, is_creating)
. = ..()
@@ -178,117 +177,10 @@
lip_style = null
stored_lipstick_trait = null
else if(!animal_origin && ishuman(owner))
var/mob/living/carbon/human/human_head_owner = owner
var/datum/species/owner_species = human_head_owner.dna.species
if(human_head_owner.lip_style && (LIPS in owner_species.species_traits))
lip_style = human_head_owner.lip_style
lip_color = human_head_owner.lip_color
else
lip_style = null
lip_color = "white"
///FACIAL HAIR CHECKS START
//we check if our hat or helmet hides our facial hair.
facial_hair_hidden = FALSE
if(human_head_owner.head)
var/obj/item/hat = human_head_owner.head
if(hat.flags_inv & HIDEFACIALHAIR)
facial_hair_hidden = TRUE
if(human_head_owner.wear_mask)
var/obj/item/mask = human_head_owner.wear_mask
if(mask.flags_inv & HIDEFACIALHAIR)
facial_hair_hidden = TRUE
///FACIAL HAIR CHECKS END
///HAIR CHECKS START
hair_hidden = FALSE
if(human_head_owner.head)
var/obj/item/hat = human_head_owner.head
if(hat.flags_inv & HIDEHAIR)
hair_hidden = TRUE
if(human_head_owner.w_uniform)
var/obj/item/item_uniform = human_head_owner.w_uniform
if(item_uniform.flags_inv & HIDEHAIR)
hair_hidden = TRUE
if(human_head_owner.wear_mask)
var/obj/item/mask = human_head_owner.wear_mask
if(mask.flags_inv & HIDEHAIR)
hair_hidden = TRUE
///HAIR CHECKS END
if(!hair_hidden && !owner.getorgan(/obj/item/organ/internal/brain) && !(NOBLOOD in species_flags_list))
show_debrained = TRUE
else
show_debrained = FALSE
//CREATION-ONLY START
if(is_creating)
var/datum/sprite_accessory/sprite_accessory
facial_overlay = null
facial_gradient_overlay = null
hair_overlay = null
hair_gradient_overlay = null
hair_alpha = owner_species.hair_alpha
hair_color = human_head_owner.hair_color
facial_hair_color = human_head_owner.facial_hair_color
fixed_hair_color = owner_species.fixed_mut_color //Can be null
hair_style = human_head_owner.hairstyle
facial_hairstyle = human_head_owner.facial_hairstyle
if(!animal_origin && ishuman(owner))
update_hair_and_lips()
if(facial_hairstyle && !facial_hair_hidden && (FACEHAIR in species_flags_list))
sprite_accessory = GLOB.facial_hairstyles_list[facial_hairstyle]
if(sprite_accessory)
//Create the overlay
facial_overlay = mutable_appearance(sprite_accessory.icon, sprite_accessory.icon_state, -HAIR_LAYER)
facial_overlay.overlays += emissive_blocker(facial_overlay.icon, facial_overlay.icon_state, alpha = hair_alpha)
//Gradients
facial_hair_gradient_style = LAZYACCESS(human_head_owner.grad_style, GRADIENT_FACIAL_HAIR_KEY)
if(facial_hair_gradient_style)
facial_hair_gradient_color = LAZYACCESS(human_head_owner.grad_color, GRADIENT_FACIAL_HAIR_KEY)
facial_gradient_overlay = make_gradient_overlay(sprite_accessory.icon, sprite_accessory.icon_state, HAIR_LAYER, GLOB.facial_hair_gradients_list[facial_hair_gradient_style], facial_hair_gradient_color)
facial_overlay.overlays += emissive_blocker(sprite_accessory.icon, sprite_accessory.icon_state, alpha = hair_alpha)
if(!hair_hidden && !show_debrained && (HAIR in species_flags_list))
sprite_accessory = GLOB.hairstyles_list[hair_style]
if(sprite_accessory)
hair_overlay = mutable_appearance(sprite_accessory.icon, sprite_accessory.icon_state, -HAIR_LAYER)
hair_overlay.overlays += emissive_blocker(hair_overlay.icon, hair_overlay.icon_state, alpha = hair_alpha)
hair_gradient_style = LAZYACCESS(human_head_owner.grad_style, GRADIENT_HAIR_KEY)
if(hair_gradient_style)
hair_gradient_color = LAZYACCESS(human_head_owner.grad_color, GRADIENT_HAIR_KEY)
hair_gradient_overlay = make_gradient_overlay(sprite_accessory.icon, sprite_accessory.icon_state, HAIR_LAYER, GLOB.hair_gradients_list[hair_gradient_style], hair_gradient_color)
//CREATION-ONLY END
//HAIR COLOR START
if(!override_hair_color)
if(hair_color_source)
if(hair_color_source == "fixedmutcolor")
SET_OVERLAY_VALUE(facial_overlay, color, fixed_hair_color)
SET_OVERLAY_VALUE(hair_overlay, color, fixed_hair_color)
else if(hair_color_source == "mutcolor")
SET_OVERLAY_VALUE(facial_overlay, color, facial_hair_color)
SET_OVERLAY_VALUE(hair_overlay, color, hair_color)
else
SET_OVERLAY_VALUE(facial_overlay, color, hair_color_source)
SET_OVERLAY_VALUE(hair_overlay, color, hair_color_source)
else
SET_OVERLAY_VALUE(facial_overlay, color, facial_hair_color)
SET_OVERLAY_VALUE(hair_overlay, color, hair_color)
else
SET_OVERLAY_VALUE(facial_overlay, color, override_hair_color)
SET_OVERLAY_VALUE(hair_overlay, color, override_hair_color)
//HAIR COLOR END
#undef SET_OVERLAY_VALUE
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/obj/item/bodypart/head/get_limb_icon(dropped, draw_external_organs)
@@ -361,10 +253,11 @@
. += hair_overlay
if(hair_gradient_overlay)
. += hair_gradient_overlay
///Set the haircolor of a human. Override instead sets the override value, it will not be changed away from the override value until override is set to null.
/mob/proc/set_haircolor(hex_string, override)
/mob/living/proc/set_haircolor(hex_string, override)
return
///Set the haircolor of a human. Override instead sets the override value, it will not be changed away from the override value until override is set to null.
/mob/living/carbon/human/set_haircolor(hex_string, override)
var/obj/item/bodypart/head/my_head = get_bodypart(BODY_ZONE_HEAD)
if(!my_head)
@@ -373,8 +266,8 @@
if(override)
my_head.override_hair_color = hex_string
else
my_head.hair_color = hex_string
update_hair(is_creating = TRUE)
hair_color = hex_string
update_body_parts()
/obj/item/bodypart/head/proc/make_gradient_overlay(file, icon, layer, datum/sprite_accessory/gradient, grad_color)
RETURN_TYPE(/mutable_appearance)
@@ -2,30 +2,67 @@
icon_greyscale = 'icons/mob/species/ethereal/bodyparts.dmi'
limb_id = SPECIES_ETHEREAL
is_dimorphic = FALSE
uses_mutcolor = TRUE
/obj/item/bodypart/head/ethereal/update_limb(dropping_limb, is_creating)
. = ..()
if(isethereal(owner))
var/mob/living/carbon/human/potato_oc = owner
var/datum/species/ethereal/eth_holder = potato_oc.dna.species
species_color = eth_holder.current_color
/obj/item/bodypart/chest/ethereal
icon_greyscale = 'icons/mob/species/ethereal/bodyparts.dmi'
limb_id = SPECIES_ETHEREAL
is_dimorphic = FALSE
uses_mutcolor = TRUE
/obj/item/bodypart/chest/ethereal/update_limb(dropping_limb, is_creating)
. = ..()
if(isethereal(owner))
var/mob/living/carbon/human/potato_oc = owner
var/datum/species/ethereal/eth_holder = potato_oc.dna.species
species_color = eth_holder.current_color
/obj/item/bodypart/l_arm/ethereal
icon_greyscale = 'icons/mob/species/ethereal/bodyparts.dmi'
limb_id = SPECIES_ETHEREAL
uses_mutcolor = TRUE
/obj/item/bodypart/l_arm/ethereal/update_limb(dropping_limb, is_creating)
. = ..()
if(isethereal(owner))
var/mob/living/carbon/human/potato_oc = owner
var/datum/species/ethereal/eth_holder = potato_oc.dna.species
species_color = eth_holder.current_color
/obj/item/bodypart/r_arm/ethereal
icon_greyscale = 'icons/mob/species/ethereal/bodyparts.dmi'
limb_id = SPECIES_ETHEREAL
uses_mutcolor = TRUE
/obj/item/bodypart/r_arm/ethereal/update_limb(dropping_limb, is_creating)
. = ..()
if(isethereal(owner))
var/mob/living/carbon/human/potato_oc = owner
var/datum/species/ethereal/eth_holder = potato_oc.dna.species
species_color = eth_holder.current_color
/obj/item/bodypart/l_leg/ethereal
icon_greyscale = 'icons/mob/species/ethereal/bodyparts.dmi'
limb_id = SPECIES_ETHEREAL
uses_mutcolor = TRUE
/obj/item/bodypart/l_leg/ethereal/update_limb(dropping_limb, is_creating)
. = ..()
if(isethereal(owner))
var/mob/living/carbon/human/potato_oc = owner
var/datum/species/ethereal/eth_holder = potato_oc.dna.species
species_color = eth_holder.current_color
/obj/item/bodypart/r_leg/ethereal
icon_greyscale = 'icons/mob/species/ethereal/bodyparts.dmi'
limb_id = SPECIES_ETHEREAL
uses_mutcolor = TRUE
/obj/item/bodypart/r_leg/ethereal/update_limb(dropping_limb, is_creating)
. = ..()
if(isethereal(owner))
var/mob/living/carbon/human/potato_oc = owner
var/datum/species/ethereal/eth_holder = potato_oc.dna.species
species_color = eth_holder.current_color
@@ -1,38 +1,31 @@
/obj/item/bodypart/head/lizard
icon_greyscale = 'icons/mob/species/lizard/bodyparts.dmi'
limb_id = SPECIES_LIZARD
uses_mutcolor = TRUE
is_dimorphic = FALSE
/obj/item/bodypart/chest/lizard
icon_greyscale = 'icons/mob/species/lizard/bodyparts.dmi'
uses_mutcolor = TRUE
limb_id = SPECIES_LIZARD
is_dimorphic = TRUE
/obj/item/bodypart/l_arm/lizard
icon_greyscale = 'icons/mob/species/lizard/bodyparts.dmi'
uses_mutcolor = TRUE
limb_id = SPECIES_LIZARD
/obj/item/bodypart/r_arm/lizard
icon_greyscale = 'icons/mob/species/lizard/bodyparts.dmi'
uses_mutcolor = TRUE
limb_id = SPECIES_LIZARD
/obj/item/bodypart/l_leg/lizard
icon_greyscale = 'icons/mob/species/lizard/bodyparts.dmi'
uses_mutcolor = TRUE
limb_id = SPECIES_LIZARD
/obj/item/bodypart/r_leg/lizard
icon_greyscale = 'icons/mob/species/lizard/bodyparts.dmi'
uses_mutcolor = TRUE
limb_id = SPECIES_LIZARD
/obj/item/bodypart/l_leg/digitigrade
icon_greyscale = 'icons/mob/species/lizard/bodyparts.dmi'
uses_mutcolor = TRUE
limb_id = BODYPART_TYPE_DIGITIGRADE
bodytype = BODYTYPE_HUMANOID | BODYTYPE_ORGANIC | BODYTYPE_DIGITIGRADE
@@ -59,7 +52,6 @@
/obj/item/bodypart/r_leg/digitigrade
icon_greyscale = 'icons/mob/species/lizard/bodyparts.dmi'
uses_mutcolor = TRUE
limb_id = BODYPART_TYPE_DIGITIGRADE
bodytype = BODYTYPE_HUMANOID | BODYTYPE_ORGANIC | BODYTYPE_DIGITIGRADE