From 92fb3b15e9e773c47af0d6cd8c1649179a74d5a2 Mon Sep 17 00:00:00 2001 From: Seris02 <49109742+Seris02@users.noreply.github.com> Date: Fri, 10 Mar 2023 09:35:43 +0800 Subject: [PATCH 1/2] reworks handling of transparent limbs --- .../mob/living/carbon/human/update_icons.dm | 61 +++++++++++++++++-- code/modules/organs/organ_icon.dm | 15 ++++- code/modules/organs/subtypes/standard.dm | 5 +- 3 files changed, 74 insertions(+), 7 deletions(-) diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 3694acaf233..47011cafdf1 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -271,12 +271,14 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon() head.eye_icon = initial(headtypepath.eye_icon) head.eye_icon_location = initial(headtypepath.eye_icon_location) icon_key += "[head.eye_icon]" + var/wholeicontransparent = TRUE for(var/organ_tag in species.has_limbs) var/obj/item/organ/external/part = organs_by_name[organ_tag] if(isnull(part) || part.is_stump() || part.is_hidden_by_sprite_accessory()) //VOREStation Edit allowing tails to prevent bodyparts rendering, granting more spriter freedom for taur/digitigrade stuff. icon_key += "0" continue if(part) + wholeicontransparent &&= part.nonsolid icon_key += "[part.species.get_race_key(part.owner)]" icon_key += "[part.dna.GetUIState(DNA_UI_GENDER)]" icon_key += "[part.s_tone]" @@ -322,7 +324,10 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon() else //BEGIN CACHED ICON GENERATION. var/obj/item/organ/external/chest = get_organ(BP_TORSO) - base_icon = chest.get_icon() + base_icon = chest.get_icon(skeleton, !wholeicontransparent) + + var/apply_extra_transparency_leg = organs_by_name[BP_L_LEG] && organs_by_name[BP_R_LEG] + var/apply_extra_transparency_foot = organs_by_name[BP_L_FOOT] && organs_by_name[BP_R_FOOT] var/icon/Cutter = null @@ -338,9 +343,13 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon() Cutter.Blend("#000000", ICON_MULTIPLY) // Black again. for(var/obj/item/organ/external/part in organs) +<<<<<<< HEAD if(isnull(part) || part.is_stump() || part.is_hidden_by_sprite_accessory()) //VOREStation Edit allowing tails to prevent bodyparts rendering, granting more spriter freedom for taur/digitigrade stuff. +======= + if(isnull(part) || part.is_stump() || part == chest) +>>>>>>> 5632af32c9a... reworks handling of transparent limbs (#8947) continue - var/icon/temp = part.get_icon(skeleton) + var/icon/temp = part.get_icon(skeleton, !wholeicontransparent) if((part.organ_tag in list(BP_L_LEG, BP_R_LEG, BP_L_FOOT, BP_R_FOOT)) && Cutter) temp.Blend(Cutter, ICON_AND, x = -16) @@ -356,16 +365,26 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon() if(!(part.icon_position & RIGHT)) temp2.Insert(new/icon(temp,dir=WEST),dir=WEST) base_icon.Blend(temp2, ICON_OVERLAY) + temp2.Insert(temp2,"blank",dir=NORTH) //faaaaairly certain this is more efficient than reloading temp2, doing this so we don't blend the icons twice (it matters more in transparent limbs) + temp2.Insert(temp2,"blank",dir=SOUTH) + temp2.Insert(temp2,"blank",dir=EAST) + temp2.Insert(temp2,"blank",dir=WEST) if(part.icon_position & LEFT) temp2.Insert(new/icon(temp,dir=EAST),dir=EAST) if(part.icon_position & RIGHT) temp2.Insert(new/icon(temp,dir=WEST),dir=WEST) + if (part.nonsolid && !wholeicontransparent) //apply a little (a lot) extra transparency to make it look better + if ((istype(part, /obj/item/organ/external/leg) && apply_extra_transparency_leg) || (istype(part, /obj/item/organ/external/foot) && apply_extra_transparency_foot)) //maybe + temp2 += rgb(,,,30) base_icon.Blend(temp2, ICON_UNDERLAY) else if(part.icon_position & UNDER) base_icon.Blend(temp, ICON_UNDERLAY) else base_icon.Blend(temp, ICON_OVERLAY) + if (wholeicontransparent) //because, I mean. It's basically never gonna happen that you'll have just one non-transparent limb but if you do your icon will look meh. Still good but meh, will have some areas with higher transparencies unless you're literally just a torso and a head + base_icon += rgb(,,,180) + if(!skeleton) if(husk) base_icon.ColorTone(husk_color_mod) @@ -391,7 +410,6 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon() update_tail_showing() update_wing_showing() - /mob/living/carbon/human/proc/update_skin() if(QDESTROYING(src)) return @@ -500,11 +518,22 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon() face_standing.Blend(hair_s, ICON_OVERLAY) +<<<<<<< HEAD if(head_organ.transparent) //VOREStation Edit: Prometheans are not ALWAYS transparent - face_standing += rgb(,,,120) +======= + var/icon/ears_s = get_ears_overlay() + if(head_organ.nonsolid || head_organ.transparent) +>>>>>>> 5632af32c9a... reworks handling of transparent limbs (#8947) + face_standing += rgb(,,,120) + if (ears_s) + ears_s += rgb(,,,180) + +<<<<<<< HEAD var/icon/ears_s = get_ears_overlay() var/image/em_block_ears +======= +>>>>>>> 5632af32c9a... reworks handling of transparent limbs (#8947) if(ears_s) if(ears_s.Height() > face_standing.Height()) // Tol ears face_standing.Crop(1, 1, face_standing.Width(), ears_s.Height()) @@ -569,7 +598,13 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon() else eyes_icon.Blend(rgb(128,0,0), ICON_ADD) +<<<<<<< HEAD // Convert to emissive at some point +======= + if (head_organ.nonsolid) + eyes_icon += rgb(,,,180) + +>>>>>>> 5632af32c9a... reworks handling of transparent limbs (#8947) var/image/eyes_image = image(eyes_icon) eyes_image.plane = PLANE_LIGHTING_ABOVE eyes_image.appearance_flags = appearance_flags @@ -988,15 +1023,22 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon() remove_layer(TAIL_UPPER_LAYER_ALT) remove_layer(TAIL_LOWER_LAYER) +<<<<<<< HEAD var/tail_layer = get_tail_layer() if(src.tail_style && src.tail_style.clip_mask_state) tail_layer = TAIL_UPPER_LAYER // Use default, let clip mask handle everything if(tail_alt && tail_layer == TAIL_UPPER_LAYER) tail_layer = TAIL_UPPER_LAYER_ALT +======= + var/obj/item/organ/external/chest = organs_by_name[BP_TORSO] + + var/tail_layer = GET_TAIL_LAYER +>>>>>>> 5632af32c9a... reworks handling of transparent limbs (#8947) var/image/tail_image = get_tail_image() if(tail_image) tail_image.layer = BODY_LAYER+tail_layer + tail_image.alpha = chest?.nonsolid ? 180 : 255 overlays_standing[tail_layer] = tail_image apply_layer(tail_layer) return @@ -1006,7 +1048,9 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon() //This one is actually not that bad I guess. if(species_tail && !(wear_suit && wear_suit.flags_inv & HIDETAIL)) var/icon/tail_s = get_tail_icon() - overlays_standing[tail_layer] = image(icon = tail_s, icon_state = "[species_tail]_s", layer = BODY_LAYER+tail_layer) + tail_image = image(icon = tail_s, icon_state = "[species_tail]_s", layer = BODY_LAYER+tail_layer) + tail_image.alpha = chest?.nonsolid ? 180 : 255 + overlays_standing[tail_layer] = tail_image animate_tail_reset() //TODO: Is this the appropriate place for this, and not on species...? @@ -1108,9 +1152,16 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon() remove_layer(WING_LAYER) remove_layer(WING_LOWER_LAYER) +<<<<<<< HEAD var/image/wing_image = get_wing_image(FALSE) +======= + var/obj/item/organ/external/chest = organs_by_name[BP_TORSO] + + var/image/wing_image = get_wing_image() +>>>>>>> 5632af32c9a... reworks handling of transparent limbs (#8947) if(wing_image) wing_image.layer = BODY_LAYER+WING_LAYER + wing_image.alpha = chest?.nonsolid ? 180 : 255 overlays_standing[WING_LAYER] = wing_image if(wing_style && wing_style.multi_dir) wing_image = get_wing_image(TRUE) diff --git a/code/modules/organs/organ_icon.dm b/code/modules/organs/organ_icon.dm index e67cc567c4b..eecc80d794b 100644 --- a/code/modules/organs/organ_icon.dm +++ b/code/modules/organs/organ_icon.dm @@ -79,7 +79,7 @@ var/global/list/limb_icon_cache = list() return res -/obj/item/organ/external/proc/get_icon(var/skeletal) +/obj/item/organ/external/proc/get_icon(var/skeletal, var/can_apply_transparency = TRUE) for(var/M in markings) var/datum/sprite_accessory/marking/mark = markings[M]["datum"] @@ -107,6 +107,8 @@ var/global/list/limb_icon_cache = list() if(owner && owner.gender == FEMALE) gender = "f" + var/should_apply_transparency = FALSE + if(!force_icon_key) icon_cache_key = "[icon_name]_[species ? species.get_bodytype() : SPECIES_HUMAN]" //VOREStation Edit else @@ -131,9 +133,11 @@ var/global/list/limb_icon_cache = list() mob_icon = new /icon('icons/mob/human_races/r_skeleton.dmi', "[icon_name][gender ? "_[gender]" : ""]") else if (robotic >= ORGAN_ROBOT) mob_icon = new /icon('icons/mob/human_races/robotic.dmi', "[icon_name][gender ? "_[gender]" : ""]") + should_apply_transparency = TRUE apply_colouration(mob_icon) else mob_icon = new /icon(species.get_icobase(owner, (status & ORGAN_MUTATED)), "[icon_name][gender ? "_[gender]" : ""]") + should_apply_transparency = TRUE apply_colouration(mob_icon) //Body markings, actually does not include head this time. Done separately above. @@ -165,6 +169,7 @@ var/global/list/limb_icon_cache = list() if(model) icon_cache_key += "_model_[model]" + should_apply_transparency = TRUE apply_colouration(mob_icon) if(owner && owner.synth_markings) for(var/M in markings) @@ -175,6 +180,7 @@ var/global/list/limb_icon_cache = list() mob_icon.Blend(mark_s, ICON_OVERLAY) //So when it's on your body, it has icons icon_cache_key += "[M][markings[M]["color"]]" +<<<<<<< HEAD if(body_hair && islist(h_col) && h_col.len >= 3) var/cache_key = "[body_hair]-[icon_name]-[h_col[1]][h_col[2]][h_col[3]]" if(!limb_icon_cache[cache_key]) @@ -183,6 +189,10 @@ var/global/list/limb_icon_cache = list() limb_icon_cache[cache_key] = I mob_icon.Blend(limb_icon_cache[cache_key], ICON_OVERLAY) // VOREStation edit ends here +======= + if (nonsolid && !istype(src,/obj/item/organ/external/head) && can_apply_transparency && should_apply_transparency) + mob_icon += rgb(,,,180) //do it here so any markings become transparent as well +>>>>>>> 5632af32c9a... reworks handling of transparent limbs (#8947) dir = EAST icon = mob_icon @@ -218,9 +228,12 @@ var/global/list/limb_icon_cache = list() icon_cache_key += "_color_[s_col[1]]_[s_col[2]]_[s_col[3]]_[ICON_ADD]" //VOREStation Edit End +<<<<<<< HEAD // Translucency. if(transparent) applying += rgb(,,,180) // SO INTUITIVE TY BYOND //VOREStation Edit +======= +>>>>>>> 5632af32c9a... reworks handling of transparent limbs (#8947) return applying /obj/item/organ/external/var/icon_cache_key diff --git a/code/modules/organs/subtypes/standard.dm b/code/modules/organs/subtypes/standard.dm index 7567aad0cab..9f6650c4486 100644 --- a/code/modules/organs/subtypes/standard.dm +++ b/code/modules/organs/subtypes/standard.dm @@ -339,7 +339,7 @@ "You make \the [I] kiss \the [src]!.") return ..() -/obj/item/organ/external/head/get_icon() +/obj/item/organ/external/head/get_icon(var/skeletal, var/can_apply_transparency = TRUE) ..() //The overlays are not drawn on the mob, they are used for if the head is removed and becomes an item @@ -400,6 +400,9 @@ add_overlay(get_hair_icon()) + if (nonsolid && can_apply_transparency) + mob_icon += rgb(,,,180) //do it here so any markings become transparent as well + return mob_icon /obj/item/organ/external/head/skrell From 982127a95d994c33e2b20a433485b749bf268ec8 Mon Sep 17 00:00:00 2001 From: Seris02 Date: Tue, 30 May 2023 13:06:17 +0800 Subject: [PATCH 2/2] merge conflict fix, transparent instead of nonsolid --- .../mob/living/carbon/human/update_icons.dm | 42 +++++-------------- code/modules/organs/organ_icon.dm | 12 +----- code/modules/organs/subtypes/standard.dm | 2 +- 3 files changed, 13 insertions(+), 43 deletions(-) diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 47011cafdf1..0bf8dd77794 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -278,7 +278,7 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon() icon_key += "0" continue if(part) - wholeicontransparent &&= part.nonsolid + wholeicontransparent &&= part.transparent //VORESTATION EDIT: transparent instead of nonsolid icon_key += "[part.species.get_race_key(part.owner)]" icon_key += "[part.dna.GetUIState(DNA_UI_GENDER)]" icon_key += "[part.s_tone]" @@ -343,11 +343,7 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon() Cutter.Blend("#000000", ICON_MULTIPLY) // Black again. for(var/obj/item/organ/external/part in organs) -<<<<<<< HEAD - if(isnull(part) || part.is_stump() || part.is_hidden_by_sprite_accessory()) //VOREStation Edit allowing tails to prevent bodyparts rendering, granting more spriter freedom for taur/digitigrade stuff. -======= - if(isnull(part) || part.is_stump() || part == chest) ->>>>>>> 5632af32c9a... reworks handling of transparent limbs (#8947) + if(isnull(part) || part.is_stump() || part == chest || part.is_hidden_by_sprite_accessory()) //VOREStation Edit allowing tails to prevent bodyparts rendering, granting more spriter freedom for taur/digitigrade stuff. continue var/icon/temp = part.get_icon(skeleton, !wholeicontransparent) @@ -373,7 +369,7 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon() temp2.Insert(new/icon(temp,dir=EAST),dir=EAST) if(part.icon_position & RIGHT) temp2.Insert(new/icon(temp,dir=WEST),dir=WEST) - if (part.nonsolid && !wholeicontransparent) //apply a little (a lot) extra transparency to make it look better + if (part.transparent && !wholeicontransparent) //apply a little (a lot) extra transparency to make it look better //VORESTATION EDIT: transparent instead of nonsolid if ((istype(part, /obj/item/organ/external/leg) && apply_extra_transparency_leg) || (istype(part, /obj/item/organ/external/foot) && apply_extra_transparency_foot)) //maybe temp2 += rgb(,,,30) base_icon.Blend(temp2, ICON_UNDERLAY) @@ -518,22 +514,14 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon() face_standing.Blend(hair_s, ICON_OVERLAY) -<<<<<<< HEAD - if(head_organ.transparent) //VOREStation Edit: Prometheans are not ALWAYS transparent -======= var/icon/ears_s = get_ears_overlay() - if(head_organ.nonsolid || head_organ.transparent) ->>>>>>> 5632af32c9a... reworks handling of transparent limbs (#8947) + if(head_organ.transparent) //VORESTATION EDIT: transparent instead of nonsolid face_standing += rgb(,,,120) if (ears_s) ears_s += rgb(,,,180) -<<<<<<< HEAD - var/icon/ears_s = get_ears_overlay() var/image/em_block_ears -======= ->>>>>>> 5632af32c9a... reworks handling of transparent limbs (#8947) if(ears_s) if(ears_s.Height() > face_standing.Height()) // Tol ears face_standing.Crop(1, 1, face_standing.Width(), ears_s.Height()) @@ -598,13 +586,10 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon() else eyes_icon.Blend(rgb(128,0,0), ICON_ADD) -<<<<<<< HEAD // Convert to emissive at some point -======= - if (head_organ.nonsolid) + if (head_organ.transparent) //VOREStation Edit: transparent instead of nonsolid eyes_icon += rgb(,,,180) ->>>>>>> 5632af32c9a... reworks handling of transparent limbs (#8947) var/image/eyes_image = image(eyes_icon) eyes_image.plane = PLANE_LIGHTING_ABOVE eyes_image.appearance_flags = appearance_flags @@ -1023,22 +1008,18 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon() remove_layer(TAIL_UPPER_LAYER_ALT) remove_layer(TAIL_LOWER_LAYER) -<<<<<<< HEAD var/tail_layer = get_tail_layer() if(src.tail_style && src.tail_style.clip_mask_state) tail_layer = TAIL_UPPER_LAYER // Use default, let clip mask handle everything if(tail_alt && tail_layer == TAIL_UPPER_LAYER) tail_layer = TAIL_UPPER_LAYER_ALT -======= - var/obj/item/organ/external/chest = organs_by_name[BP_TORSO] - var/tail_layer = GET_TAIL_LAYER ->>>>>>> 5632af32c9a... reworks handling of transparent limbs (#8947) + var/obj/item/organ/external/chest = organs_by_name[BP_TORSO] var/image/tail_image = get_tail_image() if(tail_image) tail_image.layer = BODY_LAYER+tail_layer - tail_image.alpha = chest?.nonsolid ? 180 : 255 + tail_image.alpha = chest?.transparent ? 180 : 255 //VORESTATION EDIT: transparent instead of nonsolid overlays_standing[tail_layer] = tail_image apply_layer(tail_layer) return @@ -1049,7 +1030,7 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon() if(species_tail && !(wear_suit && wear_suit.flags_inv & HIDETAIL)) var/icon/tail_s = get_tail_icon() tail_image = image(icon = tail_s, icon_state = "[species_tail]_s", layer = BODY_LAYER+tail_layer) - tail_image.alpha = chest?.nonsolid ? 180 : 255 + tail_image.alpha = chest?.transparent ? 180 : 255 //VORESTATION EDIT: transparent instead of nonsolid overlays_standing[tail_layer] = tail_image animate_tail_reset() @@ -1152,16 +1133,13 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon() remove_layer(WING_LAYER) remove_layer(WING_LOWER_LAYER) -<<<<<<< HEAD var/image/wing_image = get_wing_image(FALSE) -======= + var/obj/item/organ/external/chest = organs_by_name[BP_TORSO] - var/image/wing_image = get_wing_image() ->>>>>>> 5632af32c9a... reworks handling of transparent limbs (#8947) if(wing_image) wing_image.layer = BODY_LAYER+WING_LAYER - wing_image.alpha = chest?.nonsolid ? 180 : 255 + wing_image.alpha = chest?.transparent ? 180 : 255 //VORESTATION EDIT: transparent instead of nonsolid overlays_standing[WING_LAYER] = wing_image if(wing_style && wing_style.multi_dir) wing_image = get_wing_image(TRUE) diff --git a/code/modules/organs/organ_icon.dm b/code/modules/organs/organ_icon.dm index eecc80d794b..f008b6f0f92 100644 --- a/code/modules/organs/organ_icon.dm +++ b/code/modules/organs/organ_icon.dm @@ -180,7 +180,6 @@ var/global/list/limb_icon_cache = list() mob_icon.Blend(mark_s, ICON_OVERLAY) //So when it's on your body, it has icons icon_cache_key += "[M][markings[M]["color"]]" -<<<<<<< HEAD if(body_hair && islist(h_col) && h_col.len >= 3) var/cache_key = "[body_hair]-[icon_name]-[h_col[1]][h_col[2]][h_col[3]]" if(!limb_icon_cache[cache_key]) @@ -189,10 +188,9 @@ var/global/list/limb_icon_cache = list() limb_icon_cache[cache_key] = I mob_icon.Blend(limb_icon_cache[cache_key], ICON_OVERLAY) // VOREStation edit ends here -======= - if (nonsolid && !istype(src,/obj/item/organ/external/head) && can_apply_transparency && should_apply_transparency) + + if (transparent && !istype(src,/obj/item/organ/external/head) && can_apply_transparency && should_apply_transparency) //VORESTATION EDIT: transparent instead of nonsolid mob_icon += rgb(,,,180) //do it here so any markings become transparent as well ->>>>>>> 5632af32c9a... reworks handling of transparent limbs (#8947) dir = EAST icon = mob_icon @@ -228,12 +226,6 @@ var/global/list/limb_icon_cache = list() icon_cache_key += "_color_[s_col[1]]_[s_col[2]]_[s_col[3]]_[ICON_ADD]" //VOREStation Edit End -<<<<<<< HEAD - // Translucency. - if(transparent) applying += rgb(,,,180) // SO INTUITIVE TY BYOND //VOREStation Edit - -======= ->>>>>>> 5632af32c9a... reworks handling of transparent limbs (#8947) return applying /obj/item/organ/external/var/icon_cache_key diff --git a/code/modules/organs/subtypes/standard.dm b/code/modules/organs/subtypes/standard.dm index 9f6650c4486..c819920610c 100644 --- a/code/modules/organs/subtypes/standard.dm +++ b/code/modules/organs/subtypes/standard.dm @@ -400,7 +400,7 @@ add_overlay(get_hair_icon()) - if (nonsolid && can_apply_transparency) + if (transparent && can_apply_transparency) //VOREStation Edit: transparent instead of nonsolid mob_icon += rgb(,,,180) //do it here so any markings become transparent as well return mob_icon