From 507073bc3fb87365c9d1fef9ec6bdba277bc0660 Mon Sep 17 00:00:00 2001 From: TobyThorne <45202681+TobyThorne@users.noreply.github.com> Date: Thu, 30 Nov 2023 17:17:20 +0600 Subject: [PATCH] fix(atoms): reworks bloody overlays 12-yeard-old code bad PR #11113 --- code/datums/outfits/horror_killers.dm | 3 +- code/game/atoms.dm | 41 +++++++----- .../effects/decals/Cleanable/humans.dm | 50 ++++++--------- code/game/objects/effects/decals/cleanable.dm | 2 +- code/game/objects/items.dm | 62 +++++++++++-------- .../objects/items/melee/telescopic_baton.dm | 5 +- code/game/objects/items/stacks/stack.dm | 4 ++ code/game/turfs/simulated.dm | 45 +++++++------- code/modules/clothing/clothing.dm | 28 +++++++-- code/modules/detectivework/tools/rag.dm | 14 ----- code/modules/detectivework/tools/uvlight.dm | 17 +++-- code/modules/mob/living/carbon/carbon.dm | 15 ----- .../mob/living/carbon/human/examine.dm | 4 +- code/modules/mob/living/carbon/human/human.dm | 32 +++++++--- .../mob/living/carbon/human/update_icons.dm | 6 +- code/modules/mob/mob_defines.dm | 7 +++ code/modules/modifier/phobia.dm | 4 +- code/modules/xenoarcheaology/finds/special.dm | 2 +- 18 files changed, 185 insertions(+), 156 deletions(-) diff --git a/code/datums/outfits/horror_killers.dm b/code/datums/outfits/horror_killers.dm index b9113e1ad53..cfb2e765ba9 100644 --- a/code/datums/outfits/horror_killers.dm +++ b/code/datums/outfits/horror_killers.dm @@ -31,9 +31,8 @@ /decl/hierarchy/outfit/masked_killer/post_equip(mob/living/carbon/human/H) ..() - var/victim = get_mannequin(H.ckey) for(var/obj/item/carried_item in H.get_equipped_items(TRUE)) - carried_item.add_blood(victim) //Oh yes, there will be blood.. just not blood from the killer because that's odd + carried_item.add_blood() //Oh yes, there will be blood.. just not blood from the killer because that's odd /decl/hierarchy/outfit/reaper name = "Reaper" diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 74ace9c446a..ca958e86533 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -3,6 +3,7 @@ var/atom_flags var/effect_flags var/list/blood_DNA + var/is_bloodied var/was_bloodied var/blood_color var/last_bumped = 0 @@ -296,7 +297,7 @@ its easier to just keep the beam vertical. /atom/proc/_examine_text(mob/user, infix = "", suffix = "") // This reformat names to get a/an properly working on item descriptions when they are bloody var/f_name = "\a [SPAN("info", "[src][infix]")]." - if(src.blood_DNA && !istype(src, /obj/effect/decal)) + if(is_bloodied && !istype(src, /obj/effect/decal)) if(gender == PLURAL) f_name = "some " else @@ -393,24 +394,30 @@ its easier to just keep the beam vertical. playsound(src, hitby_sound, sound_loudness, 1) -//returns 1 if made bloody, returns 0 otherwise -/atom/proc/add_blood(mob/living/carbon/human/M as mob) +// returns TRUE if made bloody, returns FALSE otherwise +// accepts either a human or a hex color +/atom/proc/add_blood(source) if(atom_flags & ATOM_FLAG_NO_BLOOD) - return 0 + return FALSE - if(!blood_DNA || !istype(blood_DNA, /list)) //if our list of DNA doesn't exist yet (or isn't a list) initialise it. + if(!islist(blood_DNA)) // if our list of DNA doesn't exist yet (or isn't a list) initialise it. blood_DNA = list() - was_bloodied = 1 - blood_color = COLOR_BLOOD_HUMAN - if(istype(M)) - if (!istype(M.dna, /datum/dna)) + is_bloodied = TRUE + was_bloodied = TRUE + + if(ishuman(source)) + var/mob/living/carbon/human/M = source + if(!istype(M.dna, /datum/dna)) M.dna = new /datum/dna(null) M.dna.real_name = M.real_name M.check_dna() blood_color = M.species.get_blood_colour(M) - . = 1 - return 1 + else if(istext(source)) + blood_color = source + else + blood_color = COLOR_BLOOD_HUMAN + return TRUE /atom/proc/add_vomit_floor(mob/living/carbon/M, toxvomit = 0, datum/reagents/inject_reagents) if(istype(src, /turf/simulated)) @@ -424,12 +431,14 @@ its easier to just keep the beam vertical. /atom/proc/clean_blood() if(!simulated) - return + return FALSE + is_bloodied = FALSE fluorescent = 0 - src.germ_level = 0 - if(istype(blood_DNA, /list)) - blood_DNA = null - return 1 + germ_level = 0 + if(islist(blood_DNA)) + blood_DNA.Cut() + blood_color = null + return TRUE /atom/proc/get_global_map_pos() if(!islist(GLOB.global_map) || isemptylist(GLOB.global_map)) return diff --git a/code/game/objects/effects/decals/Cleanable/humans.dm b/code/game/objects/effects/decals/Cleanable/humans.dm index 4e9a01ef4cb..8ba55b921ce 100644 --- a/code/game/objects/effects/decals/Cleanable/humans.dm +++ b/code/game/objects/effects/decals/Cleanable/humans.dm @@ -31,7 +31,7 @@ var/global/list/image/splatter_cache=list() if(invisibility != 100) set_invisibility(100) amount = 0 - ..(ignore = 1) + ..(ignore = TRUE) /obj/effect/decal/cleanable/blood/hide() return @@ -73,32 +73,22 @@ var/global/list/image/splatter_cache=list() var/obj/item/organ/external/l_foot = perp.get_organ(BP_L_FOOT) var/obj/item/organ/external/r_foot = perp.get_organ(BP_R_FOOT) - var/hasfeet = 1 + var/hasfeet = TRUE if((!l_foot || l_foot.is_stump()) && (!r_foot || r_foot.is_stump())) - hasfeet = 0 + hasfeet = FALSE if(perp.shoes && !perp.buckled)//Adding blood to shoes var/obj/item/clothing/shoes/S = perp.shoes if(istype(S)) - S.blood_color = basecolor - S.track_blood = max(amount,S.track_blood) - if(!S.blood_overlay) - S.generate_blood_overlay() - if(!S.blood_DNA) - S.blood_DNA = list() - S.blood_overlay.color = basecolor - S.AddOverlays(S.blood_overlay) - if(S.blood_overlay && S.blood_overlay.color != basecolor) - S.blood_overlay.color = basecolor - S.ClearOverlays() - S.AddOverlays(S.blood_overlay) - S.blood_DNA |= blood_DNA.Copy() - - else if (hasfeet)//Or feet + S.add_blood(basecolor, amount) + S.blood_DNA |= blood_DNA + + 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() perp.feet_blood_DNA |= blood_DNA.Copy() + else if (perp.buckled && istype(perp.buckled, /obj/structure/bed/chair/wheelchair)) var/obj/structure/bed/chair/wheelchair/W = perp.buckled W.bloodiness = 4 @@ -115,19 +105,17 @@ var/global/list/image/splatter_cache=list() /obj/effect/decal/cleanable/blood/attack_hand(mob/living/carbon/human/user) ..() - if(amount && istype(user)) - if(user.gloves) - return - var/taken = rand(1, amount) - amount -= taken - to_chat(user, "You get some of \the [src] on your hands.") - if(!user.blood_DNA) - user.blood_DNA = list() - user.blood_DNA |= blood_DNA.Copy() - user.bloody_hands = taken - user.hand_blood_color = basecolor - user.update_inv_gloves(1) - user.verbs += /mob/living/carbon/human/proc/bloody_doodle + + if(!amount || !istype(user) || !user.gloves) + return + + var/taken = rand(1, amount) + amount -= taken + to_chat(user, SPAN("notice", "You get some of \the [src] on your hands.")) + user.add_blood(basecolor) + user.blood_DNA |= blood_DNA.Copy() + user.bloody_hands = taken + user.verbs += /mob/living/carbon/human/proc/bloody_doodle /obj/effect/decal/cleanable/blood/splatter random_icon_states = list("mfloor3", "mfloor7", "mgibbl1", "mgibbl2", "mgibbl3", "mgibbl4", "mgibbl5") diff --git a/code/game/objects/effects/decals/cleanable.dm b/code/game/objects/effects/decals/cleanable.dm index ac5aef6fc8b..4c224552710 100644 --- a/code/game/objects/effects/decals/cleanable.dm +++ b/code/game/objects/effects/decals/cleanable.dm @@ -6,7 +6,7 @@ if(!ignore) qdel(src) return - ..() + . = ..() /obj/effect/decal/cleanable/Initialize() if (random_icon_states && length(src.random_icon_states) > 0) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 377a22c5059..b6a879a39bd 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -697,11 +697,10 @@ var/list/global/slot_flags_enumeration = list( /obj/item/clean_blood() . = ..() + if(!.) + return if(blood_overlay) - CutOverlays(blood_overlay) - if(istype(src, /obj/item/clothing/gloves)) - var/obj/item/clothing/gloves/G = src - G.transfer_blood = 0 + CutOverlays(blood_overlay, ATOM_ICON_CACHE_PROTECTED) /obj/item/reveal_blood() if(was_bloodied && !fluorescent) @@ -710,42 +709,53 @@ var/list/global/slot_flags_enumeration = list( blood_overlay.color = COLOR_LUMINOL update_icon() -/obj/item/add_blood(mob/living/carbon/human/M) - if (!..()) - return 0 - - if(istype(src, /obj/item/melee/energy)) +/obj/item/add_blood(source) + var/bloodied_check = is_bloodied + var/old_blood_color = blood_color + . = ..() + if(!.) return - //if we haven't made our blood_overlay already - if( !blood_overlay ) + // if we haven't made our blood_overlay already + if(!blood_overlay) generate_blood_overlay() - //apply the blood-splatter overlay if it isn't already in there - if(!blood_DNA.len) - blood_overlay.color = blood_color - AddOverlays(blood_overlay) + // apply the blood-splatter overlay if it wasn't there + if(!bloodied_check) + AddOverlays(blood_overlay, ATOM_ICON_CACHE_PROTECTED) + else if(blood_color != old_blood_color) + update_blood_overlay() - //if this blood isn't already in the list, add it - if(istype(M)) - if(blood_DNA[M.dna.unique_enzymes]) - return 0 //already bloodied with this blood. Cannot add more. - blood_DNA[M.dna.unique_enzymes] = M.dna.b_type - return 1 //we applied blood to the item + // if this blood isn't already in the list, add it + if(ishuman(source)) + var/mob/living/carbon/human/M = source + if(!blood_DNA[M.dna.unique_enzymes]) + blood_DNA[M.dna.unique_enzymes] = M.dna.b_type GLOBAL_LIST_EMPTY(blood_overlay_cache) /obj/item/proc/generate_blood_overlay(force = FALSE) if(blood_overlay && !force) return - if(GLOB.blood_overlay_cache["[icon]" + icon_state]) - blood_overlay = GLOB.blood_overlay_cache["[icon]" + icon_state] + if(GLOB.blood_overlay_cache["[icon]/[icon_state]/[blood_color]"]) + blood_overlay = GLOB.blood_overlay_cache["[icon]/[icon_state]/[blood_color]"] return - var/image/blood = image(icon = 'icons/effects/blood.dmi', icon_state = "itemblood") + var/image/blood = overlay_image('icons/effects/blood.dmi', "itemblood", color = blood_color, flags = DEFAULT_APPEARANCE_FLAGS|RESET_COLOR) blood.filters += filter(type = "alpha", icon = icon(icon, icon_state)) - GLOB.blood_overlay_cache["[icon]" + icon_state] = blood + GLOB.blood_overlay_cache["[icon]/[icon_state]/[blood_color]"] = blood blood_overlay = blood +// Regenerates the bloodiness, to be used when the item's icon_state get changed to something of another shape. +/obj/item/proc/update_blood_overlay() + if(!blood_overlay) + return // nah + if(is_bloodied) + CutOverlays(blood_overlay, ATOM_ICON_CACHE_PROTECTED) + generate_blood_overlay(TRUE) // Force recheck. + AddOverlays(blood_overlay, ATOM_ICON_CACHE_PROTECTED) + else + generate_blood_overlay(TRUE) // Just updating it, no need in actual overlaying. + /obj/item/proc/showoff(mob/user) for (var/mob/M in view(user)) M.show_message("[user] holds up [src]. Take a closer look.",1) @@ -921,7 +931,7 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out. return ret_overlay /obj/item/proc/get_examine_line() - if(blood_DNA) + if(is_bloodied) . = SPAN("warning", "\icon[src] [gender==PLURAL?"some":"a"] [(blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained [SPAN("info", "[src]")]") else . = "\icon[src] \a [SPAN("info", "[src]")]" diff --git a/code/game/objects/items/melee/telescopic_baton.dm b/code/game/objects/items/melee/telescopic_baton.dm index 5f0ace09e80..48615bfa76a 100644 --- a/code/game/objects/items/melee/telescopic_baton.dm +++ b/code/game/objects/items/melee/telescopic_baton.dm @@ -48,10 +48,7 @@ else icon_state = "telebaton_0" item_state = "telebaton_0" - if(length(blood_DNA)) - generate_blood_overlay(TRUE) // Force recheck. - ClearOverlays() - AddOverlays(blood_overlay) + update_blood_overlay() /obj/item/melee/telebaton/attack(mob/target as mob, mob/living/user as mob) if(on) diff --git a/code/game/objects/items/stacks/stack.dm b/code/game/objects/items/stacks/stack.dm index ec522b2ab7a..c1e9f35a14d 100644 --- a/code/game/objects/items/stacks/stack.dm +++ b/code/game/objects/items/stacks/stack.dm @@ -291,6 +291,8 @@ S.add(transfer) if (prob(transfer/orig_amount * 100)) transfer_fingerprints_to(S) + if(is_bloodied) + S.add_blood(blood_color) if(blood_DNA) S.blood_DNA |= blood_DNA return transfer @@ -311,6 +313,8 @@ newstack.color = color if (prob(transfer/orig_amount * 100)) transfer_fingerprints_to(newstack) + if(is_bloodied) + newstack.add_blood(blood_color) if(blood_DNA) newstack.blood_DNA |= blood_DNA return newstack diff --git a/code/game/turfs/simulated.dm b/code/game/turfs/simulated.dm index b47c62f099d..22db791de8e 100644 --- a/code/game/turfs/simulated.dm +++ b/code/game/turfs/simulated.dm @@ -48,7 +48,7 @@ /turf/simulated/clean_blood() for(var/obj/effect/decal/cleanable/blood/B in contents) B.clean_blood() - ..() + return ..() /turf/simulated/New() ..() @@ -102,13 +102,15 @@ var/obj/item/clothing/shoes/S = H.shoes if(istype(S)) S.handle_movement(src,(H.m_intent == M_RUN ? 1 : 0)) - if(S.track_blood && S.blood_DNA) - bloodDNA = S.blood_DNA - bloodcolor=S.blood_color + if(S.track_blood) + if(S.blood_DNA) + bloodDNA = S.blood_DNA + bloodcolor = S.blood_color S.track_blood-- else - if(H.track_blood && H.feet_blood_DNA) - bloodDNA = H.feet_blood_DNA + if(H.track_blood) + if(H.feet_blood_DNA) + bloodDNA = H.feet_blood_DNA bloodcolor = H.feet_blood_color H.track_blood-- @@ -146,21 +148,22 @@ ..() //returns 1 if made bloody, returns 0 otherwise -/turf/simulated/add_blood(mob/living/carbon/human/M as mob) - if (!..()) - return 0 - - if(istype(M)) - for(var/obj/effect/decal/cleanable/blood/B in contents) - if(!B.blood_DNA) - B.blood_DNA = list() - if(!B.blood_DNA[M.dna.unique_enzymes]) - B.blood_DNA[M.dna.unique_enzymes] = M.dna.b_type - B.virus2 = virus_copylist(M.virus2) - return 1 //we bloodied the floor - blood_splatter(src,M.get_blood(M.vessel),1) - return 1 //we bloodied the floor - return 0 +/turf/simulated/add_blood(source) + if(!ishuman(source)) + return FALSE // Meh, fuck it, if you'll ever need the add_blood("#abcdef") behavior - just go ahead code it yourself. ~ToTh + . = ..() + if(!.) + return + + var/mob/living/carbon/human/M = source + for(var/obj/effect/decal/cleanable/blood/B in contents) + if(!B.blood_DNA) + B.blood_DNA = list() + if(!B.blood_DNA[M.dna.unique_enzymes]) + B.blood_DNA[M.dna.unique_enzymes] = M.dna.b_type + B.virus2 = virus_copylist(M.virus2) + return + blood_splatter(src, M.get_blood(M.vessel), 1) // Only adds blood on the floor -- Skie /turf/simulated/proc/add_blood_floor(mob/living/carbon/M as mob) diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index fc0510813e9..b9b4a4674eb 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -46,15 +46,15 @@ GLOBAL_LIST_EMPTY(clothing_blood_icons) if(ishuman(user_mob)) var/mob/living/carbon/human/user_human = user_mob - if(blood_overlay_type && blood_DNA && user_human.body_build.blood_icon) + if(blood_overlay_type && is_bloodied && user_human.body_build.blood_icon) var/mob_state = get_icon_state(slot) var/mob_icon = user_human.body_build.get_mob_icon(slot, mob_state) var/cache_index = "[mob_icon]/[mob_state]/[blood_color]" if(!GLOB.clothing_blood_icons[cache_index]) - var/image/bloodover = image(icon = user_human.body_build.blood_icon, icon_state = blood_overlay_type) - bloodover.color = blood_color + var/mutable_appearance/bloodover = mutable_appearance(user_human.body_build.blood_icon, blood_overlay_type, color = blood_color, flags = DEFAULT_APPEARANCE_FLAGS|RESET_COLOR) bloodover.filters += filter(type = "alpha", icon = icon(mob_icon, mob_state)) GLOB.clothing_blood_icons[cache_index] = bloodover + ret.AddOverlays(GLOB.clothing_blood_icons[cache_index]) if(length(accessories)) @@ -65,7 +65,8 @@ GLOBAL_LIST_EMPTY(clothing_blood_icons) // Aurora forensics port. /obj/item/clothing/clean_blood() . = ..() - gunshot_residue = null + if(.) + gunshot_residue = null /obj/item/clothing/proc/get_fibers() var/fiber_id = copytext(md5("\ref[src] fiber"), 1, 6) @@ -249,6 +250,8 @@ BLIND // can't see anything attack_verb = list("challenged") species_restricted = list("exclude", SPECIES_UNATHI, SPECIES_TAJARA, SPECIES_VOX) blood_overlay_type = "bloodyhands" + var/transfer_blood = 0 + var/mob/living/carbon/human/bloody_hands_mob /obj/item/clothing/gloves/Initialize() if(item_flags & ITEM_FLAG_PREMODIFIED) @@ -375,6 +378,11 @@ BLIND // can't see anything ring = null wearer = null +/obj/item/clothing/gloves/clean_blood() + . = ..() + if(.) + transfer_blood = 0 + /////////////////////////////////////////////////////////////////////// //Head /obj/item/clothing/head @@ -575,6 +583,7 @@ BLIND // can't see anything var/can_hold_knife var/obj/item/holding + var/track_blood = 0 permeability_coefficient = 0.50 force = 2 @@ -652,6 +661,17 @@ BLIND // can't see anything var/mob/M = src.loc M.update_inv_shoes() +/obj/item/clothing/shoes/add_blood(source, new_track_blood = 0) + . = ..(source) + if(.) + track_blood = max(new_track_blood, track_blood) + +/obj/item/clothing/shoes/clean_blood() + . = ..() + if(.) + track_blood = 0 + + /////////////////////////////////////////////////////////////////////// //Suit /obj/item/clothing/suit diff --git a/code/modules/detectivework/tools/rag.dm b/code/modules/detectivework/tools/rag.dm index 20845de56a3..37ea5b1262c 100644 --- a/code/modules/detectivework/tools/rag.dm +++ b/code/modules/detectivework/tools/rag.dm @@ -1,17 +1,3 @@ -/mob - var/bloody_hands = null - var/mob/living/carbon/human/bloody_hands_mob - var/track_blood = 0 - var/list/feet_blood_DNA - var/track_blood_type - var/feet_blood_color - -/obj/item/clothing/gloves - var/transfer_blood = 0 - var/mob/living/carbon/human/bloody_hands_mob - -/obj/item/clothing/shoes/ - var/track_blood = 0 /obj/item/reagent_containers/rag name = "rag" diff --git a/code/modules/detectivework/tools/uvlight.dm b/code/modules/detectivework/tools/uvlight.dm index 57383f029bf..35175dbf764 100644 --- a/code/modules/detectivework/tools/uvlight.dm +++ b/code/modules/detectivework/tools/uvlight.dm @@ -33,17 +33,22 @@ if(scanned.len) for(var/atom/O in scanned) O.set_invisibility(scanned[O]) - if(O.fluorescent == 2) O.fluorescent = 1 + if(O.fluorescent == 2) + O.fluorescent = 1 scanned.Cut() if(stored_alpha.len) for(var/atom/O in stored_alpha) O.alpha = stored_alpha[O] - if(O.fluorescent == 2) O.fluorescent = 1 + if(O.fluorescent == 2) + O.fluorescent = 1 stored_alpha.Cut() if(reset_objects.len) for(var/obj/item/I in reset_objects) - I.CutOverlays(I.blood_overlay) - if(I.fluorescent == 2) I.fluorescent = 1 + var/saved_fluorescent = I.fluorescent + if(I.blood_color == COLOR_LUMINOL) + I.clean_blood() + if(saved_fluorescent == 2) + I.fluorescent = 1 reset_objects.Cut() /obj/item/device/uv_light/think() @@ -64,8 +69,8 @@ A.alpha = use_alpha if(istype(A, /obj/item)) var/obj/item/O = A - if(O.was_bloodied && !(O.blood_overlay in O.overlays)) - O.AddOverlays(O.blood_overlay) + if(O.was_bloodied && !O.is_bloodied) + O.add_blood(COLOR_LUMINOL) reset_objects |= O set_next_think(world.time + 1 SECOND) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 210eae02e54..d3c119f6e9e 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -276,21 +276,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(!isnull(H.bloody_hands)) - H.bloody_hands = null - H.update_inv_gloves(0) - H.germ_level = 0 - update_icons() //apply the now updated overlays to the mob - //Throwing stuff /mob/proc/throw_item(atom/target) return diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index fefe117426c..4e7126e10e8 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -94,7 +94,7 @@ // gloves if(gloves && !skipgloves) msg += "[T.He] [T.has] [gloves.get_examine_line()] on [T.his] hands.\n" - else if(blood_DNA) + else if(is_bloodied) msg += SPAN("warning", "[T.He] [T.has] [(hand_blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained hands!\n") // belt @@ -113,7 +113,7 @@ if(istype(wear_mask, /obj/item/grenade)) descriptor = "in [T.his] mouth" - if(wear_mask.blood_DNA) + if(wear_mask.is_bloodied) msg += SPAN("warning", "[T.He] [T.has] \icon[wear_mask] [wear_mask.gender==PLURAL?"some":"a"] [(wear_mask.blood_color != SYNTH_BLOOD_COLOUR) ? "blood" : "oil"]-stained [wear_mask.name] [descriptor]!\n") else msg += "[T.He] [T.has] \icon[wear_mask] \a [wear_mask] [descriptor].\n" diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 165a7828b87..bf746ca2f00 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -977,26 +977,42 @@ var/obj/item/organ/internal/lungs/L = internal_organs_by_name[BP_LUNGS] return L && L.is_bruised() -/mob/living/carbon/human/add_blood(mob/living/carbon/human/M as mob) - if (!..()) - return 0 +/mob/living/carbon/human/add_blood(source) + . = ..() + if(!.) + return + //if this blood isn't already in the list, add it - if(istype(M)) + if(ishuman(source)) + var/mob/living/carbon/human/M = source 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_inv_gloves(1) // handles bloody hands overlays and updating verbs += /mob/living/carbon/human/proc/bloody_doodle - return 1 //we applied blood to the item /mob/living/carbon/human/clean_blood(clean_feet) - .=..() + . =..() + if(!.) + return + gunshot_residue = null + if(clean_feet && !shoes) feet_blood_color = null feet_blood_DNA = null update_inv_shoes(1) - return 1 + + if(gloves) + if(gloves.clean_blood()) + update_inv_gloves(0) + gloves.germ_level = 0 + else + if(!isnull(bloody_hands)) + bloody_hands = null + update_inv_gloves(0) + germ_level = 0 + update_icons() //apply the now updated overlays to the mob /mob/living/carbon/human/get_visible_implants(class = 0) var/list/visible_implants = ..() diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 6047bc9a741..de24789ef33 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -459,8 +459,8 @@ var/global/list/damage_icon_parts = list() if(gloves && !(wear_suit && wear_suit.flags_inv & HIDEGLOVES)) overlays_standing[HO_GLOVES_LAYER] = gloves.get_mob_overlay(src,slot_gloves_str) else - if(blood_DNA && body_build.blood_icon) - var/image/bloodsies = overlay_image(body_build.blood_icon, "bloodyhands", hand_blood_color, RESET_COLOR) + if(is_bloodied && body_build.blood_icon) + var/image/bloodsies = overlay_image(body_build.blood_icon, "bloodyhands", hand_blood_color, DEFAULT_APPEARANCE_FLAGS | RESET_COLOR) overlays_standing[HO_GLOVES_LAYER] = bloodsies else overlays_standing[HO_GLOVES_LAYER] = null @@ -509,7 +509,7 @@ var/global/list/damage_icon_parts = list() overlays_standing[HO_SHOES_LAYER] = shoes.get_mob_overlay(src,slot_shoes_str) else if(feet_blood_DNA && body_build.blood_icon) - var/image/bloodsies = overlay_image(body_build.blood_icon, "shoeblood", hand_blood_color, RESET_COLOR) + var/image/bloodsies = overlay_image(body_build.blood_icon, "shoeblood", hand_blood_color, DEFAULT_APPEARANCE_FLAGS | RESET_COLOR) overlays_standing[HO_SHOES_LAYER] = bloodsies else overlays_standing[HO_SHOES_LAYER] = null diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index 81d73c07c33..656f7e176ab 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -218,3 +218,10 @@ var/thinking_IC = FALSE /// Whether typing indicator sould be shown var/thinking_silent = FALSE + + var/bloody_hands = null + var/mob/living/carbon/human/bloody_hands_mob + var/track_blood = 0 + var/list/feet_blood_DNA + var/track_blood_type + var/feet_blood_color diff --git a/code/modules/modifier/phobia.dm b/code/modules/modifier/phobia.dm index 55d96ebc30b..50220cf9ce0 100644 --- a/code/modules/modifier/phobia.dm +++ b/code/modules/modifier/phobia.dm @@ -135,7 +135,7 @@ clothing_slots += list(H.l_store, H.r_store) for(var/obj/item/clothing/C in clothing_slots) - if(C.blood_DNA && C.blood_color && C.blood_color != SYNTH_BLOOD_COLOUR) + if(C.is_bloodied && C.blood_color && C.blood_color != SYNTH_BLOOD_COLOUR) human_blood_fear_amount += 1 // This is divided, since humans can wear so many items at once. @@ -145,7 +145,7 @@ // Bloody objects are also bad. if(istype(thing, /obj)) var/obj/O = thing - if(O.blood_DNA && O.blood_color && O.blood_color != SYNTH_BLOOD_COLOUR) + if(O.is_bloodied && O.blood_color && O.blood_color != SYNTH_BLOOD_COLOUR) fear_amount++ return fear_amount diff --git a/code/modules/xenoarcheaology/finds/special.dm b/code/modules/xenoarcheaology/finds/special.dm index ab1ef9c9a33..bd0de77ad43 100644 --- a/code/modules/xenoarcheaology/finds/special.dm +++ b/code/modules/xenoarcheaology/finds/special.dm @@ -214,7 +214,7 @@ src.loc = null else return - + set_next_think(world.time + 1 SECOND) /obj/effect/shadow_wight/Bump(atom/obstacle)