Merge pull request #14921 from Seris02/mirrortransparent

reworks handling of transparent limbs (manual mirror)
This commit is contained in:
Heroman3003
2023-05-31 18:28:50 +10:00
committed by CHOMPStation2
parent 50ef3183f7
commit 905d26f647
3 changed files with 50 additions and 13 deletions

View File

@@ -281,12 +281,14 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon()
head.eye_icon = initial(headtypepath.eye_icon) head.eye_icon = initial(headtypepath.eye_icon)
head.eye_icon_location = initial(headtypepath.eye_icon_location) head.eye_icon_location = initial(headtypepath.eye_icon_location)
icon_key += "[head.eye_icon]" icon_key += "[head.eye_icon]"
var/wholeicontransparent = TRUE
for(var/organ_tag in species.has_limbs) for(var/organ_tag in species.has_limbs)
var/obj/item/organ/external/part = organs_by_name[organ_tag] 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. 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" icon_key += "0"
continue continue
if(part) if(part)
wholeicontransparent &&= part.transparent //VORESTATION EDIT: transparent instead of nonsolid
icon_key += "[part.species.get_race_key(part.owner)]" icon_key += "[part.species.get_race_key(part.owner)]"
icon_key += "[part.dna.GetUIState(DNA_UI_GENDER)]" icon_key += "[part.dna.GetUIState(DNA_UI_GENDER)]"
icon_key += "[part.s_tone]" icon_key += "[part.s_tone]"
@@ -338,7 +340,10 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon()
else else
//BEGIN CACHED ICON GENERATION. //BEGIN CACHED ICON GENERATION.
var/obj/item/organ/external/chest = get_organ(BP_TORSO) 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 var/icon/Cutter = null
@@ -354,9 +359,9 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon()
Cutter.Blend("#000000", ICON_MULTIPLY) // Black again. Cutter.Blend("#000000", ICON_MULTIPLY) // Black again.
for(var/obj/item/organ/external/part in organs) for(var/obj/item/organ/external/part in organs)
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 || part.is_hidden_by_sprite_accessory()) //VOREStation Edit allowing tails to prevent bodyparts rendering, granting more spriter freedom for taur/digitigrade stuff.
continue 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) 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) temp.Blend(Cutter, ICON_AND, x = -16)
@@ -372,16 +377,26 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon()
if(!(part.icon_position & RIGHT)) if(!(part.icon_position & RIGHT))
temp2.Insert(new/icon(temp,dir=WEST),dir=WEST) temp2.Insert(new/icon(temp,dir=WEST),dir=WEST)
base_icon.Blend(temp2, ICON_OVERLAY) 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) if(part.icon_position & LEFT)
temp2.Insert(new/icon(temp,dir=EAST),dir=EAST) temp2.Insert(new/icon(temp,dir=EAST),dir=EAST)
if(part.icon_position & RIGHT) if(part.icon_position & RIGHT)
temp2.Insert(new/icon(temp,dir=WEST),dir=WEST) temp2.Insert(new/icon(temp,dir=WEST),dir=WEST)
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) base_icon.Blend(temp2, ICON_UNDERLAY)
else if(part.icon_position & UNDER) else if(part.icon_position & UNDER)
base_icon.Blend(temp, ICON_UNDERLAY) base_icon.Blend(temp, ICON_UNDERLAY)
else else
base_icon.Blend(temp, ICON_OVERLAY) 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(!skeleton)
if(husk) if(husk)
base_icon.ColorTone(husk_color_mod) base_icon.ColorTone(husk_color_mod)
@@ -416,7 +431,6 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon()
update_vore_belly_sprite() update_vore_belly_sprite()
update_vore_tail_sprite() update_vore_tail_sprite()
/mob/living/carbon/human/proc/update_skin() /mob/living/carbon/human/proc/update_skin()
if(QDESTROYING(src)) if(QDESTROYING(src))
return return
@@ -525,10 +539,13 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon()
face_standing.Blend(hair_s, ICON_OVERLAY) face_standing.Blend(hair_s, ICON_OVERLAY)
if(head_organ.transparent) //VOREStation Edit: Prometheans are not ALWAYS transparent
face_standing += rgb(,,,120)
var/icon/ears_s = get_ears_overlay() var/icon/ears_s = get_ears_overlay()
if(head_organ.transparent) //VORESTATION EDIT: transparent instead of nonsolid
face_standing += rgb(,,,120)
if (ears_s)
ears_s += rgb(,,,180)
var/image/em_block_ears var/image/em_block_ears
if(ears_s) if(ears_s)
if(ears_s.Height() > face_standing.Height()) // Tol ears if(ears_s.Height() > face_standing.Height()) // Tol ears
@@ -595,6 +612,9 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon()
eyes_icon.Blend(rgb(128,0,0), ICON_ADD) eyes_icon.Blend(rgb(128,0,0), ICON_ADD)
// Convert to emissive at some point // Convert to emissive at some point
if (head_organ.transparent) //VOREStation Edit: transparent instead of nonsolid
eyes_icon += rgb(,,,180)
var/image/eyes_image = image(eyes_icon) var/image/eyes_image = image(eyes_icon)
eyes_image.plane = PLANE_LIGHTING_ABOVE eyes_image.plane = PLANE_LIGHTING_ABOVE
eyes_image.appearance_flags = appearance_flags eyes_image.appearance_flags = appearance_flags
@@ -1037,9 +1057,12 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon()
if(tail_alt && tail_layer == TAIL_UPPER_LAYER) if(tail_alt && tail_layer == TAIL_UPPER_LAYER)
tail_layer = TAIL_UPPER_LAYER_ALT tail_layer = TAIL_UPPER_LAYER_ALT
var/obj/item/organ/external/chest = organs_by_name[BP_TORSO]
var/image/tail_image = get_tail_image() var/image/tail_image = get_tail_image()
if(tail_image) if(tail_image)
tail_image.layer = BODY_LAYER+tail_layer tail_image.layer = BODY_LAYER+tail_layer
tail_image.alpha = chest?.transparent ? 180 : 255 //VORESTATION EDIT: transparent instead of nonsolid
overlays_standing[tail_layer] = tail_image overlays_standing[tail_layer] = tail_image
apply_layer(tail_layer) apply_layer(tail_layer)
return return
@@ -1049,7 +1072,9 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon()
//This one is actually not that bad I guess. //This one is actually not that bad I guess.
if(species_tail && !(wear_suit && wear_suit.flags_inv & HIDETAIL)) if(species_tail && !(wear_suit && wear_suit.flags_inv & HIDETAIL))
var/icon/tail_s = get_tail_icon() 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?.transparent ? 180 : 255 //VORESTATION EDIT: transparent instead of nonsolid
overlays_standing[tail_layer] = tail_image
animate_tail_reset() animate_tail_reset()
//TODO: Is this the appropriate place for this, and not on species...? //TODO: Is this the appropriate place for this, and not on species...?
@@ -1152,8 +1177,12 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon()
remove_layer(WING_LOWER_LAYER) remove_layer(WING_LOWER_LAYER)
var/image/wing_image = get_wing_image(FALSE) var/image/wing_image = get_wing_image(FALSE)
var/obj/item/organ/external/chest = organs_by_name[BP_TORSO]
if(wing_image) if(wing_image)
wing_image.layer = BODY_LAYER+WING_LAYER wing_image.layer = BODY_LAYER+WING_LAYER
wing_image.alpha = chest?.transparent ? 180 : 255 //VORESTATION EDIT: transparent instead of nonsolid
overlays_standing[WING_LAYER] = wing_image overlays_standing[WING_LAYER] = wing_image
if(wing_style && wing_style.multi_dir) if(wing_style && wing_style.multi_dir)
wing_image = get_wing_image(TRUE) wing_image = get_wing_image(TRUE)

