From 2970b37fa145ea32561286b13c0cb0839e621cae Mon Sep 17 00:00:00 2001 From: Arokha Sieyes Date: Thu, 8 Mar 2018 16:50:04 -0500 Subject: [PATCH] U_I Phase 2.6: Blood, Helmets, Unneeded calls --- code/__defines/items_clothing.dm | 1 + .../effects/decals/Cleanable/humans.dm | 6 ++-- code/modules/clothing/clothing.dm | 15 ++++----- code/modules/clothing/spacesuits/rig/rig.dm | 7 +++-- code/modules/mob/dead/observer/observer.dm | 2 +- code/modules/mob/inventory.dm | 2 +- code/modules/mob/living/carbon/carbon.dm | 15 --------- code/modules/mob/living/carbon/human/human.dm | 31 +++++++++++++++---- .../mob/living/carbon/human/update_icons.dm | 4 +-- code/modules/mob/living/life.dm | 6 ---- 10 files changed, 46 insertions(+), 43 deletions(-) diff --git a/code/__defines/items_clothing.dm b/code/__defines/items_clothing.dm index 3b89072f19..8f67815583 100644 --- a/code/__defines/items_clothing.dm +++ b/code/__defines/items_clothing.dm @@ -107,6 +107,7 @@ #define slot_handcuffed 20 #define slot_legcuffed 21 #define slot_in_backpack 22 +#define SLOT_TOTAL 22 // Inventory slot strings. // since numbers cannot be used as associative list keys. diff --git a/code/game/objects/effects/decals/Cleanable/humans.dm b/code/game/objects/effects/decals/Cleanable/humans.dm index 1b38fae182..46b9d3645c 100644 --- a/code/game/objects/effects/decals/Cleanable/humans.dm +++ b/code/game/objects/effects/decals/Cleanable/humans.dm @@ -96,18 +96,18 @@ var/global/list/image/splatter_cache=list() S.overlays.Cut() S.overlays += S.blood_overlay S.blood_DNA |= blood_DNA.Copy() + perp.update_inv_shoes() else if (hasfeet)//Or feet perp.feet_blood_color = basecolor perp.track_blood = max(amount,perp.track_blood) - if(!perp.feet_blood_DNA) - perp.feet_blood_DNA = list() + LAZYINITLIST(perp.feet_blood_DNA) perp.feet_blood_DNA |= blood_DNA.Copy() + perp.update_bloodied() else if (perp.buckled && istype(perp.buckled, /obj/structure/bed/chair/wheelchair)) var/obj/structure/bed/chair/wheelchair/W = perp.buckled W.bloodiness = 4 - perp.update_inv_shoes(1) amount-- /obj/effect/decal/cleanable/blood/proc/dry() diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index e1ebb436be..a8ae6ad194 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -322,6 +322,7 @@ var/light_applied var/brightness_on var/on = 0 + var/image/helmet_light sprite_sheets = list( "Teshari" = 'icons/mob/species/seromi/head.dmi', @@ -385,18 +386,16 @@ return 1 /obj/item/clothing/head/update_icon(var/mob/user) - - overlays.Cut() var/mob/living/carbon/human/H - if(istype(user,/mob/living/carbon/human)) + if(ishuman(user)) H = user 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]") - overlays |= light_overlay_cache["[light_overlay]_icon"] + 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)]" : ""]" @@ -405,9 +404,11 @@ 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]") + else if(helmet_light) + cut_overlay(helmet_light) + helmet_light = null - if(H) - H.update_inv_head() + user.update_inv_head() //Will redraw the helmet with the light on the mob /obj/item/clothing/head/update_clothing_icon() if (ismob(src.loc)) diff --git a/code/modules/clothing/spacesuits/rig/rig.dm b/code/modules/clothing/spacesuits/rig/rig.dm index c4332cd1d6..d4c4a12870 100644 --- a/code/modules/clothing/spacesuits/rig/rig.dm +++ b/code/modules/clothing/spacesuits/rig/rig.dm @@ -181,7 +181,10 @@ /obj/item/weapon/rig/get_worn_icon_file(var/body_type,var/slot_name,var/default_icon,var/inhands) if(!inhands && slot_name == slot_back_str) - return icon_override || mob_icon //That's just all this does. + if(icon_override) + return icon_override + else if(mob_icon) + return mob_icon return ..() @@ -604,7 +607,7 @@ // update_inv_wear_suit(), handle species checks here. if(wearer && sprite_sheets && sprite_sheets[wearer.species.get_bodytype(wearer)]) species_icon = sprite_sheets[wearer.species.get_bodytype(wearer)] - mob_icon = image("icon" = species_icon, "icon_state" = "[icon_state]") + mob_icon = icon(icon = species_icon, icon_state = "[icon_state]") if(installed_modules.len) for(var/obj/item/rig_module/module in installed_modules) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index ac4e71c592..143ef9ef7f 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -103,7 +103,7 @@ if (ishuman(body)) var/mob/living/carbon/human/H = body icon = H.icon - H.update_icons() + underlays = H.underlays overlays = H.overlays else icon = body.icon diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index 41f2a724bd..a7f278cb6a 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -179,7 +179,7 @@ var/list/slot_equipment_priority = list( \ /mob/proc/get_inventory_slot(obj/item/I) var/slot = 0 - for(var/s in slot_back to slot_tie) //kind of worries me + for(var/s in 1 to SLOT_TOTAL) if(get_equipped_item(s) == I) slot = s break diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index b22fdcabc8..3fb0c6e65e 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -277,21 +277,6 @@ // ++++ROCKDTBEN++++ MOB PROCS //END -/mob/living/carbon/clean_blood() - . = ..() - if(ishuman(src)) - var/mob/living/carbon/human/H = src - if(H.gloves) - if(H.gloves.clean_blood()) - H.update_inv_gloves(0) - H.gloves.germ_level = 0 - else - if(H.bloody_hands) - H.bloody_hands = 0 - H.update_inv_gloves(0) - H.germ_level = 0 - update_icons_body() - /mob/living/carbon/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) ..() var/temp_inc = max(min(BODYTEMP_HEATING_MAX*(1-get_heat_protection()), exposed_temperature - bodytemperature), 0) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 35ed2f3ab8..c5557199a3 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1007,7 +1007,7 @@ if(!blood_DNA[M.dna.unique_enzymes]) blood_DNA[M.dna.unique_enzymes] = M.dna.b_type hand_blood_color = blood_color - src.update_inv_gloves() //handles bloody hands overlays and updating + update_bloodied() verbs += /mob/living/carbon/human/proc/bloody_doodle return 1 //we applied blood to the item @@ -1017,14 +1017,33 @@ return md5(dna.uni_identity) /mob/living/carbon/human/clean_blood(var/washshoes) - .=..() + . = ..() gunshot_residue = null - if(washshoes && !shoes && istype(feet_blood_DNA, /list) && feet_blood_DNA.len) + //Always do hands (or whatever's on our hands) + if(gloves) + if(gloves.clean_blood()) + update_inv_gloves() + . = 1 + gloves.germ_level = 0 + else + if(bloody_hands) + . = 1 + bloody_hands = 0 + germ_level = 0 + + //Sometimes do shoes if asked + if(washshoes && shoes) + if(shoes.clean_blood()) + update_inv_shoes() + . = 1 + shoes.germ_level = 0 + else if(washshoes && (feet_blood_color || LAZYLEN(feet_blood_DNA))) feet_blood_color = null - feet_blood_DNA.Cut() + LAZYCLEARLIST(feet_blood_DNA) feet_blood_DNA = null - update_inv_shoes(1) - return 1 + . = 1 + + update_bloodied() /mob/living/carbon/human/get_visible_implants(var/class = 0) diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index e42591e9ee..a449e4c866 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -7,7 +7,7 @@ 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 exists +//Add an entry to overlays, assuming it existsup /mob/living/carbon/human/proc/apply_layer(cache_index) if((. = overlays_standing[cache_index])) add_overlay(.) @@ -781,7 +781,7 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon() return remove_layer(TAIL_LAYER) - var/species_tail = species.get_tail(src) // Species tail icon_state prefix. + var/species_tail = species.get_tail(src) // Species tail icon_state prefix. //This one is actually not that bad I guess. if(species_tail && !(wear_suit && wear_suit.flags_inv & HIDETAIL)) diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index 6b02734a7e..e81308423d 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -111,15 +111,11 @@ /mob/living/proc/handle_stunned() if(stunned) AdjustStunned(-1) - if(!stunned) - update_icons() return stunned /mob/living/proc/handle_weakened() if(weakened) weakened = max(weakened-1,0) - if(!weakened) - update_icons() return weakened /mob/living/proc/handle_stuttering() @@ -145,8 +141,6 @@ /mob/living/proc/handle_paralysed() if(paralysis) AdjustParalysis(-1) - if(!paralysis) - update_icons() return paralysis /mob/living/proc/handle_disabilities()