mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 12:07:27 +01:00
Refactors reagent shock reduction (#28385)
* makes reagent shock reduction only apply to mobs that can process them * Update code/modules/mob/living/carbon/human/human_life.dm Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com> Signed-off-by: chuga-git <98280110+chuga-git@users.noreply.github.com> --------- Signed-off-by: chuga-git <98280110+chuga-git@users.noreply.github.com> Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
This commit is contained in:
@@ -290,16 +290,6 @@
|
||||
R.handle_reactions()
|
||||
return amount
|
||||
|
||||
/datum/reagents/proc/can_metabolize(mob/living/carbon/human/H, datum/reagent/R)
|
||||
if(!H.dna.species || !H.dna.species.reagent_tag)
|
||||
return FALSE
|
||||
if((R.process_flags & SYNTHETIC) && (H.dna.species.reagent_tag & PROCESS_SYN)) //SYNTHETIC-oriented reagents require PROCESS_SYN
|
||||
return TRUE
|
||||
if((R.process_flags & ORGANIC) && (H.dna.species.reagent_tag & PROCESS_ORG)) //ORGANIC-oriented reagents require PROCESS_ORG
|
||||
return TRUE
|
||||
//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.dna.species.reagent_tag & PROCESS_DUO))
|
||||
return TRUE
|
||||
|
||||
/**
|
||||
* Called by `/mob/living/proc/Life`. You shouldn't have to use this one directly.
|
||||
@@ -327,7 +317,7 @@
|
||||
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
|
||||
var/can_process = can_metabolize(H, R)
|
||||
var/can_process = H.can_metabolize(R)
|
||||
//If handle_reagents returns 0, it's doing the reagent removal on its own
|
||||
var/species_handled = !(H.dna.species.handle_reagents(H, R))
|
||||
can_process = can_process && !species_handled
|
||||
@@ -559,9 +549,10 @@
|
||||
for(var/A in cached_reagents)
|
||||
var/datum/reagent/R = A
|
||||
if(R.id == reagent)
|
||||
if(ishuman(my_atom) && can_metabolize(my_atom, R))
|
||||
var/mob/living/carbon/human/M = my_atom
|
||||
R.on_mob_delete(M)
|
||||
if(ishuman(my_atom))
|
||||
var/mob/living/carbon/human/human = my_atom
|
||||
if(human.can_metabolize(R))
|
||||
R.on_mob_delete(human)
|
||||
cached_reagents -= A
|
||||
qdel(A)
|
||||
update_total()
|
||||
@@ -714,13 +705,13 @@
|
||||
|
||||
var/datum/reagent/D = GLOB.chemical_reagents_list[reagent]
|
||||
if(D)
|
||||
|
||||
var/datum/reagent/R = new D.type()
|
||||
cached_reagents += R
|
||||
R.holder = src
|
||||
R.volume = amount
|
||||
if(ishuman(my_atom))
|
||||
if(can_metabolize(my_atom, R))
|
||||
var/mob/living/carbon/human/human = my_atom
|
||||
if(human.can_metabolize(R))
|
||||
R.on_new(data)
|
||||
else
|
||||
R.on_new(data)
|
||||
@@ -728,11 +719,15 @@
|
||||
if(data)
|
||||
R.data = data
|
||||
|
||||
if(ishuman(my_atom) && can_metabolize(my_atom, R))
|
||||
R.on_mob_add(my_atom) //Must occur befor it could posibly run on_mob_delete
|
||||
if(ishuman(my_atom))
|
||||
var/mob/living/carbon/human/human = my_atom
|
||||
if(human.can_metabolize(R))
|
||||
R.on_mob_add(my_atom) //Must occur before it could posibly run on_mob_delete
|
||||
|
||||
update_total()
|
||||
if(my_atom)
|
||||
my_atom.on_reagent_change()
|
||||
|
||||
if(!no_react)
|
||||
temperature_react()
|
||||
handle_reactions()
|
||||
|
||||
Reference in New Issue
Block a user