Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix additional cryo reagent duplication via TOUCH reaction #6122

Merged
merged 5 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions code/__DEFINES/objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/cryo.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/effects/effect_system/chemsmoke.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions code/modules/reagents/Chemistry-Holder.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
51 changes: 25 additions & 26 deletions code/modules/reagents/Chemistry-Reagents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/reagents/chemistry_reagents/food.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 6 additions & 6 deletions code/modules/reagents/chemistry_reagents/other.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand Down
Loading