diff --git a/code/modules/detectivework/forensics.dm b/code/modules/detectivework/forensics.dm index d7c5272d4f2..8b49cd3a92d 100644 --- a/code/modules/detectivework/forensics.dm +++ b/code/modules/detectivework/forensics.dm @@ -13,11 +13,11 @@ atom/var/list/suit_fibers atom/proc/add_fibers(mob/living/carbon/human/M) if(M.gloves && istype(M.gloves,/obj/item/clothing/gloves)) var/obj/item/clothing/gloves/G = M.gloves - if(G.transfer_blood) //bloodied gloves transfer blood to touched objects - if(add_blood(G.bloody_hands_mob)) //only reduces the bloodiness of our gloves if the item wasn't already bloody + if(G.transfer_blood && G.bloody_hands_mob?.resolve()) //bloodied gloves transfer blood to touched objects + if(add_blood(G.bloody_hands_mob.resolve())) //only reduces the bloodiness of our gloves if the item wasn't already bloody G.transfer_blood-- - else if(M.bloody_hands) - if(add_blood(M.bloody_hands_mob)) + else if(M.bloody_hands && M.bloody_hands_mob?.resolve()) + if(add_blood(M.bloody_hands_mob.resolve())) M.bloody_hands-- if(!suit_fibers) suit_fibers = list() diff --git a/code/modules/detectivework/tools/rag.dm b/code/modules/detectivework/tools/rag.dm index d030a818095..dc45e2a1f8c 100644 --- a/code/modules/detectivework/tools/rag.dm +++ b/code/modules/detectivework/tools/rag.dm @@ -1,6 +1,6 @@ /mob var/bloody_hands = null - var/mob/living/carbon/human/bloody_hands_mob + var/datum/weakref/bloody_hands_mob var/track_footprint = 0 var/list/feet_blood_DNA var/track_footprint_type @@ -8,7 +8,7 @@ /obj/item/clothing/gloves var/transfer_blood = 0 - var/mob/living/carbon/human/bloody_hands_mob + var/datum/weakref/bloody_hands_mob /obj/item/clothing/shoes/ var/track_footprint = 0 diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index ae9c5722149..05392881a6a 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -461,11 +461,11 @@ emp_act var/obj/item/clothing/gloves/G = gloves G.add_blood(source) G.transfer_blood = amount - G.bloody_hands_mob = source + G.bloody_hands_mob = WEAKREF(source) else add_blood(source) bloody_hands = amount - bloody_hands_mob = source + bloody_hands_mob = WEAKREF(source) update_inv_gloves() //updates on-mob overlays for bloody hands and/or bloody gloves /mob/living/carbon/human/proc/bloody_body(var/mob/living/source) diff --git a/html/changelogs/MDP-bloodyweakref.yml b/html/changelogs/MDP-bloodyweakref.yml new file mode 100644 index 00000000000..1ff19b1d37e --- /dev/null +++ b/html/changelogs/MDP-bloodyweakref.yml @@ -0,0 +1,41 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: MoondancerPony + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - backend: "Gloves and mobs no longer keep a hardref to the mob whose blood they are covered in."