From 1f9fc0a7fb7bfa98901e1efd0965354aeb787761 Mon Sep 17 00:00:00 2001 From: tigercat2000 Date: Thu, 25 Oct 2018 01:07:27 -0700 Subject: [PATCH] SSoverlays for human icons, mostly works --- .../mob/living/carbon/human/update_icons.dm | 523 ++++++++---------- 1 file changed, 219 insertions(+), 304 deletions(-) diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 8dff1863061..0265723daed 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -110,63 +110,16 @@ Please contact me on #coderbus IRC. ~Carn x var/icon/skeleton var/list/cached_standing_overlays = list() // List of everything currently in a human's actual overlays -//UPDATES OVERLAYS FROM OVERLAYS_LYING/OVERLAYS_STANDING -//this proc is messy as I was forced to include some old laggy cloaking code to it so that I don't break cloakers -//I'll work on removing that stuff by rewriting some of the cloaking stuff at a later date. -/mob/living/carbon/human/update_icons() - var/stealth = 0 - var/obj/item/clothing/suit/armor/abductor/vest/V // Begin the most snowflakey bullshit code I've ever written. I'm so sorry, but there was no other way. +/mob/living/carbon/human/proc/apply_overlay(cache_index) + if((. = overlays_standing[cache_index])) + add_overlay(.) - for(V in list(wear_suit)) - if(V.stealth_active) - stealth = 1 - break +/mob/living/carbon/human/proc/remove_overlay(cache_index) + var/I = overlays_standing[cache_index] + if(I) + cut_overlay(I) + overlays_standing[cache_index] = null - if(stealth) - icon = V.disguise.icon //if the suit is active, reference the suit's current loaded icon and overlays; this does not include hand overlays - overlays.Cut() - cached_standing_overlays.Cut() // Make sure the cache gets rebuilt once the disguise is gone - - for(var/thing in V.disguise.overlays) - if(thing) - overlays += thing - - var/image/I = overlays_standing[L_HAND_LAYER] //manually add both left and right hand, so its independently updated - if(istype(I)) - overlays += I - I = overlays_standing[R_HAND_LAYER] - if(istype(I)) - overlays += I - else - icon = stand_icon - var/list/new_overlays = list() - var/list/old_overlays = cached_standing_overlays - - // Totally regenerate if something touched our overlays - if(overlays.len != old_overlays.len) - overlays.Cut() - old_overlays.Cut() - - for(var/i in 1 to TOTAL_LAYERS) - var/image/I = overlays_standing[i] - if(I) - if(istype(I)) - // Since we avoid full overlay rebuilds, we have to reorganize the layers manually - I.layer = (-2 - (TOTAL_LAYERS - i)) // Highest layer gets -2, each prior layer is 1 lower - new_overlays += I - - update_misc_effects() - if(misc_effect_overlays) - new_overlays += misc_effect_overlays - - if(frozen) // Admin freeze overlay - new_overlays += frozen - - overlays += (new_overlays - old_overlays) - overlays -= (old_overlays - new_overlays) - cached_standing_overlays = new_overlays - - update_transform() var/global/list/damage_icon_parts = list() @@ -185,9 +138,8 @@ var/global/list/damage_icon_parts = list() previous_damage_appearance = damage_appearance - var/icon/standing = new /icon(dna.species.damage_overlays, "00") - - var/image/standing_image = new /image("icon" = standing) + remove_overlay(H_DAMAGE_LAYER) + var/mutable_appearance/standing_image = mutable_appearance(dna.species.damage_overlays, "00", layer = H_DAMAGE_LAYER) // blend the individual damage states with our icons for(var/obj/item/organ/external/O in bodyparts) @@ -205,13 +157,12 @@ var/global/list/damage_icon_parts = list() DI = damage_icon_parts[cache_index] standing_image.overlays += DI - overlays_standing[H_DAMAGE_LAYER] = standing_image + overlays_standing[H_DAMAGE_LAYER] = standing_image + apply_overlay(H_DAMAGE_LAYER) - if(update_icons) update_icons() //BASE MOB SPRITE /mob/living/carbon/human/proc/update_body(var/update_icons=1, var/rebuild_base=0) - var/husk_color_mod = rgb(96,88,80) var/hulk_color_mod = rgb(48,224,40) @@ -228,7 +179,8 @@ var/global/list/damage_icon_parts = list() //Create a new, blank icon for our mob to use. if(stand_icon) qdel(stand_icon) - stand_icon = new(dna.species.icon_template ? dna.species.icon_template : 'icons/mob/human.dmi',"blank") + + stand_icon = new(dna.species.icon_template ? dna.species.icon_template : 'icons/mob/human.dmi', "blank") var/icon_key = "" var/obj/item/organ/internal/eyes/eyes = get_int_organ(/obj/item/organ/internal/eyes) @@ -307,14 +259,15 @@ var/global/list/damage_icon_parts = list() human_icon_cache[icon_key] = base_icon //END CACHED ICON GENERATION. - stand_icon.Blend(base_icon,ICON_OVERLAY) + stand_icon.Blend(base_icon, ICON_OVERLAY) if((!body_accessory || istype(body_accessory, /datum/body_accessory/tail)) && dna.species.bodyflags & TAIL_OVERLAPPED) // If the user's species is flagged to have a tail that needs to be overlapped by limbs... (having a non-tail body accessory like the snake body will override this) - overlays_standing[LIMBS_LAYER] = image(stand_icon) // Diverts limbs to their own layer so they can overlay things (i.e. tails). + overlays_standing[LIMBS_LAYER] = mutable_appearance(stand_icon, layer = LIMBS_LAYER) // Diverts limbs to their own layer so they can overlay things (i.e. tails). + apply_overlay(LIMBS_LAYER) else - overlays_standing[LIMBS_LAYER] = null // So we don't get the old species' sprite splatted on top of the new one's + remove_overlay(LIMBS_LAYER) // So we don't get the old species' sprite splatted on top of the new one's //Underwear - overlays_standing[UNDERWEAR_LAYER] = null + remove_overlay(UNDERWEAR_LAYER) var/icon/underwear_standing = new/icon('icons/mob/underwear.dmi',"nude") if(underwear && dna.species.clothing_flags & HAS_UNDERWEAR) @@ -334,16 +287,13 @@ var/global/list/damage_icon_parts = list() underwear_standing.Blend(new /icon(U3.icon, "sk_[U3.icon_state]_s"), ICON_OVERLAY) if(underwear_standing) - overlays_standing[UNDERWEAR_LAYER] = image(underwear_standing) + overlays_standing[UNDERWEAR_LAYER] = mutable_appearance(underwear_standing, layer = UNDERWEAR_LAYER) - - if(update_icons) - update_icons() + apply_overlay(UNDERWEAR_LAYER) if(lip_style && (LIPS in dna.species.species_traits)) - var/icon/lips = icon("icon"='icons/mob/human_face.dmi', "icon_state"="lips_[lip_style]_s") + var/icon/lips = icon("icon" = 'icons/mob/human_face.dmi', "icon_state" = "lips_[lip_style]_s") lips.Blend(lip_color, ICON_ADD) - stand_icon.Blend(lips, ICON_OVERLAY) //tail @@ -360,10 +310,10 @@ var/global/list/damage_icon_parts = list() //MARKINGS OVERLAY /mob/living/carbon/human/proc/update_markings(var/update_icons=1) //Reset our markings. - overlays_standing[MARKINGS_LAYER] = null + remove_overlay(MARKINGS_LAYER) //Base icon. - var/icon/markings_standing = new/icon('icons/mob/body_accessory.dmi',"accessory_none_s") + var/icon/markings_standing = icon("icon" = 'icons/mob/body_accessory.dmi', "icon_state" = "accessory_none_s") //Body markings. var/obj/item/organ/external/chest/chest_organ = get_organ("chest") @@ -371,7 +321,7 @@ var/global/list/damage_icon_parts = list() var/body_marking = m_styles["body"] var/datum/sprite_accessory/body_marking_style = GLOB.marking_styles_list[body_marking] if(body_marking_style && body_marking_style.species_allowed && (dna.species.name in 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") + var/icon/b_marking_s = icon("icon" = body_marking_style.icon, "icon_state" = "[body_marking_style.icon_state]_s") if(body_marking_style.do_colouration) b_marking_s.Blend(m_colours["body"], ICON_ADD) markings_standing.Blend(b_marking_s, ICON_OVERLAY) @@ -381,33 +331,30 @@ var/global/list/damage_icon_parts = list() var/head_marking = m_styles["head"] var/datum/sprite_accessory/head_marking_style = GLOB.marking_styles_list[head_marking] if(head_marking_style && head_marking_style.species_allowed && (head_organ.dna.species.name in 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") + var/icon/h_marking_s = icon("icon" = head_marking_style.icon, "icon_state" = "[head_marking_style.icon_state]_s") if(head_marking_style.do_colouration) h_marking_s.Blend(m_colours["head"], ICON_ADD) markings_standing.Blend(h_marking_s, ICON_OVERLAY) - overlays_standing[MARKINGS_LAYER] = image(markings_standing) - - if(update_icons) update_icons() + overlays_standing[MARKINGS_LAYER] = mutable_appearance(markings_standing, layer = MARKINGS_LAYER) + apply_overlay(MARKINGS_LAYER) //HEAD ACCESSORY OVERLAY /mob/living/carbon/human/proc/update_head_accessory(var/update_icons=1) //Reset our head accessory - overlays_standing[HEAD_ACCESSORY_LAYER] = null - overlays_standing[HEAD_ACC_OVER_LAYER] = null + remove_overlay(HEAD_ACCESSORY_LAYER) + remove_overlay(HEAD_ACC_OVER_LAYER) var/obj/item/organ/external/head/head_organ = get_organ("head") if(!head_organ) - if(update_icons) update_icons() return //masks and helmets can obscure our head accessory if((head && (head.flags & BLOCKHAIR)) || (wear_mask && (wear_mask.flags & BLOCKHAIR))) - if(update_icons) update_icons() return //base icons - var/icon/head_accessory_standing = new /icon('icons/mob/body_accessory.dmi',"accessory_none_s") + var/icon/head_accessory_standing = new /icon('icons/mob/body_accessory.dmi',"accessory_none_s") if(head_organ.ha_style && (head_organ.dna.species.bodyflags & HAS_HEAD_ACCESSORY)) var/datum/sprite_accessory/head_accessory/head_accessory_style = GLOB.head_accessory_styles_list[head_organ.ha_style] if(head_accessory_style && head_accessory_style.species_allowed) @@ -419,38 +366,33 @@ var/global/list/damage_icon_parts = list() //Having it this way preserves animations. Useful for animated antennae. if(head_accessory_style.over_hair) //Select which layer to use based on the properties of the head accessory style. - overlays_standing[HEAD_ACC_OVER_LAYER] = image(head_accessory_standing) + overlays_standing[HEAD_ACC_OVER_LAYER] = mutable_appearance(head_accessory_standing, layer = HEAD_ACC_OVER_LAYER) + apply_overlay(HEAD_ACC_OVER_LAYER) else - overlays_standing[HEAD_ACCESSORY_LAYER] = image(head_accessory_standing) + overlays_standing[HEAD_ACCESSORY_LAYER] = mutable_appearance(head_accessory_standing, layer = HEAD_ACCESSORY_LAYER) + apply_overlay(HEAD_ACCESSORY_LAYER) else //warning("Invalid ha_style for [species.name]: [ha_style]") - if(update_icons) update_icons() //HAIR OVERLAY /mob/living/carbon/human/proc/update_hair(var/update_icons=1) //Reset our hair - overlays_standing[HAIR_LAYER] = null + remove_overlay(HAIR_LAYER) var/obj/item/organ/external/head/head_organ = get_organ("head") if(!head_organ) - if(update_icons) update_icons() return //masks and helmets can obscure our hair, unless we're a synthetic if((head && (head.flags & BLOCKHAIR)) || (wear_mask && (wear_mask.flags & BLOCKHAIR))) - if(update_icons) update_icons() return //base icons var/icon/hair_standing = new /icon('icons/mob/human_face.dmi',"bald_s") - //var/icon/debrained_s = new /icon("icon"='icons/mob/human_face.dmi', "icon_state" = "debrained_s") - if(head_organ.h_style && !(head && (head.flags & BLOCKHEADHAIR) && !(isSynthetic()))) var/datum/sprite_accessory/hair/hair_style = GLOB.hair_styles_full_list[head_organ.h_style] - //if(!src.get_int_organ(/obj/item/organ/internal/brain) && !ismachine(src))//make it obvious we have NO BRAIN - // hair_standing.Blend(debrained_s, ICON_OVERLAY) if(hair_style && hair_style.species_allowed) if((head_organ.dna.species.name in hair_style.species_allowed) || (head_organ.dna.species.bodyflags & ALL_RPARTS)) //If the head's species is in the list of allowed species for the hairstyle, or the head's species is one flagged to have bodies comprised wholly of cybernetics... var/icon/hair_s = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_s") @@ -471,30 +413,26 @@ var/global/list/damage_icon_parts = list() //warning("Invalid h_style for [species.name]: [h_style]") //hair_standing.Blend(debrained_s, ICON_OVERLAY)//how does i overlay for fish? - overlays_standing[HAIR_LAYER] = image(hair_standing) - - if(update_icons) update_icons() + overlays_standing[HAIR_LAYER] = mutable_appearance(hair_standing, layer = HAIR_LAYER) + apply_overlay(HAIR_LAYER) //FACIAL HAIR OVERLAY /mob/living/carbon/human/proc/update_fhair(var/update_icons=1) //Reset our facial hair - overlays_standing[FHAIR_LAYER] = null - overlays_standing[FHAIR_OVER_LAYER] = null + remove_overlay(FHAIR_LAYER) + remove_overlay(FHAIR_OVER_LAYER) var/obj/item/organ/external/head/head_organ = get_organ("head") if(!head_organ) - if(update_icons) update_icons() return //masks and helmets can obscure our facial hair, unless we're a synthetic if((head && (head.flags & BLOCKHAIR)) || (wear_mask && (wear_mask.flags & BLOCKHAIR))) - if(update_icons) update_icons() return //base icons var/icon/face_standing = new /icon('icons/mob/human_face.dmi',"bald_s") - if(head_organ.f_style) var/datum/sprite_accessory/facial_hair/facial_hair_style = GLOB.facial_hair_styles_list[head_organ.f_style] if(facial_hair_style && facial_hair_style.species_allowed) @@ -514,46 +452,49 @@ var/global/list/damage_icon_parts = list() face_standing.Blend(facial_s, ICON_OVERLAY) if(facial_hair_style.over_hair) //Select which layer to use based on the properties of the facial hair style. - overlays_standing[FHAIR_OVER_LAYER] = image(face_standing) + overlays_standing[FHAIR_OVER_LAYER] = mutable_appearance(face_standing, layer = FHAIR_OVER_LAYER) + apply_overlay(FHAIR_OVER_LAYER) else - overlays_standing[FHAIR_LAYER] = image(face_standing) + overlays_standing[FHAIR_LAYER] = mutable_appearance(face_standing, layer = FHAIR_LAYER) + apply_overlay(FHAIR_LAYER) else //warning("Invalid f_style for [species.name]: [f_style]") - if(update_icons) update_icons() + /mob/living/carbon/human/update_mutations(var/update_icons=1) + remove_overlay(MUTATIONS_LAYER) var/fat if(FAT in mutations) fat = "fat" - var/image/standing = image("icon" = 'icons/effects/genetics.dmi') + var/mutable_appearance/standing = mutable_appearance('icons/effects/genetics.dmi', layer = MUTATIONS_LAYER) var/add_image = 0 var/g = "m" - if(gender == FEMALE) g = "f" + if(gender == FEMALE) + g = "f" // DNA2 - Drawing underlays. for(var/datum/dna/gene/gene in dna_genes) if(!gene.block) continue if(gene.is_active(src)) - var/underlay=gene.OnDrawUnderlays(src,g,fat) + var/underlay = gene.OnDrawUnderlays(src, g, fat) if(underlay) standing.underlays += underlay add_image = 1 for(var/mut in mutations) switch(mut) if(LASER) - standing.overlays += "lasereyes_s" + standing.overlays += "lasereyes_s" add_image = 1 if((COLDRES in mutations) && (HEATRES in mutations)) - standing.underlays -= "cold[fat]_s" - standing.underlays -= "fire[fat]_s" - standing.underlays += "coldfire[fat]_s" + standing.underlays -= "cold[fat]_s" + standing.underlays -= "fire[fat]_s" + standing.underlays += "coldfire[fat]_s" + if(add_image) - overlays_standing[MUTATIONS_LAYER] = standing - else - overlays_standing[MUTATIONS_LAYER] = null - if(update_icons) update_icons() + overlays_standing[MUTATIONS_LAYER] = standing + apply_overlay(MUTATIONS_LAYER) /mob/living/carbon/human/proc/update_mutantrace(var/update_icons=1) @@ -566,17 +507,14 @@ var/global/list/damage_icon_parts = list() update_hair(0) update_fhair(0) - if(update_icons) update_icons() /mob/living/carbon/human/update_fire() + remove_overlay(FIRE_LAYER) if(on_fire) if(!overlays_standing[FIRE_LAYER]) - overlays_standing[FIRE_LAYER] = image("icon"=fire_dmi, "icon_state"=fire_sprite) - update_icons() - else - overlays_standing[FIRE_LAYER] = null - update_icons() + overlays_standing[FIRE_LAYER] = mutable_appearance(fire_dmi, fire_sprite, layer = FIRE_LAYER) + apply_overlay(FIRE_LAYER) /* --------------------------------------- */ //For legacy support. @@ -617,7 +555,7 @@ var/global/list/damage_icon_parts = list() //vvvvvv UPDATE_INV PROCS vvvvvv /mob/living/carbon/human/update_inv_w_uniform(var/update_icons=1) - + remove_overlay(UNIFORM_LAYER) if(client && hud_used) var/obj/screen/inventory/inv = hud_used.inv_slots[slot_w_uniform] if(inv) @@ -630,9 +568,10 @@ var/global/list/damage_icon_parts = list() client.screen += w_uniform //Either way, add the item to the HUD var/t_color = w_uniform.item_color - if(!t_color) t_color = icon_state - var/image/standing = image("icon_state" = "[t_color]_s") + if(!t_color) + t_color = icon_state + var/mutable_appearance/standing = mutable_appearance('icons/mob/uniform.dmi', "[t_color]_s", layer = UNIFORM_LAYER) if(FAT in mutations) if(w_uniform.flags_size & ONESIZEFITSALL) standing.icon = 'icons/mob/uniform_fat.dmi' @@ -640,8 +579,6 @@ var/global/list/damage_icon_parts = list() to_chat(src, "You burst out of \the [w_uniform]!") unEquip(w_uniform) return - else - standing.icon = 'icons/mob/uniform.dmi' if(w_uniform.icon_override) standing.icon = w_uniform.icon_override @@ -650,13 +587,14 @@ var/global/list/damage_icon_parts = list() if(w_uniform.blood_DNA) var/image/bloodsies = image("icon" = dna.species.blood_mask, "icon_state" = "uniformblood") - bloodsies.color = w_uniform.blood_color - standing.overlays += bloodsies + bloodsies.color = w_uniform.blood_color + standing.overlays += bloodsies - if(w_uniform:accessories.len) //WE CHECKED THE TYPE ABOVE. THIS REALLY SHOULD BE FINE. + if(w_uniform:accessories.len) //WE CHECKED THE TYPE ABOVE. THIS REALLY SHOULD BE FINE. // oh my god kys whoever made this if statement jfc :gun: for(var/obj/item/clothing/accessory/A in w_uniform:accessories) var/tie_color = A.item_color - if(!tie_color) tie_color = A.icon_state + if(!tie_color) + tie_color = A.icon_state if(A.icon_override) standing.overlays += image("icon" = A.icon_override, "icon_state" = "[A.icon_state]") else if(A.sprite_sheets && A.sprite_sheets[dna.species.name]) @@ -664,25 +602,24 @@ var/global/list/damage_icon_parts = list() else standing.overlays += image("icon" = 'icons/mob/ties.dmi', "icon_state" = "[tie_color]") - overlays_standing[UNIFORM_LAYER] = standing + overlays_standing[UNIFORM_LAYER] = standing else - overlays_standing[UNIFORM_LAYER] = null // Automatically drop anything in store / id / belt if you're not wearing a uniform. //CHECK IF NECESARRY - for( var/obj/item/thing in list(r_store, l_store, wear_id, wear_pda, belt) ) // - if(thing) // - unEquip(thing) // - if(client) // - client.screen -= thing // - // + for(var/obj/item/thing in list(r_store, l_store, wear_id, wear_pda, belt)) // whoever made this + if(thing) // you're a piece of fucking garbage + unEquip(thing) // why the fuck would you goddamn do this motherfucking shit + if(client) // INVENTORY CODE IN FUCKING ICON CODE + client.screen -= thing // WHAT THE FUCKING FUCK BAY GODDAMNIT + // **I FUCKING HATE YOU AAAAAAAAAA** if(thing) // thing.loc = loc // thing.dropped(src) // thing.layer = initial(thing.layer) thing.plane = initial(thing.plane) - if(update_icons) update_icons() + apply_overlay(UNIFORM_LAYER) /mob/living/carbon/human/update_inv_wear_id(var/update_icons=1) - + remove_overlay(ID_LAYER) if(client && hud_used) var/obj/screen/inventory/inv = hud_used.inv_slots[slot_wear_id] if(inv) @@ -694,16 +631,11 @@ var/global/list/damage_icon_parts = list() client.screen += wear_id if(w_uniform && w_uniform:displays_id) - overlays_standing[ID_LAYER] = image("icon" = 'icons/mob/mob.dmi', "icon_state" = "id") - else - overlays_standing[ID_LAYER] = null - else - overlays_standing[ID_LAYER] = null - - if(update_icons) update_icons() + overlays_standing[ID_LAYER] = mutable_appearance('icons/mob/mob.dmi', "id", layer = ID_LAYER) + apply_overlay(ID_LAYER) /mob/living/carbon/human/update_inv_gloves(var/update_icons=1) - + remove_overlay(GLOVES_LAYER) if(client && hud_used) var/obj/screen/inventory/inv = hud_used.inv_slots[slot_gloves] if(inv) @@ -718,32 +650,30 @@ var/global/list/damage_icon_parts = list() var/t_state = gloves.item_state if(!t_state) t_state = gloves.icon_state - var/image/standing + var/mutable_appearance/standing if(gloves.icon_override) - standing = image("icon" = gloves.icon_override, "icon_state" = "[t_state]") + standing = mutable_appearance(gloves.icon_override, "[t_state]", layer = GLOVES_LAYER) else if(gloves.sprite_sheets && gloves.sprite_sheets[dna.species.name]) - standing = image("icon" = gloves.sprite_sheets[dna.species.name], "icon_state" = "[t_state]") + standing = mutable_appearance(gloves.sprite_sheets[dna.species.name], "[t_state]", layer = GLOVES_LAYER) else - standing = image("icon" = 'icons/mob/hands.dmi', "icon_state" = "[t_state]") + standing = mutable_appearance('icons/mob/hands.dmi', "[t_state]", layer = GLOVES_LAYER) if(gloves.blood_DNA) var/image/bloodsies = image("icon" = dna.species.blood_mask, "icon_state" = "bloodyhands") bloodsies.color = gloves.blood_color - standing.overlays += bloodsies + standing.overlays += bloodsies overlays_standing[GLOVES_LAYER] = standing else if(blood_DNA) - var/image/bloodsies = image("icon" = dna.species.blood_mask, "icon_state" = "bloodyhands") + var/mutable_appearance/bloodsies = mutable_appearance(dna.species.blood_mask, "bloodyhands", layer = GLOVES_LAYER) bloodsies.color = hand_blood_color overlays_standing[GLOVES_LAYER] = bloodsies - else - overlays_standing[GLOVES_LAYER] = null - if(update_icons) update_icons() + apply_overlay(GLOVES_LAYER) /mob/living/carbon/human/update_inv_glasses(var/update_icons=1) - overlays_standing[GLASSES_LAYER] = null - overlays_standing[GLASSES_OVER_LAYER] = null + remove_overlay(GLASSES_LAYER) + remove_overlay(GLASSES_OVER_LAYER) if(client && hud_used) var/obj/screen/inventory/inv = hud_used.inv_slots[slot_glasses] @@ -751,7 +681,7 @@ var/global/list/damage_icon_parts = list() inv.update_icon() if(glasses) - var/image/new_glasses + var/mutable_appearance/new_glasses var/obj/item/organ/external/head/head_organ = get_organ("head") if(client && hud_used && hud_used.hud_shown) if(hud_used.inventory_shown) //if the inventory is open ... @@ -759,22 +689,23 @@ var/global/list/damage_icon_parts = list() client.screen += glasses //Either way, add the item to the HUD if(glasses.icon_override) - new_glasses = image("icon" = glasses.icon_override, "icon_state" = "[glasses.icon_state]") + new_glasses = mutable_appearance(glasses.icon_override, "[glasses.icon_state]", layer = GLASSES_LAYER) else if(glasses.sprite_sheets && glasses.sprite_sheets[head_organ.dna.species.name]) - new_glasses = image("icon" = glasses.sprite_sheets[head_organ.dna.species.name], "icon_state" = "[glasses.icon_state]") + new_glasses = mutable_appearance(glasses.sprite_sheets[head_organ.dna.species.name], "[glasses.icon_state]", layer = GLASSES_LAYER) else - new_glasses = image("icon" = 'icons/mob/eyes.dmi', "icon_state" = "[glasses.icon_state]") + new_glasses = mutable_appearance('icons/mob/eyes.dmi', "[glasses.icon_state]", layer = GLASSES_LAYER) var/datum/sprite_accessory/hair/hair_style = GLOB.hair_styles_full_list[head_organ.h_style] if(hair_style && hair_style.glasses_over) //Select which layer to use based on the properties of the hair style. Hair styles with hair that don't overhang the arms of the glasses should have glasses_over set to a positive value. + new_glasses.layer = -GLASSES_OVER_LAYER overlays_standing[GLASSES_OVER_LAYER] = new_glasses + apply_overlay(GLASSES_OVER_LAYER) else overlays_standing[GLASSES_LAYER] = new_glasses - - if(update_icons) update_icons() + apply_overlay(GLASSES_LAYER) /mob/living/carbon/human/update_inv_ears(var/update_icons=1) - + remove_overlay(EARS_LAYER) if(client && hud_used) var/obj/screen/inventory/inv = hud_used.inv_slots[slot_l_ear] if(inv) @@ -795,12 +726,12 @@ var/global/list/damage_icon_parts = list() var/t_type = l_ear.icon_state if(l_ear.icon_override) t_type = "[t_type]_l" - overlays_standing[EARS_LAYER] = image("icon" = l_ear.icon_override, "icon_state" = "[t_type]") + overlays_standing[EARS_LAYER] = mutable_appearance(l_ear.icon_override, "[t_type]", layer = EARS_LAYER) else if(l_ear.sprite_sheets && l_ear.sprite_sheets[dna.species.name]) t_type = "[t_type]_l" - overlays_standing[EARS_LAYER] = image("icon" = l_ear.sprite_sheets[dna.species.name], "icon_state" = "[t_type]") + overlays_standing[EARS_LAYER] = mutable_appearance(l_ear.sprite_sheets[dna.species.name], "[t_type]", layer = EARS_LAYER) else - overlays_standing[EARS_LAYER] = image("icon" = 'icons/mob/ears.dmi', "icon_state" = "[t_type]") + overlays_standing[EARS_LAYER] = mutable_appearance('icons/mob/ears.dmi', "[t_type]", layer = EARS_LAYER) if(r_ear) if(client && hud_used && hud_used.hud_shown) @@ -811,19 +742,16 @@ var/global/list/damage_icon_parts = list() var/t_type = r_ear.icon_state if(r_ear.icon_override) t_type = "[t_type]_r" - overlays_standing[EARS_LAYER] = image("icon" = r_ear.icon_override, "icon_state" = "[t_type]") + overlays_standing[EARS_LAYER] = mutable_appearance(r_ear.icon_override, "[t_type]", layer = EARS_LAYER) else if(r_ear.sprite_sheets && r_ear.sprite_sheets[dna.species.name]) t_type = "[t_type]_r" - overlays_standing[EARS_LAYER] = image("icon" = r_ear.sprite_sheets[dna.species.name], "icon_state" = "[t_type]") + overlays_standing[EARS_LAYER] = mutable_appearance(r_ear.sprite_sheets[dna.species.name], "[t_type]", layer = EARS_LAYER) else - overlays_standing[EARS_LAYER] = image("icon" = 'icons/mob/ears.dmi', "icon_state" = "[t_type]") - - else - overlays_standing[EARS_LAYER] = null - if(update_icons) update_icons() + overlays_standing[EARS_LAYER] = mutable_appearance('icons/mob/ears.dmi', "[t_type]", layer = EARS_LAYER) + apply_overlay(EARS_LAYER) /mob/living/carbon/human/update_inv_shoes(var/update_icons=1) - + remove_overlay(SHOES_LAYER) if(client && hud_used) var/obj/screen/inventory/inv = hud_used.inv_slots[slot_shoes] if(inv) @@ -835,13 +763,13 @@ var/global/list/damage_icon_parts = list() shoes.screen_loc = ui_shoes //...draw the item in the inventory screen client.screen += shoes //Either way, add the item to the HUD - var/image/standing + var/mutable_appearance/standing if(shoes.icon_override) - standing = image("icon" = shoes.icon_override, "icon_state" = "[shoes.icon_state]") + standing = mutable_appearance(shoes.icon_override, "[shoes.icon_state]", layer = SHOES_LAYER) else if(shoes.sprite_sheets && shoes.sprite_sheets[dna.species.name]) - standing = image("icon" = shoes.sprite_sheets[dna.species.name], "icon_state" = "[shoes.icon_state]") + standing = mutable_appearance(shoes.sprite_sheets[dna.species.name], "[shoes.icon_state]", layer = SHOES_LAYER) else - standing = image("icon" = 'icons/mob/feet.dmi', "icon_state" = "[shoes.icon_state]") + standing = mutable_appearance('icons/mob/feet.dmi', "[shoes.icon_state]", layer = SHOES_LAYER) if(shoes.blood_DNA) @@ -851,15 +779,13 @@ var/global/list/damage_icon_parts = list() overlays_standing[SHOES_LAYER] = standing else if(feet_blood_DNA) - var/image/bloodsies = image("icon" = dna.species.blood_mask, "icon_state" = "shoeblood") + var/mutable_appearance/bloodsies = mutable_appearance(dna.species.blood_mask, "shoeblood", layer = SHOES_LAYER) bloodsies.color = feet_blood_color overlays_standing[SHOES_LAYER] = bloodsies - else - overlays_standing[SHOES_LAYER] = null - if(update_icons) update_icons() + apply_overlay(SHOES_LAYER) /mob/living/carbon/human/update_inv_s_store(var/update_icons=1) - + remove_overlay(SUIT_STORE_LAYER) if(client && hud_used) var/obj/screen/inventory/inv = hud_used.inv_slots[slot_s_store] if(inv) @@ -874,42 +800,37 @@ var/global/list/damage_icon_parts = list() if(!t_state) t_state = s_store.icon_state var/dmi='icons/mob/belt_mirror.dmi' - overlays_standing[SUIT_STORE_LAYER] = image("icon" = dmi, "icon_state" = "[t_state]") + overlays_standing[SUIT_STORE_LAYER] = mutable_appearance(dmi, "[t_state]", layer = SUIT_STORE_LAYER) s_store.screen_loc = ui_sstore1 //TODO - else - overlays_standing[SUIT_STORE_LAYER] = null - if(update_icons) update_icons() + apply_overlay(SUIT_STORE_LAYER) /mob/living/carbon/human/update_inv_head(var/update_icons=1) ..() + remove_overlay(HEAD_LAYER) if(client && hud_used) var/obj/screen/inventory/inv = hud_used.inv_slots[slot_head] if(inv) inv.update_icon() if(head) - var/image/standing + var/mutable_appearance/standing if(head.icon_override) - standing = image("icon" = head.icon_override, "icon_state" = "[head.icon_state]") + standing = mutable_appearance(head.icon_override, "[head.icon_state]", layer = HEAD_LAYER) else if(head.sprite_sheets && head.sprite_sheets[dna.species.name]) - standing = image("icon" = head.sprite_sheets[dna.species.name], "icon_state" = "[head.icon_state]") + standing = mutable_appearance(head.sprite_sheets[dna.species.name], "[head.icon_state]", layer = HEAD_LAYER) else - standing = image("icon" = 'icons/mob/head.dmi', "icon_state" = "[head.icon_state]") + standing = mutable_appearance('icons/mob/head.dmi', "[head.icon_state]", layer = HEAD_LAYER) if(head.blood_DNA) var/image/bloodsies = image("icon" = dna.species.blood_mask, "icon_state" = "helmetblood") bloodsies.color = head.blood_color - standing.overlays += bloodsies - overlays_standing[HEAD_LAYER] = standing - - - else - overlays_standing[HEAD_LAYER] = null - if(update_icons) update_icons() + standing.overlays += bloodsies + overlays_standing[HEAD_LAYER] = standing + apply_overlay(HEAD_LAYER) /mob/living/carbon/human/update_inv_belt(var/update_icons=1) - + remove_overlay(BELT_LAYER) if(client && hud_used) var/obj/screen/inventory/inv = hud_used.inv_slots[slot_belt] if(inv) @@ -921,21 +842,21 @@ var/global/list/damage_icon_parts = list() if(belt) var/t_state = belt.item_state - if(!t_state) t_state = belt.icon_state + if(!t_state) + t_state = belt.icon_state if(belt.icon_override) t_state = "[t_state]_be" - overlays_standing[BELT_LAYER] = image("icon" = belt.icon_override, "icon_state" = "[t_state]") + overlays_standing[BELT_LAYER] = mutable_appearance(belt.icon_override, "[t_state]", layer = BELT_LAYER) else if(belt.sprite_sheets && belt.sprite_sheets[dna.species.name]) - overlays_standing[BELT_LAYER] = image("icon" = belt.sprite_sheets[dna.species.name], "icon_state" = "[t_state]") + overlays_standing[BELT_LAYER] = mutable_appearance(belt.sprite_sheets[dna.species.name], "[t_state]", layer = BELT_LAYER) else - overlays_standing[BELT_LAYER] = image("icon" = 'icons/mob/belt.dmi', "icon_state" = "[t_state]") - else - overlays_standing[BELT_LAYER] = null - if(update_icons) update_icons() + overlays_standing[BELT_LAYER] = mutable_appearance('icons/mob/belt.dmi', "[t_state]", layer = BELT_LAYER) + apply_overlay(BELT_LAYER) /mob/living/carbon/human/update_inv_wear_suit(var/update_icons=1) + remove_overlay(SUIT_LAYER) if(client && hud_used) var/obj/screen/inventory/inv = hud_used.inv_slots[slot_wear_suit] if(inv) @@ -947,47 +868,37 @@ var/global/list/damage_icon_parts = list() wear_suit.screen_loc = ui_oclothing //TODO //...draw the item in the inventory screen client.screen += wear_suit //Either way, add the item to the HUD - var/image/standing + var/mutable_appearance/standing if(wear_suit.icon_override) - standing = image("icon" = wear_suit.icon_override, "icon_state" = "[wear_suit.icon_state]") + standing = mutable_appearance(wear_suit.icon_override, "[wear_suit.icon_state]", layer = SUIT_LAYER) else if(wear_suit.sprite_sheets && wear_suit.sprite_sheets[dna.species.name]) - standing = image("icon" = wear_suit.sprite_sheets[dna.species.name], "icon_state" = "[wear_suit.icon_state]") + standing = mutable_appearance(wear_suit.sprite_sheets[dna.species.name], "[wear_suit.icon_state]", layer = SUIT_LAYER) else if(FAT in mutations) if(wear_suit.flags_size & ONESIZEFITSALL) - standing = image("icon" = 'icons/mob/suit_fat.dmi', "icon_state" = "[wear_suit.icon_state]") + standing = mutable_appearance('icons/mob/suit_fat.dmi', "[wear_suit.icon_state]", layer = SUIT_LAYER) else to_chat(src, "You burst out of \the [wear_suit]!") unEquip(wear_suit) return else - standing = image("icon" = 'icons/mob/suit.dmi', "icon_state" = "[wear_suit.icon_state]") - + standing = mutable_appearance('icons/mob/suit.dmi', "[wear_suit.icon_state]", layer = SUIT_LAYER) if(wear_suit.breakouttime) drop_l_hand() drop_r_hand() - if(wear_suit.blood_DNA) var/obj/item/clothing/suit/S = wear_suit var/image/bloodsies = image("icon" = dna.species.blood_mask, "icon_state" = "[S.blood_overlay_type]blood") bloodsies.color = wear_suit.blood_color - standing.overlays += bloodsies + standing.overlays += bloodsies + overlays_standing[SUIT_LAYER] = standing - overlays_standing[SUIT_LAYER] = standing - - update_tail_layer(0) - - else - overlays_standing[SUIT_LAYER] = null - - update_tail_layer(0) - + apply_overlay(SUIT_LAYER) + update_tail_layer(0) update_collar(0) - if(update_icons) update_icons() - /mob/living/carbon/human/update_inv_pockets() if(client && hud_used) var/obj/screen/inventory/inv @@ -1021,6 +932,7 @@ var/global/list/damage_icon_parts = list() /mob/living/carbon/human/update_inv_wear_mask(var/update_icons = 1) ..() + remove_overlay(FACEMASK_LAYER) if(client && hud_used) var/obj/screen/inventory/inv = hud_used.inv_slots[slot_wear_mask] if(inv) @@ -1031,107 +943,94 @@ var/global/list/damage_icon_parts = list() if(head_organ.alt_head && head_organ.alt_head != "None") alternate_head = GLOB.alt_heads_list[head_organ.alt_head] - var/image/standing + var/mutable_appearance/standing var/icon/mask_icon = new(wear_mask.icon) if(wear_mask.icon_override) mask_icon = new(wear_mask.icon_override) - standing = image("icon" = wear_mask.icon_override, "icon_state" = "[wear_mask.icon_state][(alternate_head && ("[wear_mask.icon_state]_[alternate_head.suffix]" in mask_icon.IconStates())) ? "_[alternate_head.suffix]" : ""]") + standing = mutable_appearance(wear_mask.icon_override, "[wear_mask.icon_state][(alternate_head && ("[wear_mask.icon_state]_[alternate_head.suffix]" in mask_icon.IconStates())) ? "_[alternate_head.suffix]" : ""]", layer = FACEMASK_LAYER) else if(wear_mask.sprite_sheets && wear_mask.sprite_sheets[dna.species.name]) mask_icon = new(wear_mask.sprite_sheets[dna.species.name]) - standing = image("icon" = wear_mask.sprite_sheets[dna.species.name], "icon_state" = "[wear_mask.icon_state][(alternate_head && ("[wear_mask.icon_state]_[alternate_head.suffix]" in mask_icon.IconStates())) ? "_[alternate_head.suffix]" : ""]") + standing = mutable_appearance(wear_mask.sprite_sheets[dna.species.name], "[wear_mask.icon_state][(alternate_head && ("[wear_mask.icon_state]_[alternate_head.suffix]" in mask_icon.IconStates())) ? "_[alternate_head.suffix]" : ""]", layer = FACEMASK_LAYER) else - standing = image("icon" = 'icons/mob/mask.dmi', "icon_state" = "[wear_mask.icon_state][(alternate_head && ("[wear_mask.icon_state]_[alternate_head.suffix]" in mask_icon.IconStates())) ? "_[alternate_head.suffix]" : ""]") + standing = mutable_appearance('icons/mob/mask.dmi', "[wear_mask.icon_state][(alternate_head && ("[wear_mask.icon_state]_[alternate_head.suffix]" in mask_icon.IconStates())) ? "_[alternate_head.suffix]" : ""]", layer = FACEMASK_LAYER) if(!istype(wear_mask, /obj/item/clothing/mask/cigarette) && wear_mask.blood_DNA) var/image/bloodsies = image("icon" = dna.species.blood_mask, "icon_state" = "maskblood") bloodsies.color = wear_mask.blood_color standing.overlays += bloodsies - overlays_standing[FACEMASK_LAYER] = standing - else - overlays_standing[FACEMASK_LAYER] = null - if(update_icons) update_icons() + overlays_standing[FACEMASK_LAYER] = standing + apply_overlay(FACEMASK_LAYER) /mob/living/carbon/human/update_inv_back(var/update_icons=1) ..() + remove_overlay(BACK_LAYER) if(back) //determine the icon to use - var/icon/standing + var/mutable_appearance/standing if(back.icon_override) - standing = image("icon" = back.icon_override, "icon_state" = "[back.icon_state]") + standing = mutable_appearance(back.icon_override, "[back.icon_state]", layer = BACK_LAYER) else if(istype(back, /obj/item/rig)) //If this is a rig and a mob_icon is set, it will take species into account in the rig update_icon() proc. var/obj/item/rig/rig = back standing = rig.mob_icon else if(back.sprite_sheets && back.sprite_sheets[dna.species.name]) - standing = image("icon" = back.sprite_sheets[dna.species.name], "icon_state" = "[back.icon_state]") + standing = mutable_appearance(back.sprite_sheets[dna.species.name], "[back.icon_state]", layer = BACK_LAYER) else - standing = image("icon" = 'icons/mob/back.dmi', "icon_state" = "[back.icon_state]") + standing = mutable_appearance('icons/mob/back.dmi', "[back.icon_state]", layer = BACK_LAYER) //create the image overlays_standing[BACK_LAYER] = standing - else - overlays_standing[BACK_LAYER] = null - - if(update_icons) update_icons() + apply_overlay(BACK_LAYER) /mob/living/carbon/human/update_inv_handcuffed(var/update_icons=1) - overlays_standing[HANDCUFF_LAYER] = null + remove_overlay(HANDCUFF_LAYER) if(handcuffed) if(istype(handcuffed, /obj/item/restraints/handcuffs/pinkcuffs)) - overlays_standing[HANDCUFF_LAYER] = image("icon" = 'icons/mob/mob.dmi', "icon_state" = "pinkcuff1") + overlays_standing[HANDCUFF_LAYER] = mutable_appearance('icons/mob/mob.dmi', "pinkcuff1", layer = HANDCUFF_LAYER) else - overlays_standing[HANDCUFF_LAYER] = image("icon" = 'icons/mob/mob.dmi', "icon_state" = "handcuff1") - - if(update_icons) - update_icons() + overlays_standing[HANDCUFF_LAYER] = mutable_appearance('icons/mob/mob.dmi', "handcuff1", layer = HANDCUFF_LAYER) + apply_overlay(HANDCUFF_LAYER) /mob/living/carbon/human/update_inv_legcuffed(var/update_icons=1) + remove_overlay(LEGCUFF_LAYER) clear_alert("legcuffed") if(legcuffed) - overlays_standing[LEGCUFF_LAYER] = image("icon" = 'icons/mob/mob.dmi', "icon_state" = "legcuff1") + overlays_standing[LEGCUFF_LAYER] = mutable_appearance('icons/mob/mob.dmi', "legcuff1", layer = LEGCUFF_LAYER) throw_alert("legcuffed", /obj/screen/alert/restrained/legcuffed, new_master = legcuffed) if(m_intent != MOVE_INTENT_WALK) m_intent = MOVE_INTENT_WALK if(hud_used && hud_used.move_intent) hud_used.move_intent.icon_state = "walking" - - else - overlays_standing[LEGCUFF_LAYER] = null - if(update_icons) - update_icons() + apply_overlay(LEGCUFF_LAYER) /mob/living/carbon/human/update_inv_r_hand(var/update_icons=1) ..() + remove_overlay(R_HAND_LAYER) if(r_hand) var/t_state = r_hand.item_state if(!t_state) t_state = r_hand.icon_state - var/image/I = image("icon" = r_hand.righthand_file, "icon_state" = "[t_state]") + var/mutable_appearance/I = mutable_appearance(r_hand.righthand_file, "[t_state]", layer = R_HAND_LAYER) I = center_image(I, r_hand.inhand_x_dimension, r_hand.inhand_y_dimension) overlays_standing[R_HAND_LAYER] = I - else - overlays_standing[R_HAND_LAYER] = null - if(update_icons) - update_icons() + apply_overlay(R_HAND_LAYER) /mob/living/carbon/human/update_inv_l_hand(var/update_icons=1) ..() + remove_overlay(L_HAND_LAYER) if(l_hand) var/t_state = l_hand.item_state if(!t_state) t_state = l_hand.icon_state - var/image/I = image("icon" = l_hand.lefthand_file, "icon_state" = "[t_state]") + var/mutable_appearance/I = mutable_appearance(l_hand.lefthand_file, "[t_state]", layer = L_HAND_LAYER) I = center_image(I, l_hand.inhand_x_dimension, l_hand.inhand_y_dimension) overlays_standing[L_HAND_LAYER] = I - else - overlays_standing[L_HAND_LAYER] = null - if(update_icons) - update_icons() + apply_overlay(L_HAND_LAYER) //human HUD updates for items in our inventory @@ -1157,10 +1056,11 @@ var/global/list/damage_icon_parts = list() /mob/living/carbon/human/proc/update_tail_layer(var/update_icons=1) - overlays_standing[TAIL_UNDERLIMBS_LAYER] = null // SEW direction icons, overlayed by LIMBS_LAYER. - overlays_standing[TAIL_LAYER] = null /* This will be one of two things: - If the species' tail is overlapped by limbs, this will be only the N direction icon so tails can still appear on the outside of uniforms and such. - Otherwise, since the user's tail isn't overlapped by limbs, it will be a full icon with all directions. */ + remove_overlay(TAIL_UNDERLIMBS_LAYER) // SEW direction icons, overlayed by LIMBS_LAYER. + remove_overlay(TAIL_LAYER) /* This will be one of two things: + If the species' tail is overlapped by limbs, this will be only the N direction icon so tails + can still appear on the outside of uniforms and such. + Otherwise, since the user's tail isn't overlapped by limbs, it will be a full icon with all directions. */ var/icon/tail_marking_icon var/datum/sprite_accessory/body_markings/tail/tail_marking_style @@ -1184,16 +1084,25 @@ var/global/list/damage_icon_parts = list() under.Insert(new/icon(accessory_s, dir=EAST), dir=EAST) under.Insert(new/icon(accessory_s, dir=WEST), dir=WEST) - overlays_standing[TAIL_UNDERLIMBS_LAYER] = image(under, "pixel_x" = body_accessory.pixel_x_offset, "pixel_y" = body_accessory.pixel_y_offset) + var/mutable_appearance/underlimbs = mutable_appearance(under, layer = TAIL_UNDERLIMBS_LAYER) + underlimbs.pixel_x = body_accessory.pixel_x_offset + underlimbs.pixel_y = body_accessory.pixel_y_offset + overlays_standing[TAIL_UNDERLIMBS_LAYER] = underlimbs // Creates a blank icon, and copies accessory_s' north direction sprite into it // before passing that to the tail layer that overlays uniforms and such. var/icon/over = new/icon("icon" = 'icons/mob/body_accessory.dmi', "icon_state" = "accessory_none_s") over.Insert(new/icon(accessory_s, dir=NORTH), dir=NORTH) - overlays_standing[TAIL_LAYER] = image(over, "pixel_x" = body_accessory.pixel_x_offset, "pixel_y" = body_accessory.pixel_y_offset) + var/mutable_appearance/tail = mutable_appearance(over, layer = TAIL_LAYER) + tail.pixel_x = body_accessory.pixel_x_offset + tail.pixel_y = body_accessory.pixel_y_offset + overlays_standing[TAIL_LAYER] = tail else // Otherwise, since the user's tail isn't overlapped by limbs, go ahead and use default icon generation. - overlays_standing[TAIL_LAYER] = image(accessory_s, "pixel_x" = body_accessory.pixel_x_offset, "pixel_y" = body_accessory.pixel_y_offset) + var/mutable_appearance/tail = mutable_appearance(accessory_s, layer = TAIL_LAYER) + tail.pixel_x = body_accessory.pixel_x_offset + tail.pixel_y = body_accessory.pixel_y_offset + overlays_standing[TAIL_LAYER] = tail else if(tail && dna.species.bodyflags & HAS_TAIL) //no tailless tajaran if(!wear_suit || !(wear_suit.flags_inv & HIDETAIL) && !istype(wear_suit, /obj/item/clothing/suit/space)) @@ -1209,25 +1118,24 @@ var/global/list/damage_icon_parts = list() under.Insert(new/icon(tail_s, dir=EAST), dir=EAST) under.Insert(new/icon(tail_s, dir=WEST), dir=WEST) - overlays_standing[TAIL_UNDERLIMBS_LAYER] = image(under) + overlays_standing[TAIL_UNDERLIMBS_LAYER] = mutable_appearance(under, layer = TAIL_UNDERLIMBS_LAYER) // Creates a blank icon, and copies accessory_s' north direction sprite into it before passing that to the tail layer that overlays uniforms and such. var/icon/over = new/icon("icon" = 'icons/effects/species.dmi', "icon_state" = "blank") over.Insert(new/icon(tail_s, dir=NORTH), dir=NORTH) - overlays_standing[TAIL_LAYER] = image(over) + overlays_standing[TAIL_LAYER] = mutable_appearance(over, layer = TAIL_LAYER) else // Otherwise, since the user's tail isn't overlapped by limbs, go ahead and use default icon generation. - overlays_standing[TAIL_LAYER] = image(tail_s) - - if(update_icons) - update_icons() - + overlays_standing[TAIL_LAYER] = mutable_appearance(tail_s, layer = TAIL_LAYER) + apply_overlay(TAIL_LAYER) + apply_overlay(TAIL_UNDERLIMBS_LAYER) /mob/living/carbon/human/proc/start_tail_wagging(var/update_icons=1) - overlays_standing[TAIL_UNDERLIMBS_LAYER] = null // SEW direction icons, overlayed by LIMBS_LAYER. - overlays_standing[TAIL_LAYER] = null /* This will be one of two things: - If the species' tail is overlapped by limbs, this will be only the N direction icon so tails can still appear on the outside of uniforms and such. - Otherwise, since the user's tail isn't overlapped by limbs, it will be a full icon with all directions. */ + remove_overlay(TAIL_UNDERLIMBS_LAYER) // SEW direction icons, overlayed by LIMBS_LAYER. + remove_overlay(TAIL_LAYER) /* This will be one of two things: + If the species' tail is overlapped by limbs, this will be only the N direction icon so tails + can still appear on the outside of uniforms and such. + Otherwise, since the user's tail isn't overlapped by limbs, it will be a full icon with all directions. */ var/icon/tail_marking_icon var/datum/sprite_accessory/body_markings/tail/tail_marking_style @@ -1252,7 +1160,10 @@ var/global/list/damage_icon_parts = list() under.Insert(new/icon(accessory_s, dir=EAST), dir=EAST) under.Insert(new/icon(accessory_s, dir=WEST), dir=WEST) - overlays_standing[TAIL_UNDERLIMBS_LAYER] = image(under, "pixel_x" = body_accessory.pixel_x_offset, "pixel_y" = body_accessory.pixel_y_offset) + var/mutable_appearance/underlimbs = mutable_appearance(under, layer = TAIL_UNDERLIMBS_LAYER) + underlimbs.pixel_x = body_accessory.pixel_x_offset + underlimbs.pixel_y = body_accessory.pixel_y_offset + overlays_standing[TAIL_UNDERLIMBS_LAYER] = underlimbs // Creates a blank icon, and copies accessory_s' north direction sprite into it before passing that to the tail layer that overlays uniforms and such. var/icon/over = new/icon("icon" = 'icons/effects/species.dmi', "icon_state" = "Vulpkanin_tail_delay") @@ -1260,9 +1171,15 @@ var/global/list/damage_icon_parts = list() over = new/icon("icon" = 'icons/effects/species.dmi', "icon_state" = "[dna.species.name]_tail_delay") over.Insert(new/icon(accessory_s, dir=NORTH), dir=NORTH) - overlays_standing[TAIL_LAYER] = image(over, "pixel_x" = body_accessory.pixel_x_offset, "pixel_y" = body_accessory.pixel_y_offset) + var/mutable_appearance/tail = mutable_appearance(over, layer = TAIL_LAYER) + tail.pixel_x = body_accessory.pixel_x_offset + tail.pixel_y = body_accessory.pixel_y_offset + overlays_standing[TAIL_LAYER] = tail else // Otherwise, since the user's tail isn't overlapped by limbs, go ahead and use default icon generation. - overlays_standing[TAIL_LAYER] = image(accessory_s, "pixel_x" = body_accessory.pixel_x_offset, "pixel_y" = body_accessory.pixel_y_offset) + var/mutable_appearance/tail = mutable_appearance(accessory_s, layer = TAIL_LAYER) + tail.pixel_x = body_accessory.pixel_x_offset + tail.pixel_y = body_accessory.pixel_y_offset + overlays_standing[TAIL_LAYER] = tail else if(tail && dna.species.bodyflags & HAS_TAIL) var/icon/tailw_s = new/icon("icon" = 'icons/effects/species.dmi', "icon_state" = "[tail]w_s") @@ -1277,23 +1194,21 @@ var/global/list/damage_icon_parts = list() under.Insert(new/icon(tailw_s, dir=EAST), dir=EAST) under.Insert(new/icon(tailw_s, dir=WEST), dir=WEST) - overlays_standing[TAIL_UNDERLIMBS_LAYER] = image(under) + overlays_standing[TAIL_UNDERLIMBS_LAYER] = mutable_appearance(under, layer = TAIL_UNDERLIMBS_LAYER) // Creates a blank icon, and copies accessory_s' north direction sprite into it before passing that to the tail layer that overlays uniforms and such. var/icon/over = new/icon("icon" = 'icons/effects/species.dmi', "icon_state" = "[dna.species.name]_tail_delay") over.Insert(new/icon(tailw_s, dir=NORTH), dir=NORTH) - overlays_standing[TAIL_LAYER] = image(over) + overlays_standing[TAIL_LAYER] = mutable_appearance(over, layer = TAIL_LAYER) else // Otherwise, since the user's tail isn't overlapped by limbs, go ahead and use default icon generation. - overlays_standing[TAIL_LAYER] = image(tailw_s) - - if(update_icons) - update_icons() + overlays_standing[TAIL_LAYER] = mutable_appearance(tailw_s, layer = TAIL_LAYER) + apply_overlay(TAIL_LAYER) + apply_overlay(TAIL_UNDERLIMBS_LAYER) /mob/living/carbon/human/proc/stop_tail_wagging(var/update_icons=1) - overlays_standing[TAIL_UNDERLIMBS_LAYER] = null - overlays_standing[TAIL_LAYER] = null - + remove_overlay(TAIL_UNDERLIMBS_LAYER) + remove_overlay(TAIL_LAYER) update_tail_layer(update_icons) //just trigger a full update for normal stationary sprites /mob/living/carbon/human/handle_transform_change() @@ -1304,8 +1219,9 @@ var/global/list/damage_icon_parts = list() // Suit needs an identically named sprite in icons/mob/collar.dmi // For suits with species_fit and sprite_sheets, an identically named sprite needs to exist in a file like this icons/mob/species/[species_name_here]/collar.dmi. /mob/living/carbon/human/proc/update_collar(var/update_icons=1) + remove_overlay(COLLAR_LAYER) var/icon/C = new('icons/mob/collar.dmi') - var/image/standing = null + var/mutable_appearance/standing = null if(wear_suit) if(wear_suit.icon_override) @@ -1314,21 +1230,20 @@ var/global/list/damage_icon_parts = list() if(fexists(icon_path)) //Just ensuring the nonexistance of a file with the above path won't cause a runtime. var/icon/icon_file = new(icon_path) if(wear_suit.icon_state in icon_file.IconStates()) - standing = image("icon" = icon_file, "icon_state" = "[wear_suit.icon_state]") + standing = mutable_appearance(icon_file, "[wear_suit.icon_state]", layer = COLLAR_LAYER) else if(wear_suit.sprite_sheets && wear_suit.sprite_sheets[dna.species.name]) var/icon_path = "[wear_suit.sprite_sheets[dna.species.name]]" icon_path = "[copytext(icon_path, 1, findtext(icon_path, "/suit.dmi"))]/collar.dmi" //If this file doesn't exist, the end result is that COLLAR_LAYER will be unchanged (empty). if(fexists(icon_path)) //Just ensuring the nonexistance of a file with the above path won't cause a runtime. var/icon/icon_file = new(icon_path) if(wear_suit.icon_state in icon_file.IconStates()) - standing = image("icon" = icon_file, "icon_state" = "[wear_suit.icon_state]") + standing = mutable_appearance(icon_file, "[wear_suit.icon_state]", layer = COLLAR_LAYER) else if(wear_suit.icon_state in C.IconStates()) - standing = image("icon" = C, "icon_state" = "[wear_suit.icon_state]") + standing = mutable_appearance(C, "[wear_suit.icon_state]", layer = COLLAR_LAYER) - overlays_standing[COLLAR_LAYER] = standing - - if(update_icons) update_icons() + overlays_standing[COLLAR_LAYER] = standing + apply_overlay(COLLAR_LAYER) /mob/living/carbon/human/proc/update_misc_effects() misc_effect_overlays.Cut()