mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-13 03:33:21 +00:00
Moves metabolism to a holder subtype
This commit is contained in:
@@ -1472,6 +1472,7 @@
|
|||||||
#include "code\modules\reagents\Chemistry-Colours.dm"
|
#include "code\modules\reagents\Chemistry-Colours.dm"
|
||||||
#include "code\modules\reagents\Chemistry-Holder.dm"
|
#include "code\modules\reagents\Chemistry-Holder.dm"
|
||||||
#include "code\modules\reagents\Chemistry-Machinery.dm"
|
#include "code\modules\reagents\Chemistry-Machinery.dm"
|
||||||
|
#include "code\modules\reagents\Chemistry-Metabolism.dm"
|
||||||
#include "code\modules\reagents\Chemistry-Readme.dm"
|
#include "code\modules\reagents\Chemistry-Readme.dm"
|
||||||
#include "code\modules\reagents\Chemistry-Reagents.dm"
|
#include "code\modules\reagents\Chemistry-Reagents.dm"
|
||||||
#include "code\modules\reagents\Chemistry-Recipes.dm"
|
#include "code\modules\reagents\Chemistry-Recipes.dm"
|
||||||
|
|||||||
@@ -108,12 +108,9 @@
|
|||||||
chem_effects.Cut()
|
chem_effects.Cut()
|
||||||
analgesic = 0
|
analgesic = 0
|
||||||
|
|
||||||
if(touching)
|
if(touching) touching.metabolize()
|
||||||
touching.metabolize(0, CHEM_TOUCH)
|
if(ingested) ingested.metabolize()
|
||||||
if(ingested)
|
if(bloodstr) bloodstr.metabolize()
|
||||||
ingested.metabolize(0, CHEM_INGEST)
|
|
||||||
if(reagents)
|
|
||||||
reagents.metabolize(0, CHEM_BLOOD)
|
|
||||||
|
|
||||||
if(CE_PAINKILLER in chem_effects)
|
if(CE_PAINKILLER in chem_effects)
|
||||||
analgesic = chem_effects[CE_PAINKILLER]
|
analgesic = chem_effects[CE_PAINKILLER]
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
/mob/living/carbon/New()
|
/mob/living/carbon/New()
|
||||||
create_reagents(1000)
|
//setup reagent holders
|
||||||
var/datum/reagents/R1 = new/datum/reagents(1000)
|
bloodstr = new/datum/reagents/metabolism(1000, src, CHEM_BLOOD)
|
||||||
var/datum/reagents/R2 = new/datum/reagents(1000)
|
ingested = new/datum/reagents/metabolism(1000, src, CHEM_INGEST)
|
||||||
ingested = R1
|
touching = new/datum/reagents/metabolism(1000, src, CHEM_TOUCH)
|
||||||
touching = R2
|
reagents = bloodstr
|
||||||
R1.my_atom = src
|
|
||||||
R2.my_atom = src
|
|
||||||
..()
|
..()
|
||||||
|
|
||||||
/mob/living/carbon/Life()
|
/mob/living/carbon/Life()
|
||||||
|
|||||||
@@ -18,7 +18,8 @@
|
|||||||
//Active emote/pose
|
//Active emote/pose
|
||||||
var/pose = null
|
var/pose = null
|
||||||
var/list/chem_effects = list()
|
var/list/chem_effects = list()
|
||||||
var/datum/reagents/ingested = null
|
var/datum/reagents/metabolism/bloodstr = null
|
||||||
var/datum/reagents/touching = null
|
var/datum/reagents/metabolism/ingested = null
|
||||||
|
var/datum/reagents/metabolism/touching = null
|
||||||
|
|
||||||
var/pulse = PULSE_NORM //current pulse level
|
var/pulse = PULSE_NORM //current pulse level
|
||||||
|
|||||||
@@ -858,15 +858,14 @@
|
|||||||
|
|
||||||
proc/handle_chemicals_in_body()
|
proc/handle_chemicals_in_body()
|
||||||
|
|
||||||
if(reagents && !(species.flags & IS_SYNTHETIC)) //Synths don't process reagents.
|
if(!(species.flags & IS_SYNTHETIC)) //Synths don't process reagents.
|
||||||
chem_effects.Cut()
|
chem_effects.Cut()
|
||||||
analgesic = 0
|
analgesic = 0
|
||||||
var/alien = 0
|
|
||||||
if(species && species.reagent_tag)
|
if(touching) touching.metabolize()
|
||||||
alien = species.reagent_tag
|
if(ingested) ingested.metabolize()
|
||||||
touching.metabolize(alien, CHEM_TOUCH)
|
if(bloodstr) bloodstr.metabolize()
|
||||||
ingested.metabolize(alien, CHEM_INGEST)
|
|
||||||
reagents.metabolize(alien, CHEM_BLOOD)
|
|
||||||
if(CE_PAINKILLER in chem_effects)
|
if(CE_PAINKILLER in chem_effects)
|
||||||
analgesic = chem_effects[CE_PAINKILLER]
|
analgesic = chem_effects[CE_PAINKILLER]
|
||||||
|
|
||||||
|
|||||||
@@ -85,12 +85,9 @@
|
|||||||
chem_effects.Cut()
|
chem_effects.Cut()
|
||||||
analgesic = 0
|
analgesic = 0
|
||||||
|
|
||||||
if(touching)
|
if(touching) touching.metabolize()
|
||||||
touching.metabolize(0, CHEM_TOUCH)
|
if(ingested) ingested.metabolize()
|
||||||
if(ingested)
|
if(bloodstr) bloodstr.metabolize()
|
||||||
ingested.metabolize(0, CHEM_INGEST)
|
|
||||||
if(reagents)
|
|
||||||
reagents.metabolize(0, CHEM_BLOOD)
|
|
||||||
|
|
||||||
if(CE_PAINKILLER in chem_effects)
|
if(CE_PAINKILLER in chem_effects)
|
||||||
analgesic = chem_effects[CE_PAINKILLER]
|
analgesic = chem_effects[CE_PAINKILLER]
|
||||||
|
|||||||
@@ -4,8 +4,10 @@
|
|||||||
var/maximum_volume = 100
|
var/maximum_volume = 100
|
||||||
var/atom/my_atom = null
|
var/atom/my_atom = null
|
||||||
|
|
||||||
/datum/reagents/New(var/max = 100)
|
/datum/reagents/New(var/max = 100, atom/A = null)
|
||||||
maximum_volume = max
|
maximum_volume = max
|
||||||
|
my_atom = A
|
||||||
|
|
||||||
//I dislike having these here but map-objects are initialised before world/New() is called. >_>
|
//I dislike having these here but map-objects are initialised before world/New() is called. >_>
|
||||||
if(!chemical_reagents_list)
|
if(!chemical_reagents_list)
|
||||||
//Chemical Reagents - Initialises all /datum/reagent into a list indexed by reagent id
|
//Chemical Reagents - Initialises all /datum/reagent into a list indexed by reagent id
|
||||||
@@ -414,18 +416,7 @@
|
|||||||
|
|
||||||
return trans_to_holder(target.reagents, amount, multiplier, copy)
|
return trans_to_holder(target.reagents, amount, multiplier, copy)
|
||||||
|
|
||||||
/datum/reagents/proc/metabolize(var/alien, var/location)
|
|
||||||
if(!iscarbon(my_atom))
|
|
||||||
return
|
|
||||||
var/mob/living/carbon/C = my_atom
|
|
||||||
if(!C || !istype(C))
|
|
||||||
return
|
|
||||||
for(var/datum/reagent/current in reagent_list)
|
|
||||||
current.on_mob_life(C, alien, location)
|
|
||||||
update_total()
|
|
||||||
|
|
||||||
/* Atom reagent creation - use it all the time */
|
/* Atom reagent creation - use it all the time */
|
||||||
|
|
||||||
/atom/proc/create_reagents(var/max_vol)
|
/atom/proc/create_reagents(var/max_vol)
|
||||||
reagents = new/datum/reagents(max_vol)
|
reagents = new/datum/reagents(max_vol, src)
|
||||||
reagents.my_atom = src
|
|
||||||
|
|||||||
@@ -1,17 +1,21 @@
|
|||||||
/datum/reagents/metabolism
|
/datum/reagents/metabolism
|
||||||
var/metabolism_type
|
var/metabolism_class //CHEM_TOUCH, CHEM_INGEST, or CHEM_BLOOD
|
||||||
|
var/mob/living/carbon/parent
|
||||||
|
|
||||||
/datum/reagents/metabolism/New(var/max = 100, var/met_type, mob/living/carbon/parent_mob)
|
/datum/reagents/metabolism/New(var/max = 100, mob/living/carbon/parent_mob, var/met_class)
|
||||||
..()
|
..(max, parent_mob)
|
||||||
metabolism_type = met_type
|
|
||||||
my_atom = parent_mob
|
metabolism_class = met_class
|
||||||
|
if(istype(parent_mob))
|
||||||
|
parent = parent_mob
|
||||||
|
|
||||||
/datum/reagents/proc/metabolize(var/alien)
|
/datum/reagents/metabolism/proc/metabolize()
|
||||||
if(!iscarbon(my_atom))
|
|
||||||
return
|
var/metabolism_type = 0 //non-human mobs
|
||||||
var/mob/living/carbon/C = my_atom
|
if(ishuman(parent))
|
||||||
if(!C || !istype(C))
|
var/mob/living/carbon/human/H = parent
|
||||||
return
|
metabolism_type = H.species.reagent_tag
|
||||||
|
|
||||||
for(var/datum/reagent/current in reagent_list)
|
for(var/datum/reagent/current in reagent_list)
|
||||||
current.on_mob_life(C, alien, metabolism_type)
|
current.on_mob_life(parent, metabolism_type, metabolism_class)
|
||||||
update_total()
|
update_total()
|
||||||
Reference in New Issue
Block a user