var/datum/controller/subsystem/chemistry/SSchemistry /datum/controller/subsystem/chemistry name = "Chemistry" flags = SS_NO_INIT priority = SS_PRIORITY_CHEMISTRY var/list/active_holders var/list/chemical_reactions var/list/chemical_reagents var/tmp/list/processing_holders = list() /datum/controller/subsystem/chemistry/stat_entry() ..("AH:[active_holders.len]") /datum/controller/subsystem/chemistry/New() NEW_SS_GLOBAL(SSchemistry) active_holders = list() chemical_reactions = chemical_reactions_list chemical_reagents = chemical_reagents_list /datum/controller/subsystem/chemistry/fire(resumed = FALSE) if (!resumed) processing_holders = active_holders.Copy() while (processing_holders.len) var/datum/reagents/holder = processing_holders[processing_holders.len] processing_holders.len-- if (QDELETED(holder)) active_holders -= holder log_debug("SSchemistry: QDELETED holder found in processing list!") if (MC_TICK_CHECK) return continue if (!holder.process_reactions()) active_holders -= holder if (MC_TICK_CHECK) return /datum/controller/subsystem/chemistry/proc/mark_for_update(var/datum/reagents/holder) if (holder in active_holders) return //Process once, right away. If we still need to continue then add to the active_holders list and continue later if (holder.process_reactions()) active_holders += holder /datum/controller/subsystem/chemistry/Recover() src.active_holders = SSchemistry.active_holders src.chemical_reactions = SSchemistry.chemical_reactions src.chemical_reagents = SSchemistry.chemical_reagents