mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2026-08-23 06:56:44 +01:00
completely overhauls chemistry dispensers (#5132)
Co-authored-by: silicons <no@you.cat>
This commit is contained in:
@@ -3,13 +3,17 @@ PROCESSING_SUBSYSTEM_DEF(chemistry)
|
||||
wait = 10
|
||||
subsystem_flags = SS_BACKGROUND|SS_POST_FIRE_TIMING
|
||||
init_order = INIT_ORDER_CHEMISTRY
|
||||
|
||||
/// id to instance dict of reagents
|
||||
var/list/reagent_lookup = list()
|
||||
|
||||
var/list/chemical_reactions = list()
|
||||
var/list/chemical_reactions_by_reagent = list()
|
||||
var/list/chemical_reagents = list()
|
||||
|
||||
|
||||
/datum/controller/subsystem/processing/chemistry/Recover()
|
||||
chemical_reactions = SSchemistry.chemical_reactions
|
||||
chemical_reagents = SSchemistry.chemical_reagents
|
||||
reagent_lookup = SSchemistry.reagent_lookup
|
||||
|
||||
// honestly hate that we have to do this but some things INITIALIZE_IMMEDIATE so uh fuck me I guess!
|
||||
/datum/controller/subsystem/processing/chemistry/PreInit(recovering)
|
||||
@@ -41,9 +45,19 @@ PROCESSING_SUBSYSTEM_DEF(chemistry)
|
||||
/// Chemical Reagents - Initialises all /datum/reagent into a list indexed by reagent id
|
||||
/datum/controller/subsystem/processing/chemistry/proc/initialize_chemical_reagents()
|
||||
var/paths = typesof(/datum/reagent) - /datum/reagent
|
||||
chemical_reagents = list()
|
||||
for(var/path in paths)
|
||||
reagent_lookup = list()
|
||||
for(var/datum/reagent/path as anything in paths)
|
||||
if(initial(path.abstract_type) == path)
|
||||
continue
|
||||
var/datum/reagent/D = new path()
|
||||
if(!D.name)
|
||||
continue
|
||||
chemical_reagents[D.id] = D
|
||||
reagent_lookup[D.id] = D
|
||||
|
||||
/**
|
||||
* fetches the instance of a reagent
|
||||
*
|
||||
* do not edit the returned instance, it is global!
|
||||
*/
|
||||
/datum/controller/subsystem/processing/chemistry/proc/get_reagent(datum/reagent/id_or_path)
|
||||
return reagent_lookup[ispath(id_or_path)? initial(id_or_path.id) : id_or_path]
|
||||
|
||||
Reference in New Issue
Block a user