Moves metabolism to a holder subtype

This commit is contained in:
mwerezak
2015-06-13 18:37:51 -04:00
committed by HarpyEagle
parent 70433b4367
commit 73333ac9c8
8 changed files with 43 additions and 54 deletions

View File

@@ -4,8 +4,10 @@
var/maximum_volume = 100
var/atom/my_atom = null
/datum/reagents/New(var/max = 100)
maximum_volume = max
/datum/reagents/New(var/max = 100, atom/A = null)
maximum_volume = max
my_atom = A
//I dislike having these here but map-objects are initialised before world/New() is called. >_>
if(!chemical_reagents_list)
//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)
/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/proc/create_reagents(var/max_vol)
reagents = new/datum/reagents(max_vol)
reagents.my_atom = src
reagents = new/datum/reagents(max_vol, src)

View File

@@ -1,17 +1,21 @@
/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)
..()
metabolism_type = met_type
my_atom = parent_mob
/datum/reagents/metabolism/New(var/max = 100, mob/living/carbon/parent_mob, var/met_class)
..(max, parent_mob)
metabolism_class = met_class
if(istype(parent_mob))
parent = parent_mob
/datum/reagents/proc/metabolize(var/alien)
if(!iscarbon(my_atom))
return
var/mob/living/carbon/C = my_atom
if(!C || !istype(C))
return
/datum/reagents/metabolism/proc/metabolize()
var/metabolism_type = 0 //non-human mobs
if(ishuman(parent))
var/mob/living/carbon/human/H = parent
metabolism_type = H.species.reagent_tag
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()