Dramatically Cuts Object Processing Down (#13564)

This commit is contained in:
Fox McCloud
2020-06-07 17:32:25 -04:00
committed by GitHub
parent f4a0790514
commit 40968ce907
6 changed files with 62 additions and 48 deletions
-17
View File
@@ -13,7 +13,6 @@
var/list/datum/reagent/addiction_list = new/list()
var/list/addiction_threshold_accumulated = new/list()
var/flags
var/list/reagents_generated_per_cycle = new/list()
/datum/reagents/New(maximum = 100, temperature_minimum, temperature_maximum)
maximum_volume = maximum
@@ -21,8 +20,6 @@
temperature_min = temperature_minimum
if(temperature_maximum)
temperature_max = temperature_maximum
if(!(flags & REAGENT_NOREACT))
START_PROCESSING(SSobj, src)
//I dislike having these here but map-objects are initialised before world/New() is called. >_>
if(!GLOB.chemical_reagents_list)
//Chemical Reagents - Initialises all /datum/reagent into a list indexed by reagent id
@@ -361,23 +358,10 @@
od_chems.Add(R.id)
return od_chems
/datum/reagents/process()
if(flags & REAGENT_NOREACT)
STOP_PROCESSING(SSobj, src)
return
for(var/thing in reagents_generated_per_cycle)
add_reagent(thing, reagents_generated_per_cycle[thing])
for(var/datum/reagent/R in reagent_list)
R.on_tick()
/datum/reagents/proc/set_reacting(react = TRUE)
if(react)
// Order is important, process() can remove from processing if
// the flag is present
flags &= ~(REAGENT_NOREACT)
START_PROCESSING(SSobj, src)
else
STOP_PROCESSING(SSobj, src)
flags |= REAGENT_NOREACT
/*
@@ -906,7 +890,6 @@
/datum/reagents/Destroy()
. = ..()
STOP_PROCESSING(SSobj, src)
QDEL_LIST(reagent_list)
reagent_list = null
QDEL_LIST(addiction_list)
+4 -2
View File
@@ -120,8 +120,10 @@
return
// Called every time reagent containers process.
/datum/reagent/proc/on_tick(data)
return
/datum/reagent/process()
if(!holder || holder.flags & REAGENT_NOREACT)
return FALSE
return TRUE
// Called when the reagent container is hit by an explosion
/datum/reagent/proc/on_ex_act(severity)
@@ -333,19 +333,26 @@
process_flags = ORGANIC | SYNTHETIC
taste_description = "bitterness"
/datum/reagent/cryostylane/on_new(data)
..()
START_PROCESSING(SSprocessing, src)
/datum/reagent/cryostylane/Destroy()
STOP_PROCESSING(SSprocessing, src)
return ..()
/datum/reagent/cryostylane/on_mob_life(mob/living/M) //TODO: code freezing into an ice cube
if(M.reagents.has_reagent("oxygen"))
M.reagents.remove_reagent("oxygen", 1)
M.bodytemperature -= 30
return ..()
/datum/reagent/cryostylane/on_tick()
if(holder.has_reagent("oxygen"))
holder.remove_reagent("oxygen", 2)
holder.remove_reagent("cryostylane", 2)
holder.temperature_reagents(holder.chem_temp - 200)
holder.temperature_reagents(holder.chem_temp - 200)
..()
/datum/reagent/cryostylane/process()
if(..())
if(holder.has_reagent("oxygen"))
holder.remove_reagent("oxygen", 2)
holder.remove_reagent("cryostylane", 2)
holder.temperature_reagents(holder.chem_temp - 200)
/datum/reagent/cryostylane/reaction_mob(mob/living/M, method = REAGENT_TOUCH, volume)
if(method == REAGENT_TOUCH)
@@ -368,19 +375,26 @@
process_flags = ORGANIC | SYNTHETIC
taste_description = "bitterness"
/datum/reagent/pyrosium/on_new(data)
..()
START_PROCESSING(SSprocessing, src)
/datum/reagent/pyrosium/Destroy()
STOP_PROCESSING(SSprocessing, src)
return ..()
/datum/reagent/pyrosium/on_mob_life(mob/living/M)
if(M.reagents.has_reagent("oxygen"))
M.reagents.remove_reagent("oxygen", 1)
M.bodytemperature += 30
return ..()
/datum/reagent/pyrosium/on_tick()
if(holder.has_reagent("oxygen"))
holder.remove_reagent("oxygen", 2)
holder.remove_reagent("pyrosium", 2)
holder.temperature_reagents(holder.chem_temp + 200)
holder.temperature_reagents(holder.chem_temp + 200)
..()
/datum/reagent/pyrosium/process()
if(..())
if(holder.has_reagent("oxygen"))
holder.remove_reagent("oxygen", 2)
holder.remove_reagent("pyrosium", 2)
holder.temperature_reagents(holder.chem_temp + 200)
/datum/reagent/firefighting_foam
name = "Firefighting foam"
@@ -192,6 +192,14 @@
color = "#7DFF00"
taste_description = "slime"
/datum/reagent/stable_mutagen/on_new(data)
..()
START_PROCESSING(SSprocessing, src)
/datum/reagent/stable_mutagen/Destroy()
STOP_PROCESSING(SSprocessing, src)
return ..()
/datum/reagent/stable_mutagen/on_mob_life(mob/living/M)
if(!ishuman(M) || !M.dna)
return
@@ -212,11 +220,11 @@
return ..()
/datum/reagent/stable_mutagen/on_tick()
var/datum/reagent/blood/B = locate() in holder.reagent_list
if(B && islist(B.data) && !data)
data = B.data.Copy()
..()
/datum/reagent/stable_mutagen/process()
if(..())
var/datum/reagent/blood/B = locate() in holder.reagent_list
if(B && islist(B.data) && !data)
data = B.data.Copy()
/datum/reagent/romerol
name = "romerol"