View File

@@ -79,7 +79,7 @@ var/global/list/limb_icon_cache = list()
return res 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) for(var/M in markings)
var/datum/sprite_accessory/marking/mark = markings[M]["datum"] 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) if(owner && owner.gender == FEMALE)
gender = "f" gender = "f"
var/should_apply_transparency = FALSE
if(!force_icon_key) if(!force_icon_key)
icon_cache_key = "[icon_name]_[species ? species.get_bodytype() : SPECIES_HUMAN]" //VOREStation Edit icon_cache_key = "[icon_name]_[species ? species.get_bodytype() : SPECIES_HUMAN]" //VOREStation Edit
else 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]" : ""]") mob_icon = new /icon('icons/mob/human_races/r_skeleton.dmi', "[icon_name][gender ? "_[gender]" : ""]")
else if (robotic >= ORGAN_ROBOT) else if (robotic >= ORGAN_ROBOT)
mob_icon = new /icon('icons/mob/human_races/robotic.dmi', "[icon_name][gender ? "_[gender]" : ""]") mob_icon = new /icon('icons/mob/human_races/robotic.dmi', "[icon_name][gender ? "_[gender]" : ""]")
should_apply_transparency = TRUE
apply_colouration(mob_icon) apply_colouration(mob_icon)
else else
mob_icon = new /icon(species.get_icobase(owner, (status & ORGAN_MUTATED)), "[icon_name][gender ? "_[gender]" : ""]") mob_icon = new /icon(species.get_icobase(owner, (status & ORGAN_MUTATED)), "[icon_name][gender ? "_[gender]" : ""]")
should_apply_transparency = TRUE
apply_colouration(mob_icon) apply_colouration(mob_icon)
//Body markings, actually does not include head this time. Done separately above. //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) if(model)
icon_cache_key += "_model_[model]" icon_cache_key += "_model_[model]"
should_apply_transparency = TRUE
apply_colouration(mob_icon) apply_colouration(mob_icon)
if(owner && owner.synth_markings) if(owner && owner.synth_markings)
for(var/M in markings) for(var/M in markings)
@@ -184,6 +189,9 @@ var/global/list/limb_icon_cache = list()
mob_icon.Blend(limb_icon_cache[cache_key], ICON_OVERLAY) mob_icon.Blend(limb_icon_cache[cache_key], ICON_OVERLAY)
// VOREStation edit ends here // VOREStation edit ends here
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
dir = EAST dir = EAST
icon = mob_icon icon = mob_icon
return mob_icon return mob_icon
@@ -218,9 +226,6 @@ var/global/list/limb_icon_cache = list()
icon_cache_key += "_color_[s_col[1]]_[s_col[2]]_[s_col[3]]_[ICON_ADD]" icon_cache_key += "_color_[s_col[1]]_[s_col[2]]_[s_col[3]]_[ICON_ADD]"
//VOREStation Edit End //VOREStation Edit End
// Translucency.
if(transparent) applying += rgb(,,,180) // SO INTUITIVE TY BYOND //VOREStation Edit
return applying return applying
/obj/item/organ/external/var/icon_cache_key /obj/item/organ/external/var/icon_cache_key

View File

@@ -339,7 +339,7 @@
"<span class='notice'>You make \the [I] kiss \the [src]!.</span>") "<span class='notice'>You make \the [I] kiss \the [src]!.</span>")
return ..() 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 //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()) add_overlay(get_hair_icon())
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 return mob_icon
/obj/item/organ/external/head/skrell /obj/item/organ/external/head/skrell