Fermichem now reacts without hanging the server!!

This commit is contained in:
Fermi
2019-04-23 01:08:30 +01:00
parent 879efcd634
commit 663b60fb15
3 changed files with 1051 additions and 18 deletions
+46 -16
View File
@@ -342,6 +342,9 @@
update_total()
/datum/reagents/proc/handle_reactions()//HERE EDIT HERE THE MAIN REACTION FERMICHEMS ASSEMBLE! I hope rp is similar
if(fermiIsReacting == TRUE)
//reagents_holder_flags |= REAGENT_NOREACT unsure if this is needed
return
var/list/cached_reagents = reagent_list //a list of the reagents?
var/list/cached_reactions = GLOB.chemical_reactions_list //a list of the whole reactions?
var/datum/cached_my_atom = my_atom //It says my atom, but I didn't bring one with me!!
@@ -351,14 +354,17 @@
var/reaction_occurred = 0 // checks if reaction, binary variable
var/continue_reacting = FALSE //Helps keep track what kind of reaction is occuring; standard or fermi.
if(fermiIsReacting == TRUE)
if (reactedVol >= targetVol && targetVol != 0)
STOP_PROCESSING(SSfastprocess, src)
//if(fermiIsReacting == TRUE)
/* if (reactedVol >= targetVol && targetVol != 0)
STOP_PROCESSING(SSprocessing, src)
fermiIsReacting = FALSE
message_admins("FermiChem processing stopped")
message_admins("FermiChem processing stopped in reaction handler")
reaction_occurred = 1
return
else
message_admins("FermiChem processing passed in reaction handler")
return
*/
do //What does do do in byond? It sounds very redundant? is it a while loop?
@@ -468,17 +474,23 @@
for(var/P in selected_reaction.results)
targetVol = cached_results[P]*multiplier
message_admins("FermiChem target volume: [targetVol]")
if (chem_temp > C.OptimalTempMin)//To prevent pointless reactions
if (reactedVol < targetVol)
reactedVol = FermiReact(selected_reaction, chem_temp, pH, multiplier, reactedVol, targetVol, cached_required_reagents, cached_results)
START_PROCESSING(SSfastprocess, src)
message_admins("FermiChem processing started")
fermiIsReacting = TRUE
else
fermiIsReacting = FALSE
STOP_PROCESSING(SSfastprocess, src)
if (fermiIsReacting == TRUE)
return
else
//reactedVol = FermiReact(selected_reaction, chem_temp, pH, multiplier, reactedVol, targetVol, cached_required_reagents, cached_results)
START_PROCESSING(SSprocessing, src)
message_admins("FermiChem processing started")
fermiIsReacting = TRUE
fermiReactID = selected_reaction
//else
// fermiIsReacting = FALSE
// STOP_PROCESSING(SSfastprocess, src)
else
return
SSblackbox.record_feedback("tally", "Fermi_chemical_reaction", reactedVol, C.id)//log
@@ -526,9 +538,28 @@
return 0//end!
/datum/reagents/process()
handle_reactions()
var/datum/chemical_reaction/C = fermiReactID
var/list/cached_required_reagents = C.required_reagents//update reagents list
var/list/cached_results = C.results//resultant chemical list
/datum/reagents/proc/FermiReact(selected_reaction, chem_temp, pH, multiplier, reactedVol, targetVol, cached_required_reagents, cached_results)
if (chem_temp > C.OptimalTempMin)//To prevent pointless reactions
if (reactedVol < targetVol)
reactedVol = FermiReact(fermiReactID, chem_temp, pH, reactedVol, targetVol, cached_required_reagents, cached_results)
message_admins("FermiChem tick activated started")
else
STOP_PROCESSING(SSprocessing, src)
fermiIsReacting = FALSE
return
else
STOP_PROCESSING(SSprocessing, src)
fermiIsReacting = FALSE
reactedVol = 0
targetVol = 0
//handle_reactions()
/datum/reagents/proc/FermiReact(selected_reaction, chem_temp, pH, reactedVol, targetVol, cached_required_reagents, cached_results)
var/datum/chemical_reaction/C = selected_reaction
var/deltaT = 0
var/deltapH = 0
@@ -537,7 +568,6 @@
//get purity from combined beaker reactant purities HERE.
var/purity = 1
//var/tempVol = totalVol
//var/list/multiplier = INFINITY
message_admins("Loop beginning")
//Begin Parse
File diff suppressed because it is too large Load Diff