From f3c9098ecdda6f581b01ebcd06da4742b4e2dac2 Mon Sep 17 00:00:00 2001 From: FalseIncarnate Date: Tue, 23 Jun 2015 18:06:54 -0400 Subject: [PATCH] Reaction_Mob Checks and Golem Reagent Processing Change Reaction_mob(), which handles things like TOUCH based reactions, now will properly obey process_flags. - This means things like Synthflesh won't work on Synthetics. Changed Golems from PROCESS_DUO to PROCESS_ORG - This will give them back the ability to be healed via chemistry, since they don't naturally regenerate. - PROCESS_DUO remains defined in case someone finds a use for it (adminbuse maybe?) --- .../mob/living/carbon/human/species/golem.dm | 2 +- code/modules/reagents/Chemistry-Holder.dm | 33 +++++++++++++++++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/code/modules/mob/living/carbon/human/species/golem.dm b/code/modules/mob/living/carbon/human/species/golem.dm index e29ca352f65..cfc0eb08207 100644 --- a/code/modules/mob/living/carbon/human/species/golem.dm +++ b/code/modules/mob/living/carbon/human/species/golem.dm @@ -7,7 +7,7 @@ default_language = "Galactic Common" flags = NO_BREATHE | NO_PAIN | NO_BLOOD | NO_SCAN dietflags = DIET_OMNI //golems can eat anything because they are magic or something - reagent_tag = PROCESS_DUO //golems only process a select few chems like acid and hellwater because magic? + reagent_tag = PROCESS_ORG blood_color = "#515573" flesh_color = "#137E8F" diff --git a/code/modules/reagents/Chemistry-Holder.dm b/code/modules/reagents/Chemistry-Holder.dm index 722c75da1c6..91392283ac5 100644 --- a/code/modules/reagents/Chemistry-Holder.dm +++ b/code/modules/reagents/Chemistry-Holder.dm @@ -404,6 +404,27 @@ datum del_reagent(R.id) return 0 + reaction_check(var/mob/M, var/datum/reagent/R) + var/can_process = 0 + if(!istype(M, /mob/living)) //Non-living mobs can't metabolize reagents, so don't bother trying (runtime safety check) + return can_process + if(ishuman(M)) + var/mob/living/carbon/human/H = M + //Check if this mob's species is set and can process this type of reagent + if(H.species && H.species.reagent_tag) + if((R.process_flags & SYNTHETIC) && (H.species.reagent_tag & PROCESS_SYN)) //SYNTHETIC-oriented reagents require PROCESS_SYN + can_process = 1 + if((R.process_flags & ORGANIC) && (H.species.reagent_tag & PROCESS_ORG)) //ORGANIC-oriented reagents require PROCESS_ORG + can_process = 1 + //Species with PROCESS_DUO are only affected by reagents that affect both organics and synthetics, like acid and hellwater + if((R.process_flags & ORGANIC) && (R.process_flags & SYNTHETIC) && (H.species.reagent_tag & PROCESS_DUO)) + can_process = 1 + //We'll assume that non-human mobs lack the ability to process synthetic-oriented reagents (adjust this if we need to change that assumption) + else + if(R.process_flags != SYNTHETIC) + can_process = 1 + return can_process + reaction(var/atom/A, var/method=TOUCH, var/volume_modifier=0) switch(method) @@ -412,7 +433,11 @@ datum if(ismob(A)) spawn(0) if(!R) return - else R.reaction_mob(A, TOUCH, R.volume+volume_modifier) + var/check = reaction_check(A, R) + if(!check) + continue + else + R.reaction_mob(A, TOUCH, R.volume+volume_modifier) if(isturf(A)) spawn(0) if(!R) return @@ -426,7 +451,11 @@ datum if(ismob(A) && R) spawn(0) if(!R) return - else R.reaction_mob(A, INGEST, R.volume+volume_modifier) + var/check = reaction_check(A, R) + if(!check) + continue + else + R.reaction_mob(A, INGEST, R.volume+volume_modifier) if(isturf(A) && R) spawn(0) if(!R) return