This repository has been archived by the owner on Jan 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moves chem reactions onto SSchemistry.
- Loading branch information
1 parent
f4c4559
commit 67ee73a
Showing
13 changed files
with
84 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
SUBSYSTEM_DEF(chemistry) | ||
name = "Chemistry" | ||
priority = SS_PRIORITY_CHEMISTRY | ||
init_order = SS_INIT_CHEMISTRY | ||
|
||
var/list/active_holders = list() | ||
var/list/chemical_reactions = list() | ||
var/list/chemical_reactions_by_id = list() | ||
var/list/chemical_reactions_by_result = list() | ||
var/list/processing_holders = list() | ||
|
||
/datum/controller/subsystem/chemistry/stat_entry() | ||
..("AH:[active_holders.len]") | ||
|
||
/datum/controller/subsystem/chemistry/Initialize() | ||
|
||
// Init reaction list. | ||
//Chemical Reactions - Initialises all /datum/chemical_reaction into a list | ||
// It is filtered into multiple lists within a list. | ||
// For example: | ||
// chemical_reaction_list["phoron"] is a list of all reactions relating to phoron | ||
// Note that entries in the list are NOT duplicated. So if a reaction pertains to | ||
// more than one chemical it will still only appear in only one of the sublists. | ||
|
||
for(var/path in subtypesof(/datum/chemical_reaction)) | ||
var/datum/chemical_reaction/D = new path() | ||
chemical_reactions += D | ||
if(!chemical_reactions_by_result[D.result]) | ||
chemical_reactions_by_result[D.result] = list() | ||
chemical_reactions_by_result[D.result] += D | ||
if(D.required_reagents && D.required_reagents.len) | ||
var/reagent_id = D.required_reagents[1] | ||
if(!chemical_reactions_by_id[reagent_id]) | ||
chemical_reactions_by_id[reagent_id] = list() | ||
chemical_reactions_by_id[reagent_id] += D | ||
. = ..() | ||
|
||
/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) | ||
active_holders[holder] = TRUE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters