diff --git a/code/modules/reagents/chemistry/holdersplitfail.dm b/code/modules/reagents/chemistry/holder(nonProc.old.functional.).dm
similarity index 81%
rename from code/modules/reagents/chemistry/holdersplitfail.dm
rename to code/modules/reagents/chemistry/holder(nonProc.old.functional.).dm
index be39ee3448..c38f065383 100644
--- a/code/modules/reagents/chemistry/holdersplitfail.dm
+++ b/code/modules/reagents/chemistry/holder(nonProc.old.functional.).dm
@@ -1,4 +1,3 @@
-
/proc/build_chemical_reagent_list()
//Chemical Reagents - Initialises all /datum/reagent into a list indexed by reagent id
@@ -368,7 +367,25 @@
var/meets_temp_requirement = 0
var/has_special_react = C.special_react
var/can_special_react = 0
- var/reactedVol = 0
+ //FermiChem WHY ARE VARIBLES SO ESTRANGED it makes me sad
+ /*
+ var/OptimalTempMin = C.OptimalTempMin // Lower area of bell curve for determining heat based rate reactions
+ var/OptimalTempMax = C.OptimalTempMax
+ var/ExplodeTemp = C.ExplodeTemp
+ var/OptimalpHMin = C.OptimalpHMin
+ var/OptimalpHMax = C.OptimalpHMax
+ var/ReactpHLim = C.ReactpHLim
+ //var/CatalystFact = C.CatalystFact
+ var/CurveSharpT = C.CurveSharpT
+ var/CurveSharppH = C.CurveSharppH
+ var/ThermicConstant = C.ThermicConstant
+ var/HIonRelease = C.HIonRelease
+ var/RateUpLim = C.RateUpLim
+ var/FermiChem = C.FermiChem
+ var/FermiExplode = C.FermiExplode
+ var/ImpureChem = C.ImpureChem
+ */
+ //FermiChem
for(var/B in cached_required_reagents)
if(!has_reagent(B, cached_required_reagents[B]))
@@ -402,14 +419,12 @@
matching_other = 1
//FermiChem
- /*
if (chem_temp > C.ExplodeTemp)//Check to see if reaction is too hot!
if (C.FermiExplode == TRUE)
//To be added!
else
FermiExplode()
//explode function!!
- */
if(required_temp == 0 || (is_cold_recipe && chem_temp <= required_temp) || (!is_cold_recipe && chem_temp >= required_temp))//Temperature check!!
meets_temp_requirement = 1//binary pass
@@ -442,21 +457,110 @@
//Splits reactions into two types; FermiChem is advanced reaction mechanics, Other is default reaction.
//FermiChem relies on two additional properties; pH and impurity
//Temperature plays into a larger role too.
- //BRANCH HERE
//if(selected_reaction)
var/datum/chemical_reaction/C = selected_reaction
-
if (C.FermiChem == TRUE)
- message_admins("FermiChem Proc'd")
+ //FermiReact(C)
+ //B is Beaker
+ //P is product
+ //multiplier = min(multiplier, round(get_reagent_amount(B) / cached_required_reagents[B]))//a simple one over the other? (Is this for multiplying end product? Useful for toxinsludge buildup)
+ var/deltaT = 0
+ var/deltapH = 0
+ var/stepChemAmmount = 0
+ var/ammoReacted = 0
+ //get purity from combined beaker reactant purities.
+ var/purity = 1
- while (reactedVol < multiplier)
- reactedVol = FermiReact(selected_reaction, chem_temp, pH, multiplier, reactedVol, special_react_result, cached_required_reagents, cached_results, selected_reaction.results)
+
+ while (ammoReacted < multiplier)
+ message_admins("Loop beginning")
CHECK_TICK
- reaction_occurred = 1
- SSblackbox.record_feedback("tally", "Fermi_chemical_reaction", reactedVol, C.id)//log
+ //Begin Parse
- //Standard reaction mechanics:
- else
+ //Check extremes first
+ if (chem_temp > C.ExplodeTemp)
+ //go to explode proc
+ message_admins("temperature is over limit: [C.ExplodeTemp] Current temperature: [chem_temp]")
+ FermiExplode()
+
+ if (pH > 14 || pH < 0)
+ //Create chemical sludge eventually(for now just destroy the beaker I guess?)
+ //TODO Strong acids eat glass, make it so you NEED plastic beakers for superacids(for some reactions)
+ message_admins("pH is lover limit, cur pH: [pH]")
+ FermiExplode()
+
+ //For now, purity is handled elsewhere
+
+ //Calculate DeltaT (Deviation of T from optimal)
+ if (chem_temp < C.OptimalTempMax || chem_temp >= C.OptimalTempMin)
+ deltaT = (((C.OptimalTempMin - chem_temp)**C.CurveSharpT)/((C.OptimalTempMax - C.OptimalTempMin)**C.CurveSharpT))
+ // 350 300
+ else if (chem_temp >= C.OptimalTempMax)
+ deltaT = 1
+ else
+ deltaT = 0
+ message_admins("calculating temperature factor, min: [C.OptimalTempMin], max: [C.OptimalTempMax], Exponential: [C.CurveSharpT], deltaT: [deltaT]")
+
+ //Calculate DeltapH (Deviation of pH from optimal)
+ //Lower range
+ if (pH < C.OptimalpHMin)
+ if (pH < (C.OptimalpHMin - C.ReactpHLim))
+ deltapH = 0
+ else
+ deltapH = (((pH - (C.OptimalpHMin - C.ReactpHLim))**C.CurveSharppH)/(C.ReactpHLim**C.CurveSharppH))
+ //Upper range
+ else if (pH > C.OptimalpHMin)
+ if (pH > (C.OptimalpHMin + C.ReactpHLim))
+ deltapH = 0
+ else
+ deltapH = ((C.ReactpHLim -(pH - (C.OptimalpHMax + C.ReactpHLim))+C.ReactpHLim)/(C.ReactpHLim**C.CurveSharppH))
+ //Within mid range
+ else if (pH >= C.OptimalpHMin && pH <= C.OptimalpHMax)
+ deltapH = 1
+ //This should never proc:
+ else
+ message_admins("Fermichem's pH broke!! Please let Fermis know!!")
+ WARNING("[my_atom] attempted to determine FermiChem pH for '[C.id]' which broke for some reason! ([usr])")
+ //TODO Add CatalystFact
+ message_admins("calculating pH factor(purity), pH: [pH], min: [C.OptimalpHMin]-[C.ReactpHLim], max: [C.OptimalpHMax]+[C.ReactpHLim], deltapH: [deltapH]")
+
+ stepChemAmmount = multiplier * deltaT
+ if (stepChemAmmount > C.RateUpLim)
+ stepChemAmmount = C.RateUpLim
+ else if (stepChemAmmount < 0.01)
+ stepChemAmmount = 0.1
+ if (ammoReacted > 0)
+ purity = ((purity * ammoReacted) + (deltapH * stepChemAmmount)) /((ammoReacted + stepChemAmmount)) //This should add the purity to the product
+ else
+ purity = deltapH
+ message_admins("purity: [purity], purity of beaker")
+ message_admins("Temp before change: [chem_temp], pH after change: [pH]")
+ //Apply pH changes and thermal output of reaction to beaker
+ chem_temp += (C.ThermicConstant * stepChemAmmount)
+ pH += (C.HIonRelease * stepChemAmmount)
+ message_admins("Temp after change: [chem_temp], pH after change: [pH]")
+
+ // End.
+
+ selected_reaction.on_reaction(src, multiplier, special_react_result)
+
+ message_admins("cached_results: [cached_results], multiplier: [multiplier], stepChemAmmount [stepChemAmmount]")
+ for(var/B in cached_required_reagents)
+ message_admins("cached_results: [cached_results], multiplier: [multiplier], stepChemAmmount [stepChemAmmount]")
+ remove_reagent(B, (stepChemAmmount * cached_required_reagents[B]), safety = 1)//safety? removes reagents from beaker using remove function.
+
+ for(var/P in selected_reaction.results)//Not sure how this works, what is selected_reaction.results?
+ multiplier = max(multiplier, 1) //this shouldnt happen ...
+ SSblackbox.record_feedback("tally", "chemical_reaction", cached_results[P]*stepChemAmmount, P)//log
+ add_reagent(P, cached_results[P]*stepChemAmmount, null, chem_temp)//add reagent function!! I THINK I can do this:
+
+ ammoReacted = ammoReacted + stepChemAmmount
+ CHECK_TICK
+
+ reaction_occurred = 1
+ SSblackbox.record_feedback("tally", "Fermi_chemical_reaction", ammoReacted, C.id)//log
+ //Standard reaction mechanics:
+ else:
for(var/B in cached_required_reagents) //
multiplier = min(multiplier, round(get_reagent_amount(B) / cached_required_reagents[B]))//a simple one over the other? (Is this for multiplying end product? Useful for toxinsludge buildup)
@@ -470,129 +574,34 @@
add_reagent(P, cached_results[P]*multiplier, null, chem_temp)//add reagent function!! I THINK I can do this:
- var/list/seen = viewers(4, get_turf(my_atom))//Sound and sight checkers
- var/iconhtml = icon2html(cached_my_atom, seen)
- if(cached_my_atom)
- if(!ismob(cached_my_atom)) // No bubbling mobs
- if(selected_reaction.mix_sound)
- playsound(get_turf(cached_my_atom), selected_reaction.mix_sound, 80, 1)
+ var/list/seen = viewers(4, get_turf(my_atom))//Sound and sight checkers
+ var/iconhtml = icon2html(cached_my_atom, seen)
+ if(cached_my_atom)
+ if(!ismob(cached_my_atom)) // No bubbling mobs
+ if(selected_reaction.mix_sound)
+ playsound(get_turf(cached_my_atom), selected_reaction.mix_sound, 80, 1)
+ for(var/mob/M in seen)
+ to_chat(M, "[iconhtml] [selected_reaction.mix_message]")
+
+ if(istype(cached_my_atom, /obj/item/slime_extract))//if there's an extract and it's used up.
+ var/obj/item/slime_extract/ME2 = my_atom
+ ME2.Uses--
+ if(ME2.Uses <= 0) // give the notification that the slime core is dead
for(var/mob/M in seen)
- to_chat(M, "[iconhtml] [selected_reaction.mix_message]")
+ to_chat(M, "[iconhtml] \The [my_atom]'s power is consumed in the reaction.")
+ ME2.name = "used slime extract"
+ ME2.desc = "This extract has been used up."
- if(istype(cached_my_atom, /obj/item/slime_extract))//if there's an extract and it's used up.
- var/obj/item/slime_extract/ME2 = my_atom
- ME2.Uses--
- if(ME2.Uses <= 0) // give the notification that the slime core is dead
- for(var/mob/M in seen)
- to_chat(M, "[iconhtml] \The [my_atom]'s power is consumed in the reaction.")
- ME2.name = "used slime extract"
- ME2.desc = "This extract has been used up."
-
- selected_reaction.on_reaction(src, multiplier, special_react_result)
- reaction_occurred = 1
+ selected_reaction.on_reaction(src, multiplier, special_react_result)
+ reaction_occurred = 1
while(reaction_occurred)//while do nothing?
update_total()//Don't know waht this does.
return 0//end!
-/datum/reagents/proc/FermiReact(selected_reaction, chem_temp, pH, multiplier, totalVol, special_react_result, cached_required_reagents, cached_results, selected_reaction.results)
- var/datum/chemical_reaction/C = selected_reaction
- var/deltaT = 0
- var/deltapH = 0
- var/stepChemAmmount = 0
- var/ammoReacted = 0
- //get purity from combined beaker reactant purities HERE.
- var/purity = 1
- var/tempVol = totalVol
- //var/list/multiplier = INFINITY
-
- message_admins("Loop beginning")
- //Begin Parse
-
- //Check extremes first
- if (chem_temp > C.ExplodeTemp)
- //go to explode proc
- message_admins("temperature is over limit: [C.ExplodeTemp] Current temperature: [chem_temp]")
- FermiExplode()
-
- if (pH > 14 || pH < 0)
- //Create chemical sludge eventually(for now just destroy the beaker I guess?)
- //TODO Strong acids eat glass, make it so you NEED plastic beakers for superacids(for some reactions)
- message_admins("pH is lover limit, cur pH: [pH]")
- FermiExplode()
-
- //For now, purity is handled elsewhere
-
- //Calculate DeltaT (Deviation of T from optimal)
- if (chem_temp < C.OptimalTempMax && chem_temp >= C.OptimalTempMin)
- deltaT = (((C.OptimalTempMin - chem_temp)**C.CurveSharpT)/((C.OptimalTempMax - C.OptimalTempMin)**C.CurveSharpT))
- else if (chem_temp >= C.OptimalTempMax)
- deltaT = 1
- else
- deltaT = 0
- message_admins("calculating temperature factor, min: [C.OptimalTempMin], max: [C.OptimalTempMax], Exponential: [C.CurveSharpT], deltaT: [deltaT]")
-
- //Calculate DeltapH (Deviation of pH from optimal)
- //Lower range
- if (pH < C.OptimalpHMin)
- if (pH < (C.OptimalpHMin - C.ReactpHLim))
- deltapH = 0
- else
- deltapH = (((pH - (C.OptimalpHMin - C.ReactpHLim))**C.CurveSharppH)/(C.ReactpHLim**C.CurveSharppH))
- //Upper range
- else if (pH > C.OptimalpHMin)
- if (pH > (C.OptimalpHMin + C.ReactpHLim))
- deltapH = 0
- else
- deltapH = ((C.ReactpHLim -(pH - (C.OptimalpHMax + C.ReactpHLim))+C.ReactpHLim)/(C.ReactpHLim**C.CurveSharppH))
- //Within mid range
- else if (pH >= C.OptimalpHMin && pH <= C.OptimalpHMax)
- deltapH = 1
- //This should never proc:
- else
- message_admins("Fermichem's pH broke!! Please let Fermis know!!")
- WARNING("[my_atom] attempted to determine FermiChem pH for '[C.id]' which broke for some reason! ([usr])")
- //TODO Add CatalystFact
- message_admins("calculating pH factor(purity), pH: [pH], min: [C.OptimalpHMin]-[C.ReactpHLim], max: [C.OptimalpHMax]+[C.ReactpHLim], deltapH: [deltapH]")
-
- stepChemAmmount = tempVol * deltaT
- if (stepChemAmmount > C.RateUpLim)
- stepChemAmmount = C.RateUpLim
- else if (stepChemAmmount < 0.01)
- stepChemAmmount = 0.01
-
- if (totalVol > 0)
- purity = ((purity * ammoReacted) + (deltapH * stepChemAmmount)) /((ammoReacted + stepChemAmmount)) //This should add the purity to the product
- else
- purity = deltapH
- message_admins("purity: [purity], purity of beaker")
- message_admins("Temp before change: [chem_temp], pH after change: [pH]")
- //Apply pH changes and thermal output of reaction to beaker
- chem_temp += (C.ThermicConstant * stepChemAmmount)
- pH += (C.HIonRelease * stepChemAmmount)
- message_admins("Temp after change: [chem_temp], pH after change: [pH]")
-
- // End.
- /*
- for(var/B in cached_required_reagents) //
- tempVol = min(totalVol, round(get_reagent_amount(B) / cached_required_reagents[B]))//a simple one over the other? (Is this for multiplying end product? Useful for toxinsludge buildup)
- */
- message_admins("cached_results: [cached_results], totalVol: [totalVol], stepChemAmmount [stepChemAmmount]")
- for(var/B in cached_required_reagents)
- message_admins("cached_required_reagents(B): [cached_required_reagents[B]], totalVol: [totalVol], base stepChemAmmount [stepChemAmmount]")
- remove_reagent(B, (stepChemAmmount * cached_required_reagents[B]), safety = 1)//safety? removes reagents from beaker using remove function.
-
- for(var/P in selected_reaction.results)//Not sure how this works, what is selected_reaction.results?
- totalVol = max(totalVol, 1) //this shouldnt happen ...
- SSblackbox.record_feedback("tally", "chemical_reaction", cached_results[P]*stepChemAmmount, P)//log
- add_reagent(P, cached_results[P]*stepChemAmmount, null, chem_temp)//add reagent function!! I THINK I can do this:
-
- totalVol = totalVol + stepChemAmmount
-
-
- CHECK_TICK
- return (totalVol)
+/datum/reagents/proc/FermiReact()
+ return
/datum/reagents/proc/FermiExplode()
return
@@ -955,4 +964,4 @@
if(initial(R.can_synth))
random_reagents += initial(R.id)
var/picked_reagent = pick(random_reagents)
- return picked_reagent
+ return picked_reagent
\ No newline at end of file
diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm
index c38f065383..bafc1865dc 100644
--- a/code/modules/reagents/chemistry/holder.dm
+++ b/code/modules/reagents/chemistry/holder.dm
@@ -1,3 +1,4 @@
+
/proc/build_chemical_reagent_list()
//Chemical Reagents - Initialises all /datum/reagent into a list indexed by reagent id
@@ -367,25 +368,8 @@
var/meets_temp_requirement = 0
var/has_special_react = C.special_react
var/can_special_react = 0
- //FermiChem WHY ARE VARIBLES SO ESTRANGED it makes me sad
- /*
- var/OptimalTempMin = C.OptimalTempMin // Lower area of bell curve for determining heat based rate reactions
- var/OptimalTempMax = C.OptimalTempMax
- var/ExplodeTemp = C.ExplodeTemp
- var/OptimalpHMin = C.OptimalpHMin
- var/OptimalpHMax = C.OptimalpHMax
- var/ReactpHLim = C.ReactpHLim
- //var/CatalystFact = C.CatalystFact
- var/CurveSharpT = C.CurveSharpT
- var/CurveSharppH = C.CurveSharppH
- var/ThermicConstant = C.ThermicConstant
- var/HIonRelease = C.HIonRelease
- var/RateUpLim = C.RateUpLim
- var/FermiChem = C.FermiChem
- var/FermiExplode = C.FermiExplode
- var/ImpureChem = C.ImpureChem
- */
- //FermiChem
+ var/reactedVol = 0
+ va/continue_reacting = FALSE
for(var/B in cached_required_reagents)
if(!has_reagent(B, cached_required_reagents[B]))
@@ -419,12 +403,14 @@
matching_other = 1
//FermiChem
+ /*
if (chem_temp > C.ExplodeTemp)//Check to see if reaction is too hot!
if (C.FermiExplode == TRUE)
//To be added!
else
FermiExplode()
//explode function!!
+ */
if(required_temp == 0 || (is_cold_recipe && chem_temp <= required_temp) || (!is_cold_recipe && chem_temp >= required_temp))//Temperature check!!
meets_temp_requirement = 1//binary pass
@@ -457,110 +443,25 @@
//Splits reactions into two types; FermiChem is advanced reaction mechanics, Other is default reaction.
//FermiChem relies on two additional properties; pH and impurity
//Temperature plays into a larger role too.
+ //BRANCH HERE
//if(selected_reaction)
var/datum/chemical_reaction/C = selected_reaction
- if (C.FermiChem == TRUE)
- //FermiReact(C)
- //B is Beaker
- //P is product
- //multiplier = min(multiplier, round(get_reagent_amount(B) / cached_required_reagents[B]))//a simple one over the other? (Is this for multiplying end product? Useful for toxinsludge buildup)
- var/deltaT = 0
- var/deltapH = 0
- var/stepChemAmmount = 0
- var/ammoReacted = 0
- //get purity from combined beaker reactant purities.
- var/purity = 1
-
-
- while (ammoReacted < multiplier)
- message_admins("Loop beginning")
- CHECK_TICK
- //Begin Parse
-
- //Check extremes first
- if (chem_temp > C.ExplodeTemp)
- //go to explode proc
- message_admins("temperature is over limit: [C.ExplodeTemp] Current temperature: [chem_temp]")
- FermiExplode()
-
- if (pH > 14 || pH < 0)
- //Create chemical sludge eventually(for now just destroy the beaker I guess?)
- //TODO Strong acids eat glass, make it so you NEED plastic beakers for superacids(for some reactions)
- message_admins("pH is lover limit, cur pH: [pH]")
- FermiExplode()
-
- //For now, purity is handled elsewhere
-
- //Calculate DeltaT (Deviation of T from optimal)
- if (chem_temp < C.OptimalTempMax || chem_temp >= C.OptimalTempMin)
- deltaT = (((C.OptimalTempMin - chem_temp)**C.CurveSharpT)/((C.OptimalTempMax - C.OptimalTempMin)**C.CurveSharpT))
- // 350 300
- else if (chem_temp >= C.OptimalTempMax)
- deltaT = 1
- else
- deltaT = 0
- message_admins("calculating temperature factor, min: [C.OptimalTempMin], max: [C.OptimalTempMax], Exponential: [C.CurveSharpT], deltaT: [deltaT]")
-
- //Calculate DeltapH (Deviation of pH from optimal)
- //Lower range
- if (pH < C.OptimalpHMin)
- if (pH < (C.OptimalpHMin - C.ReactpHLim))
- deltapH = 0
- else
- deltapH = (((pH - (C.OptimalpHMin - C.ReactpHLim))**C.CurveSharppH)/(C.ReactpHLim**C.CurveSharppH))
- //Upper range
- else if (pH > C.OptimalpHMin)
- if (pH > (C.OptimalpHMin + C.ReactpHLim))
- deltapH = 0
- else
- deltapH = ((C.ReactpHLim -(pH - (C.OptimalpHMax + C.ReactpHLim))+C.ReactpHLim)/(C.ReactpHLim**C.CurveSharppH))
- //Within mid range
- else if (pH >= C.OptimalpHMin && pH <= C.OptimalpHMax)
- deltapH = 1
- //This should never proc:
- else
- message_admins("Fermichem's pH broke!! Please let Fermis know!!")
- WARNING("[my_atom] attempted to determine FermiChem pH for '[C.id]' which broke for some reason! ([usr])")
- //TODO Add CatalystFact
- message_admins("calculating pH factor(purity), pH: [pH], min: [C.OptimalpHMin]-[C.ReactpHLim], max: [C.OptimalpHMax]+[C.ReactpHLim], deltapH: [deltapH]")
-
- stepChemAmmount = multiplier * deltaT
- if (stepChemAmmount > C.RateUpLim)
- stepChemAmmount = C.RateUpLim
- else if (stepChemAmmount < 0.01)
- stepChemAmmount = 0.1
- if (ammoReacted > 0)
- purity = ((purity * ammoReacted) + (deltapH * stepChemAmmount)) /((ammoReacted + stepChemAmmount)) //This should add the purity to the product
- else
- purity = deltapH
- message_admins("purity: [purity], purity of beaker")
- message_admins("Temp before change: [chem_temp], pH after change: [pH]")
- //Apply pH changes and thermal output of reaction to beaker
- chem_temp += (C.ThermicConstant * stepChemAmmount)
- pH += (C.HIonRelease * stepChemAmmount)
- message_admins("Temp after change: [chem_temp], pH after change: [pH]")
-
- // End.
-
- selected_reaction.on_reaction(src, multiplier, special_react_result)
-
- message_admins("cached_results: [cached_results], multiplier: [multiplier], stepChemAmmount [stepChemAmmount]")
- for(var/B in cached_required_reagents)
- message_admins("cached_results: [cached_results], multiplier: [multiplier], stepChemAmmount [stepChemAmmount]")
- remove_reagent(B, (stepChemAmmount * cached_required_reagents[B]), safety = 1)//safety? removes reagents from beaker using remove function.
-
- for(var/P in selected_reaction.results)//Not sure how this works, what is selected_reaction.results?
- multiplier = max(multiplier, 1) //this shouldnt happen ...
- SSblackbox.record_feedback("tally", "chemical_reaction", cached_results[P]*stepChemAmmount, P)//log
- add_reagent(P, cached_results[P]*stepChemAmmount, null, chem_temp)//add reagent function!! I THINK I can do this:
-
- ammoReacted = ammoReacted + stepChemAmmount
- CHECK_TICK
+ if (C.FermiChem == TRUE && !continue_reacting == TRUE)
+ message_admins("FermiChem Proc'd")
reaction_occurred = 1
- SSblackbox.record_feedback("tally", "Fermi_chemical_reaction", ammoReacted, C.id)//log
- //Standard reaction mechanics:
- else:
+
+ for(var/P in selected_reaction.results)
+ var/targetVol = cached_results[P]*multiplier
+
+ while (reactedVol < targetVol)
+ reactedVol = FermiReact(selected_reaction, chem_temp, pH, multiplier, reactedVol, targetVol cached_required_reagents, cached_results)
+
+
+ SSblackbox.record_feedback("tally", "Fermi_chemical_reaction", reactedVol, C.id)//log
+
+ //Standard reaction mechanics:
+ else
for(var/B in cached_required_reagents) //
multiplier = min(multiplier, round(get_reagent_amount(B) / cached_required_reagents[B]))//a simple one over the other? (Is this for multiplying end product? Useful for toxinsludge buildup)
@@ -574,34 +475,136 @@
add_reagent(P, cached_results[P]*multiplier, null, chem_temp)//add reagent function!! I THINK I can do this:
- var/list/seen = viewers(4, get_turf(my_atom))//Sound and sight checkers
- var/iconhtml = icon2html(cached_my_atom, seen)
- if(cached_my_atom)
- if(!ismob(cached_my_atom)) // No bubbling mobs
- if(selected_reaction.mix_sound)
- playsound(get_turf(cached_my_atom), selected_reaction.mix_sound, 80, 1)
+ var/list/seen = viewers(4, get_turf(my_atom))//Sound and sight checkers
+ var/iconhtml = icon2html(cached_my_atom, seen)
+ if(cached_my_atom)
+ if(!ismob(cached_my_atom)) // No bubbling mobs
+ if(selected_reaction.mix_sound)
+ playsound(get_turf(cached_my_atom), selected_reaction.mix_sound, 80, 1)
- for(var/mob/M in seen)
- to_chat(M, "[iconhtml] [selected_reaction.mix_message]")
-
- if(istype(cached_my_atom, /obj/item/slime_extract))//if there's an extract and it's used up.
- var/obj/item/slime_extract/ME2 = my_atom
- ME2.Uses--
- if(ME2.Uses <= 0) // give the notification that the slime core is dead
for(var/mob/M in seen)
- to_chat(M, "[iconhtml] \The [my_atom]'s power is consumed in the reaction.")
- ME2.name = "used slime extract"
- ME2.desc = "This extract has been used up."
+ to_chat(M, "[iconhtml] [selected_reaction.mix_message]")
- selected_reaction.on_reaction(src, multiplier, special_react_result)
- reaction_occurred = 1
+ if(istype(cached_my_atom, /obj/item/slime_extract))//if there's an extract and it's used up.
+ var/obj/item/slime_extract/ME2 = my_atom
+ ME2.Uses--
+ if(ME2.Uses <= 0) // give the notification that the slime core is dead
+ for(var/mob/M in seen)
+ to_chat(M, "[iconhtml] \The [my_atom]'s power is consumed in the reaction.")
+ ME2.name = "used slime extract"
+ ME2.desc = "This extract has been used up."
+
+ selected_reaction.on_reaction(src, multiplier, special_react_result)
+ reaction_occurred = 1
+ continue_reacting = TRUE
while(reaction_occurred)//while do nothing?
update_total()//Don't know waht this does.
return 0//end!
-/datum/reagents/proc/FermiReact()
- return
+/datum/reagents/proc/FermiReact(selected_reaction, chem_temp, pH, multiplier, reactedVol, targetVol, cached_required_reagents, cached_results)
+ var/datum/chemical_reaction/C = selected_reaction
+ var/deltaT = 0
+ var/deltapH = 0
+ var/stepChemAmmount = 0
+ var/ammoReacted = 0
+ //get purity from combined beaker reactant purities HERE.
+ var/purity = 1
+ var/tempVol = totalVol
+ //var/list/multiplier = INFINITY
+
+ message_admins("Loop beginning")
+ //Begin Parse
+
+ //Check extremes first
+ if (chem_temp > C.ExplodeTemp)
+ //go to explode proc
+ message_admins("temperature is over limit: [C.ExplodeTemp] Current temperature: [chem_temp]")
+ FermiExplode()
+
+ if (pH > 14 || pH < 0)
+ //Create chemical sludge eventually(for now just destroy the beaker I guess?)
+ //TODO Strong acids eat glass, make it so you NEED plastic beakers for superacids(for some reactions)
+ message_admins("pH is lover limit, cur pH: [pH]")
+ FermiExplode()
+
+ //For now, purity is handled elsewhere
+
+ //Calculate DeltaT (Deviation of T from optimal)
+ if (chem_temp < C.OptimalTempMax && chem_temp >= C.OptimalTempMin)
+ deltaT = (((C.OptimalTempMin - chem_temp)**C.CurveSharpT)/((C.OptimalTempMax - C.OptimalTempMin)**C.CurveSharpT))
+ else if (chem_temp >= C.OptimalTempMax)
+ deltaT = 1
+ else
+ deltaT = 0
+ message_admins("calculating temperature factor, min: [C.OptimalTempMin], max: [C.OptimalTempMax], Exponential: [C.CurveSharpT], deltaT: [deltaT]")
+
+ //Calculate DeltapH (Deviation of pH from optimal)
+ //Lower range
+ if (pH < C.OptimalpHMin)
+ if (pH < (C.OptimalpHMin - C.ReactpHLim))
+ deltapH = 0
+ else
+ deltapH = (((pH - (C.OptimalpHMin - C.ReactpHLim))**C.CurveSharppH)/(C.ReactpHLim**C.CurveSharppH))
+ //Upper range
+ else if (pH > C.OptimalpHMin)
+ if (pH > (C.OptimalpHMin + C.ReactpHLim))
+ deltapH = 0
+ else
+ deltapH = ((C.ReactpHLim -(pH - (C.OptimalpHMax + C.ReactpHLim))+C.ReactpHLim)/(C.ReactpHLim**C.CurveSharppH))
+ //Within mid range
+ else if (pH >= C.OptimalpHMin && pH <= C.OptimalpHMax)
+ deltapH = 1
+ //This should never proc:
+ else
+ message_admins("Fermichem's pH broke!! Please let Fermis know!!")
+ WARNING("[my_atom] attempted to determine FermiChem pH for '[C.id]' which broke for some reason! ([usr])")
+ //TODO Add CatalystFact
+ message_admins("calculating pH factor(purity), pH: [pH], min: [C.OptimalpHMin]-[C.ReactpHLim], max: [C.OptimalpHMax]+[C.ReactpHLim], deltapH: [deltapH]")
+
+ stepChemAmmount = targetVol * deltaT
+ if (stepChemAmmount > C.RateUpLim)
+ stepChemAmmount = C.RateUpLim
+ else if (stepChemAmmount < 0.01)
+ stepChemAmmount = 0.01
+
+ if ((reactedVol + stepChemAmmount) > targetVol)
+ stepChemAmmount = targetVol - reactedVol
+ message_admins("target volume reached. Reaction should stop after this loop")
+
+ if (reactedVol > 0)
+ purity = ((purity * ammoReacted) + (deltapH * stepChemAmmount)) /((ammoReacted + stepChemAmmount)) //This should add the purity to the product
+ else
+ purity = deltapH
+ message_admins("purity: [purity], purity of beaker")
+ message_admins("Temp before change: [chem_temp], pH after change: [pH]")
+ //Apply pH changes and thermal output of reaction to beaker
+ chem_temp += (C.ThermicConstant * stepChemAmmount)
+ pH += (C.HIonRelease * stepChemAmmount)
+ message_admins("Temp after change: [chem_temp], pH after change: [pH]")
+
+ // End.
+ /*
+ for(var/B in cached_required_reagents) //
+ tempVol = min(reactedVol, round(get_reagent_amount(B) / cached_required_reagents[B]))//a simple one over the other? (Is this for multiplying end product? Useful for toxinsludge buildup)
+ */
+ message_admins("cached_results: [cached_results], reactedVol: [reactedVol], stepChemAmmount [stepChemAmmount]")
+
+
+
+ for(var/B in cached_required_reagents)
+ message_admins("cached_required_reagents(B): [cached_required_reagents[B]], reactedVol: [reactedVol], base stepChemAmmount [stepChemAmmount]")
+ remove_reagent(B, (stepChemAmmount * cached_required_reagents[B]), safety = 1)//safety? removes reagents from beaker using remove function.
+
+ for(var/P in selected_reaction.results)//Not sure how this works, what is selected_reaction.results?
+ reactedVol = max(reactedVol, 1) //this shouldnt happen ...
+ SSblackbox.record_feedback("tally", "chemical_reaction", cached_results[P]*stepChemAmmount, P)//log
+ add_reagent(P, cached_results[P]*stepChemAmmount, null, chem_temp)//add reagent function!! I THINK I can do this:
+
+ reactedVol = reactedVol + stepChemAmmount
+
+
+ return (reactedVol)
/datum/reagents/proc/FermiExplode()
return
@@ -964,4 +967,4 @@
if(initial(R.can_synth))
random_reagents += initial(R.id)
var/picked_reagent = pick(random_reagents)
- return picked_reagent
\ No newline at end of file
+ return picked_reagent
diff --git a/code/modules/reagents/chemistry/holderbk3.dm b/code/modules/reagents/chemistry/holderbk3.dm
index 06e99bac96..6c2f5a9876 100644
--- a/code/modules/reagents/chemistry/holderbk3.dm
+++ b/code/modules/reagents/chemistry/holderbk3.dm
@@ -578,6 +578,7 @@
for(var/B in cached_required_reagents) //
tempVol = min(totalVol, round(get_reagent_amount(B) / cached_required_reagents[B]))//a simple one over the other? (Is this for multiplying end product? Useful for toxinsludge buildup)
+
message_admins("cached_results: [cached_results], totalVol: [totalVol], stepChemAmmount [stepChemAmmount]")
for(var/B in cached_required_reagents)
message_admins("cached_required_reagents(B): [cached_required_reagents[B]], totalVol: [totalVol], base stepChemAmmount [stepChemAmmount]")
diff --git a/modular_citadel/code/modules/reagents/chemistry/reagents/fermi_reagents.dm b/modular_citadel/code/modules/reagents/chemistry/reagents/fermi_reagents.dm
index 2913c2f2b4..0a12e40bd6 100644
--- a/modular_citadel/code/modules/reagents/chemistry/reagents/fermi_reagents.dm
+++ b/modular_citadel/code/modules/reagents/chemistry/reagents/fermi_reagents.dm
@@ -49,13 +49,13 @@
/datum/reagent/fermi/eigenstate/on_mob_life(mob/living/carbon/M) //Teleports to chemistry!
if (holder.has_reagent("eigenstate"))
- do_sparks(5,FALSE,src)
+ do_sparks(5,FALSE,M)
else
location_return = get_turf(src) //sets up return point
to_chat(M, "You feel your wavefunction split!")
- do_sparks(5,FALSE,src)
+ do_sparks(5,FALSE,M)
M.forceMove(location_created) //Teleports to creation location
- do_sparks(5,FALSE,src)
+ do_sparks(5,FALSE,M)
..()
/datum/reagent/fermi/eigenstate/on_mob_delete(mob/living/M) //returns back to original location
@@ -66,16 +66,17 @@
..()
/datum/reagent/fermi/eigenstate/overdose_start(mob/living/M) //Overdose, makes you teleport randomly
- switch(current_cycle)
- if(10)
- to_chat(M, "Oh god, you feel like your wavefunction is about to hurl.")
- M.Jitter(10)
+ . = ..()
+ //switch(current_cycle)
+ // if(1)
+ to_chat(M, "Oh god, you feel like your wavefunction is about to hurl.")
+ M.Jitter(10)
- if(15 to INFINITY)
- do_sparks(5,FALSE,src)
- do_teleport(src, get_turf(src), 50, asoundin = 'sound/effects/phasein.ogg')
- do_sparks(5,FALSE,src)
- M.reagents.remove_reagent("eigenstate",1)//So you're not stuck for 10 minutes teleporting
+ //if(3 to INFINITY)
+ do_sparks(5,FALSE,src)
+ do_teleport(src, get_turf(src), 50, asoundin = 'sound/effects/phasein.ogg')
+ do_sparks(5,FALSE,src)
+ //M.reagents.remove_reagent("eigenstate",1)//So you're not stuck for 10 minutes teleporting
..()
@@ -132,7 +133,7 @@
/datum/reagent/fermi/eigenstate/addiction_act_stage4(mob/living/M) //Thanks for riding Fermis' wild ride. Mild jitter and player buggery.
M.Jitter(50)
M.AdjustKnockdown(0, 0)
- to_chat(M, "You feel your eigenstate settle, snapping an alternative version of yourself into reality. All your previous memories are lost and replaced with the alternative version of yourself. This version of you feels more [pick("affectionate", "happy", "lusty", "radical", "shy", "ambitious", "frank", "voracious", "sensible", "witty")] than your pervious self, sent to god knows what universe.")
+ to_chat(M, "You feel your eigenstate settle, snapping an alternative version of yourself into reality. All your previous memories are lost and replaced with the alternative version of yourself. This version of you feels more [pick("affectionate", "happy", "lusty", "radical", "shy", "ambitious", "frank", "voracious", "sensible", "witty")] than your previous self, sent to god knows what universe.")
M.emote("me",1,"gasps and gazes around in a bewildered and highly confused fashion!",TRUE)
SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "Alternative dimension", /datum/mood_event/eigenstate)
..()
@@ -192,8 +193,8 @@
//Breast englargement
/datum/reagent/fermi/BElarger
- name = "Eigenstasium"
- id = "eigenstate"
+ name = "Sucubus Draft"
+ id = "BEenlager"
description = "A volatile collodial mixture derived from milk that encourages mammary production via a potent estrogen mix."
color = "#60A584" // rgb: 96, 0, 255
overdose_threshold = 12
@@ -204,5 +205,5 @@
M.visible_message("[M] suddenly looks more feminine!", "You suddenly feel more feminine!")
if(M.gender == FEMALE)
- M.gender = FEMALE
+ M.gender = MALE
M.visible_message("[M] suddenly looks more masculine!", "You suddenly feel more masculine!")