diff --git a/code/game/machinery/bioprinter.dm b/code/game/machinery/bioprinter.dm index 23d00318ea8..edb21409cf8 100644 --- a/code/game/machinery/bioprinter.dm +++ b/code/game/machinery/bioprinter.dm @@ -45,10 +45,12 @@ else if(loaded_dna) visible_message("The printer injects the stored DNA into the biomass..") O.transplant_data = list() - var/mob/living/carbon/C = loaded_dna["donor"] - O.transplant_data["species"] = C.species.name - O.transplant_data["blood_type"] = loaded_dna["blood_type"] - O.transplant_data["blood_DNA"] = loaded_dna["blood_DNA"] + var/datum/weakref/W = loaded_dna["donor"] + var/mob/living/carbon/C = W.resolve() + if (C) + O.transplant_data["species"] = C.species.name + O.transplant_data["blood_type"] = loaded_dna["blood_type"] + O.transplant_data["blood_DNA"] = loaded_dna["blood_DNA"] visible_message("The bioprinter spits out a new organ.") @@ -81,4 +83,4 @@ qdel(W) return - return..() \ No newline at end of file + return..() diff --git a/code/modules/mob/living/carbon/alien/diona/diona_nymph.dm b/code/modules/mob/living/carbon/alien/diona/diona_nymph.dm index 3f06aa1bbf2..8b70e47744b 100644 --- a/code/modules/mob/living/carbon/alien/diona/diona_nymph.dm +++ b/code/modules/mob/living/carbon/alien/diona/diona_nymph.dm @@ -157,25 +157,31 @@ /mob/living/carbon/alien/diona/proc/make_blood() - if(vessel) return vessel = new/datum/reagents(600) vessel.my_atom = src - vessel.add_reagent("blood",560) - spawn(1) - fixblood() + vessel.add_reagent("blood", 560) + fixblood() /mob/living/carbon/alien/diona/proc/fixblood() for(var/datum/reagent/blood/B in vessel.reagent_list) if(B.id == "blood") - B.data = list( "donor"=src,"viruses"=null,"species"=species.name,"blood_DNA"=name,"blood_colour"= species.blood_color,"blood_type"=null, \ - "resistances"=null,"trace_chem"=null, "virus2" = null, "antibodies" = list()) - var/color = B.data["blood_colour"] - B.color = color - + B.data = list( + "donor" = WEAKREF(src), + "viruses" = null, + "species" = species.name, + "blood_DNA" = name, + "blood_colour" = species.blood_color, + "blood_type" = null, + "resistances" = null, + "trace_chem" = null, + "virus2" = null, + "antibodies" = list() + ) + B.color = B.data["blood_colour"] /mob/living/carbon/alien/diona/proc/setup_dionastats() var/MLS = (1.5 / 2.1)//Maximum energy lost per second, in total darkness diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index b2fb85136f0..7ad6b85acb3 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -1042,7 +1042,7 @@ proc/is_blind(A) for(var/datum/reagent/blood/B in vessel.reagent_list) if(B.id == "blood") B.data = list( - "donor" = src, + "donor" = WEAKREF(src), "viruses" = null, "species" = name, "blood_DNA" = md5("\ref[src]"), diff --git a/code/modules/organs/blood.dm b/code/modules/organs/blood.dm index 968d6838ca1..068650f3866 100644 --- a/code/modules/organs/blood.dm +++ b/code/modules/organs/blood.dm @@ -12,7 +12,6 @@ var/const/BLOOD_VOLUME_SURVIVE = 122 //Initializes blood vessels /mob/living/carbon/human/proc/make_blood() - if(vessel) return @@ -23,14 +22,24 @@ var/const/BLOOD_VOLUME_SURVIVE = 122 return vessel.add_reagent("blood",560) - addtimer(CALLBACK(src, .proc/fixblood), 1) + fixblood() //Resets blood data /mob/living/carbon/human/proc/fixblood() for(var/datum/reagent/blood/B in vessel.reagent_list) if(B.id == "blood") - B.data = list( "donor"=src,"viruses"=null,"species"=species.name,"blood_DNA"=dna.unique_enzymes,"blood_colour"= species.blood_color,"blood_type"=dna.b_type, \ - "resistances"=null,"trace_chem"=null, "virus2" = null, "antibodies" = list()) + B.data = list( + "donor" = WEAKREF(src), + "viruses" = null, + "species" = species.name, + "blood_DNA" = dna.unique_enzymes, + "blood_colour" = species.blood_color, + "blood_type" = dna.b_type, + "resistances" = null, + "trace_chem" = null, + "virus2" = null, + "antibodies" = list() + ) B.color = B.data["blood_colour"] // Takes care blood loss and regeneration @@ -42,16 +51,15 @@ var/const/BLOOD_VOLUME_SURVIVE = 122 return if(stat != DEAD && bodytemperature >= 170) //Dead or cryosleep people do not pump the blood. - var/blood_volume = round(vessel.get_reagent_amount("blood")) //Blood regeneration if there is some space if(blood_volume < 560 && blood_volume) var/datum/reagent/blood/B = locate() in vessel.reagent_list //Grab some blood if(B) // Make sure there's some blood at all - if(B.data["donor"] != src) //If it's not theirs, then we look for theirs + if(weakref && B.data["donor"] != weakref) //If it's not theirs, then we look for theirs - donor is a weakref here, but it should be safe to just directly compare it. for(var/datum/reagent/blood/D in vessel.reagent_list) - if(D.data["donor"] == src) + if(weakref && D.data["donor"] == weakref) B = D break @@ -164,7 +172,7 @@ var/const/BLOOD_VOLUME_SURVIVE = 122 B.volume += amount //set reagent data - B.data["donor"] = src + B.data["donor"] = WEAKREF(src) if (!B.data["virus2"]) B.data["virus2"] = list() B.data["virus2"] |= virus_copylist(src.virus2) @@ -242,9 +250,9 @@ var/const/BLOOD_VOLUME_SURVIVE = 122 /mob/living/carbon/proc/get_blood(datum/reagents/container) var/datum/reagent/blood/res = locate() in container.reagent_list //Grab some blood if(res) // Make sure there's some blood at all - if(res.data["donor"] != src) //If it's not theirs, then we look for theirs + if(weakref && res.data["donor"] != weakref) //If it's not theirs, then we look for theirs for(var/datum/reagent/blood/D in container.reagent_list) - if(D.data["donor"] == src) + if(D.data["donor"] == weakref) return D return res diff --git a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Core.dm b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Core.dm index 100f3a6ef7f..4250d3c4ee5 100644 --- a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Core.dm +++ b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Core.dm @@ -1,5 +1,15 @@ /datum/reagent/blood - data = new/list("donor" = null, "viruses" = null, "species" = "Human", "blood_DNA" = null, "blood_type" = null, "blood_colour" = "#A10808", "resistances" = null, "trace_chem" = null, "antibodies" = list()) + data = list( + "donor" = null, + "viruses" = null, + "species" = "Human", + "blood_DNA" = null, + "blood_type" = null, + "blood_colour" = "#A10808", + "resistances" = null, + "trace_chem" = null, + "antibodies" = list() + ) name = "Blood" id = "blood" reagent_state = LIQUID @@ -45,9 +55,13 @@ /datum/reagent/blood/touch_turf(var/turf/simulated/T) if(!istype(T) || volume < 3) return - if(!data["donor"] || istype(data["donor"], /mob/living/carbon/human)) + var/datum/weakref/W = data["donor"] + if (!W) blood_splatter(T, src, 1) - else if(istype(data["donor"], /mob/living/carbon/alien)) + W = W.resolve() + if(istype(W, /mob/living/carbon/human)) + blood_splatter(T, src, 1) + else if(istype(W, /mob/living/carbon/alien)) var/obj/effect/decal/cleanable/blood/B = blood_splatter(T, src, 1) if(B) B.blood_DNA["UNKNOWN DNA STRUCTURE"] = "X*" diff --git a/code/modules/research/xenoarchaeology/artifact/effects/unknown_effect_heal.dm b/code/modules/research/xenoarchaeology/artifact/effects/unknown_effect_heal.dm index 367c8e7b9d7..c7d272c26d0 100644 --- a/code/modules/research/xenoarchaeology/artifact/effects/unknown_effect_heal.dm +++ b/code/modules/research/xenoarchaeology/artifact/effects/unknown_effect_heal.dm @@ -22,8 +22,7 @@ H.adjustBrainLoss(-25 * weakness) H.apply_radiation(-1*min(H.total_radiation, 25 * weakness)) H.bodytemperature = initial(H.bodytemperature) - spawn(1) - H.fixblood() + H.fixblood() // C.adjustOxyLoss(-25 * weakness) C.adjustToxLoss(-25 * weakness)