From 334808a4fc17aea48ae374c0d80c6027eb52e190 Mon Sep 17 00:00:00 2001 From: Geeves Date: Sun, 1 Aug 2021 20:22:53 +0200 Subject: [PATCH] Trace Chems Runtime Fix (#12282) * Trace Chems Runtime Fix * more robust solution --- code/modules/mob/living/carbon/human/life.dm | 2 +- code/modules/reagents/Chemistry-Reagents.dm | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index ebb49d1705b..e73dc5a0292 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -696,7 +696,7 @@ // TODO: stomach and bloodstream organ. if(!isSynthetic()) handle_trace_chems() - if(!(species.flags & NO_BLOOD)) + if(vessel && (/decl/reagent/blood in vessel.reagent_data)) // update the trace chems in our blood vessels var/decl/reagent/blood/B = decls_repository.get_decl(/decl/reagent/blood) B.handle_trace_chems(vessel) diff --git a/code/modules/reagents/Chemistry-Reagents.dm b/code/modules/reagents/Chemistry-Reagents.dm index af33750316f..af485fddede 100644 --- a/code/modules/reagents/Chemistry-Reagents.dm +++ b/code/modules/reagents/Chemistry-Reagents.dm @@ -46,10 +46,11 @@ holder.remove_reagent(type, amount) // Don't typecheck this, fix anywhere this is called with a null holder. if(ishuman(holder.my_atom)) var/mob/living/carbon/human/H = holder.my_atom - if(H.vessel.reagent_data[/decl/reagent/blood]["trace_chem"][type]) - H.vessel.reagent_data[/decl/reagent/blood]["trace_chem"][type] += amount - else - H.vessel.reagent_data[/decl/reagent/blood]["trace_chem"][type] = amount + if(H.vessel && (/decl/reagent/blood in H.vessel.reagent_data)) + if(H.vessel.reagent_data[/decl/reagent/blood]["trace_chem"][type]) + H.vessel.reagent_data[/decl/reagent/blood]["trace_chem"][type] += amount + else + H.vessel.reagent_data[/decl/reagent/blood]["trace_chem"][type] = amount // This doesn't apply to skin contact - this is for, e.g. extinguishers and sprays. The difference is that reagent is not directly on the mob's skin - it might just be on their clothing. /decl/reagent/proc/touch_mob(var/mob/living/M, var/amount, var/datum/reagents/holder)