diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index a8ae6ad194..c076905db2 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -393,17 +393,17 @@ if(on) // Generate object icon. if(!light_overlay_cache["[light_overlay]_icon"]) - light_overlay_cache["[light_overlay]_icon"] = image("icon" = 'icons/obj/light_overlays.dmi', "icon_state" = "[light_overlay]") + light_overlay_cache["[light_overlay]_icon"] = image(icon = 'icons/obj/light_overlays.dmi', icon_state = "[light_overlay]") helmet_light = light_overlay_cache["[light_overlay]_icon"] add_overlay(helmet_light) // Generate and cache the on-mob icon, which is used in update_inv_head(). - var/cache_key = "[light_overlay][H ? "_[H.species.get_bodytype(H)]" : ""]" + var/body_type = (H && H.species.get_bodytype(H)) + var/cache_key = "[light_overlay][body_type && sprite_sheets[body_type] ? "_[body_type]" : ""]" if(!light_overlay_cache[cache_key]) - var/use_icon = 'icons/mob/light_overlays.dmi' - if(H && sprite_sheets[H.species.get_bodytype(H)]) - use_icon = sprite_sheets[H.species.get_bodytype(H)] - light_overlay_cache[cache_key] = image("icon" = use_icon, "icon_state" = "[light_overlay]") + var/use_icon = LAZYACCESS(sprite_sheets,body_type) || 'icons/mob/light_overlays.dmi' + light_overlay_cache[cache_key] = image(icon = use_icon, icon_state = "[light_overlay]") + else if(helmet_light) cut_overlay(helmet_light) helmet_light = null diff --git a/code/modules/clothing/clothing_icons.dm b/code/modules/clothing/clothing_icons.dm index 46370472de..33e1da6000 100644 --- a/code/modules/clothing/clothing_icons.dm +++ b/code/modules/clothing/clothing_icons.dm @@ -19,8 +19,8 @@ //HELMET: May have a lighting overlay /obj/item/clothing/head/make_worn_icon(var/body_type,var/slot_name,var/inhands,var/default_icon,var/default_layer = 0) var/image/standing = ..() - if(on) - var/cache_key = "[light_overlay]_[body_type]" + if(on && slot_name == slot_head_str) + var/cache_key = "[light_overlay][LAZYACCESS(sprite_sheets,body_type) ? "_[body_type]" : ""]" if(standing && light_overlay_cache[cache_key]) standing.add_overlay(light_overlay_cache[cache_key]) return standing diff --git a/code/modules/clothing/spacesuits/rig/rig.dm b/code/modules/clothing/spacesuits/rig/rig.dm index d4c4a12870..ac191acf5e 100644 --- a/code/modules/clothing/spacesuits/rig/rig.dm +++ b/code/modules/clothing/spacesuits/rig/rig.dm @@ -339,7 +339,6 @@ piece.item_flags &= ~(STOPPRESSUREDAMAGE|AIRTIGHT) else piece.item_flags |= (STOPPRESSUREDAMAGE|AIRTIGHT) - update_icon(1) /obj/item/weapon/rig/ui_action_click() toggle_cooling(usr) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index c5557199a3..bda56bcfbf 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1018,30 +1018,27 @@ /mob/living/carbon/human/clean_blood(var/washshoes) . = ..() + gunshot_residue = null + //Always do hands (or whatever's on our hands) if(gloves) - if(gloves.clean_blood()) - update_inv_gloves() - . = 1 + gloves.clean_blood() + update_inv_gloves() gloves.germ_level = 0 else - if(bloody_hands) - . = 1 - bloody_hands = 0 + bloody_hands = 0 germ_level = 0 - //Sometimes do shoes if asked + //Sometimes do shoes if asked (or feet if no shoes) if(washshoes && shoes) - if(shoes.clean_blood()) - update_inv_shoes() - . = 1 + shoes.clean_blood() + update_inv_shoes() shoes.germ_level = 0 else if(washshoes && (feet_blood_color || LAZYLEN(feet_blood_DNA))) - feet_blood_color = null LAZYCLEARLIST(feet_blood_DNA) feet_blood_DNA = null - . = 1 + feet_blood_color = null update_bloodied() diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index a449e4c866..3f8ac00745 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -7,7 +7,44 @@ var/global/list/tail_icon_cache = list() //key is [species.race_key][r_skin][g_s var/global/list/light_overlay_cache = list() //see make_worn_icon() on helmets var/global/list/damage_icon_parts = list() //see UpdateDamageIcon() -//Add an entry to overlays, assuming it existsup +//////////////////////////////////////////////////////////////////////////////////////////////// +// # Human Icon Updating System +// +// This system takes care of the "icon" for human mobs. Of course humans don't just have a single +// icon+icon_state, but a combination of dozens of little sprites including including the body, +// clothing, equipment, in-universe HUD images, etc. +// +// # Basic Operation +// Whenever you do something that should update the on-mob appearance of a worn or held item, You +// will need to call the relevant update_inv_* proc. All of these are named after the variable they +// update from. They are defined at the /mob level so you don't even need to cast to carbon/human. +// +// The new system leverages SSoverlays to actually add/remove the overlays from mob.overlays +// Since SSoverlays already manages batching updates to reduce apperance churn etc, we don't need +// to worry about that. (In short, you can call add/cut overlay as many times as you want, it will +// only get assigned to the mob once per tick.) +// As a corrolary, this means users of this system do NOT need to tell the system when you're done +// making changes. +// +// There are also these special cases: +// update_icons_body() //Handles updating your mob's icon to reflect their gender/race/complexion etc +// UpdateDamageIcon() //Handles damage overlays for brute/burn damage //(will rename this when I geta round to it) ~Carn +// update_skin() //Handles updating skin for species that have a skin overlay. +// update_bloodied() //Handles adding/clearing the blood overlays for hands & feet. Call when bloodied or cleaned. +// update_underwear() //Handles updating the sprite for underwear. +// update_hair() //Handles updating your hair and eyes overlay +// update_mutations() //Handles updating your appearance for certain mutations. e.g TK head-glows +// update_fire() //Handles overlay from being on fire. +// update_water() //Handles overlay from being submerged. +// update_surgery() //Handles overlays from open external organs. +// +// # History (i.e. I'm used to the old way, what is different?) +// You used to have to call update_icons(FALSE) if you planned to make more changes, and call update_icons(TRUE) +// on the final update. All that is gone, just call update_inv_whatever() and it handles the rest. +// +//////////////////////////////////////////////////////////////////////////////////////////////// + +//Add an entry to overlays, assuming it exists /mob/living/carbon/human/proc/apply_layer(cache_index) if((. = overlays_standing[cache_index])) add_overlay(.) diff --git a/icons/mob/species/skrell/helmet.dmi b/icons/mob/species/skrell/helmet.dmi index 4d56c2a68a..31f409043f 100644 Binary files a/icons/mob/species/skrell/helmet.dmi and b/icons/mob/species/skrell/helmet.dmi differ diff --git a/icons/mob/species/tajaran/helmet.dmi b/icons/mob/species/tajaran/helmet.dmi index 0aafc2d8ea..cac6e5f53d 100644 Binary files a/icons/mob/species/tajaran/helmet.dmi and b/icons/mob/species/tajaran/helmet.dmi differ diff --git a/icons/mob/species/unathi/helmet.dmi b/icons/mob/species/unathi/helmet.dmi index 9f43a8d664..ec10064bcf 100644 Binary files a/icons/mob/species/unathi/helmet.dmi and b/icons/mob/species/unathi/helmet.dmi differ