diff --git a/code/__DEFINES/objects.dm b/code/__DEFINES/objects.dm index d495c8e8c012..d839789d1664 100644 --- a/code/__DEFINES/objects.dm +++ b/code/__DEFINES/objects.dm @@ -155,7 +155,9 @@ GLOBAL_LIST_INIT(RESTRICTED_CAMERA_NETWORKS, list( //Those networks can only be #define RESULT_REQUIRES_SNOW (1<<0) +/// Reaction type from touching it #define TOUCH 1 +/// Reaction type from eating it #define INGEST 2 /// Marks an object as organic. Used for alien structures and any other organic material diff --git a/code/game/machinery/cryo.dm b/code/game/machinery/cryo.dm index 6643cd6b805c..5a328386c95d 100644 --- a/code/game/machinery/cryo.dm +++ b/code/game/machinery/cryo.dm @@ -252,7 +252,7 @@ if(can_administer) beaker.reagents.trans_to(occupant, 5) - beaker.reagents.reaction(occupant) + beaker.reagents.reaction(occupant, permeable_in_mobs = FALSE) if(autoeject) //release the patient automatically when brute and burn are handled on non-robotic limbs diff --git a/code/game/objects/effects/effect_system/chemsmoke.dm b/code/game/objects/effects/effect_system/chemsmoke.dm index 0c74912ceb25..55c38215415c 100644 --- a/code/game/objects/effects/effect_system/chemsmoke.dm +++ b/code/game/objects/effects/effect_system/chemsmoke.dm @@ -138,7 +138,7 @@ var/dist = cheap_pythag(T.x - location.x, T.y - location.y) if(!dist) dist = 1 - R.reaction_mob(A, volume = R.volume / dist) + R.reaction_mob(A, volume = R.volume / dist, permeable = FALSE) else if(istype(A, /obj)) R.reaction_obj(A, R.volume) sleep(30) diff --git a/code/modules/reagents/Chemistry-Holder.dm b/code/modules/reagents/Chemistry-Holder.dm index 73a254d1fdd6..2ff9554f26a0 100644 --- a/code/modules/reagents/Chemistry-Holder.dm +++ b/code/modules/reagents/Chemistry-Holder.dm @@ -359,12 +359,12 @@ del_reagent(R.id) return FALSE -/datum/reagents/proc/reaction(atom/A, method=TOUCH, volume_modifier=0) +/datum/reagents/proc/reaction(atom/A, method=TOUCH, volume_modifier=0, permeable_in_mobs=TRUE) if(method != TOUCH && method != INGEST) return for(var/datum/reagent/R in reagent_list) if(ismob(A)) - R.reaction_mob(A, method, R.volume + volume_modifier) + R.reaction_mob(A, method, R.volume + volume_modifier, permeable_in_mobs) else if(isturf(A)) R.reaction_turf(A, R.volume + volume_modifier) else if(isobj(A)) diff --git a/code/modules/reagents/Chemistry-Reagents.dm b/code/modules/reagents/Chemistry-Reagents.dm index b8c3d20df671..9825c12501c0 100644 --- a/code/modules/reagents/Chemistry-Reagents.dm +++ b/code/modules/reagents/Chemistry-Reagents.dm @@ -83,43 +83,42 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent()) for(var/datum/chem_property/P in properties) P.post_update_reagent() -/datum/reagent/proc/reaction_mob(mob/M, method=TOUCH, volume) //By default we have a chance to transfer some - if(!istype(M, /mob/living)) return 0 +/datum/reagent/proc/reaction_mob(mob/M, method=TOUCH, volume, permeable) //By default we have a chance to transfer some + if(!istype(M, /mob/living)) + return FALSE var/datum/reagent/self = src src = null //of the reagent to the mob on TOUCHING it. if(self.holder) //for catching rare runtimes - if(!istype(self.holder.my_atom, /obj/effect/particle_effect/smoke/chem)) + if(method == TOUCH && permeable && !istype(self.holder.my_atom, /obj/effect/particle_effect/smoke/chem)) // If the chemicals are in a smoke cloud, do not try to let the chemicals "penetrate" into the mob's system (balance station 13) -- Doohl + var/chance = 1 + var/block = FALSE - if(method == TOUCH) - - var/chance = 1 - var/block = 0 + for(var/obj/item/clothing/clothing in M.get_equipped_items()) + if(clothing.permeability_coefficient < chance) + chance = clothing.permeability_coefficient + if(istype(clothing, /obj/item/clothing/suit/bio_suit)) + // bio suits are just about completely fool-proof - Doohl + // kind of a hacky way of making bio suits more resistant to chemicals but w/e + if(prob(75)) + block = TRUE - for(var/obj/item/clothing/C in M.get_equipped_items()) - if(C.permeability_coefficient < chance) chance = C.permeability_coefficient - if(istype(C, /obj/item/clothing/suit/bio_suit)) - // bio suits are just about completely fool-proof - Doohl - // kind of a hacky way of making bio suits more resistant to chemicals but w/e - if(prob(75)) - block = 1 + if(istype(clothing, /obj/item/clothing/head/bio_hood)) + if(prob(75)) + block = TRUE - if(istype(C, /obj/item/clothing/head/bio_hood)) - if(prob(75)) - block = 1 + chance *= 100 - chance = chance * 100 + if(prob(chance) && !block) + if(M.reagents) + M.reagents.add_reagent(self.id, self.volume * 0.5) - if(prob(chance) && !block) - if(M.reagents) - M.reagents.add_reagent(self.id,self.volume/2) - for(var/datum/chem_property/P in self.properties) - var/potency = P.level * 0.5 - P.reaction_mob(M, method, volume, potency) + for(var/datum/chem_property/property in self.properties) + var/potency = property.level * 0.5 + property.reaction_mob(M, method, volume, potency) - - return 1 + return TRUE /datum/reagent/proc/reaction_obj(obj/O, volume) for(var/datum/chem_property/P in properties) diff --git a/code/modules/reagents/chemistry_reagents/food.dm b/code/modules/reagents/chemistry_reagents/food.dm index 2ee2a05bef32..939772825408 100644 --- a/code/modules/reagents/chemistry_reagents/food.dm +++ b/code/modules/reagents/chemistry_reagents/food.dm @@ -150,7 +150,7 @@ chemclass = CHEM_CLASS_RARE properties = list(PROPERTY_HYPERTHERMIC = 1) -/datum/reagent/condensedcapsaicin/reaction_mob(mob/living/M, method=TOUCH, volume) +/datum/reagent/condensedcapsaicin/reaction_mob(mob/living/M, method=TOUCH, volume, permeable) if(!istype(M, /mob/living) || has_species(M,"Horror")) return diff --git a/code/modules/reagents/chemistry_reagents/other.dm b/code/modules/reagents/chemistry_reagents/other.dm index ae1a42bd5e6d..35a0d1c7db38 100644 --- a/code/modules/reagents/chemistry_reagents/other.dm +++ b/code/modules/reagents/chemistry_reagents/other.dm @@ -13,7 +13,7 @@ chemclass = CHEM_CLASS_RARE -/datum/reagent/blood/reaction_mob(mob/M, method=TOUCH, volume) +/datum/reagent/blood/reaction_mob(mob/M, method=TOUCH, volume, permeable) var/datum/reagent/blood/self = src src = null if(self.data_properties && self.data_properties["viruses"]) @@ -85,7 +85,7 @@ color = "#C81040" // rgb: 200, 16, 64 properties = list(PROPERTY_CURING = 4) -/datum/reagent/vaccine/reaction_mob(mob/M, method=TOUCH, volume) +/datum/reagent/vaccine/reaction_mob(mob/M, method=TOUCH, volume, permeable) if(has_species(M,"Horror")) return var/datum/reagent/vaccine/self = src @@ -124,7 +124,7 @@ src = null O.extinguish() -/datum/reagent/water/reaction_mob(mob/living/M, method=TOUCH, volume)//Splashing people with water can help put them out! +/datum/reagent/water/reaction_mob(mob/living/M, method=TOUCH, volume, permeable)//Splashing people with water can help put them out! if(!istype(M, /mob/living)) return if(method == TOUCH) @@ -517,7 +517,7 @@ if(volume >= 1 && istype(T)) T.clean_cleanables() -/datum/reagent/space_cleaner/reaction_mob(mob/M, method=TOUCH, volume) +/datum/reagent/space_cleaner/reaction_mob(mob/M, method=TOUCH, volume, permeable) if(iscarbon(M)) var/mob/living/carbon/C = M if(C.r_hand) @@ -592,7 +592,7 @@ reagent_state = LIQUID color = "#535E66" // rgb: 83, 94, 102 -/datum/reagent/xenomicrobes/reaction_mob(mob/M, method=TOUCH, volume) +/datum/reagent/xenomicrobes/reaction_mob(mob/M, method=TOUCH, volume, permeable) src = null if((prob(10) && method==TOUCH) || method==INGEST) M.contract_disease(new /datum/disease/xeno_transformation(0),1) @@ -664,7 +664,7 @@ custom_metabolism = 100 //disappears immediately properties = list(PROPERTY_RAVENING = 1) -/datum/reagent/blackgoo/reaction_mob(mob/M, method=TOUCH, volume) +/datum/reagent/blackgoo/reaction_mob(mob/M, method=TOUCH, volume, permeable) if(ishuman(M)) var/mob/living/carbon/human/H = M if(H.species.name == "Human")