diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index 7fb78d6895..79b5df1991 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -369,6 +369,7 @@ 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 @@ -384,14 +385,8 @@ var/FermiChem = C.FermiChem var/FermiExplode = C.FermiExplode var/ImpureChem = C.ImpureChem - + */ //FermiChem - var/purity = 1 - var/ammoReacted = 0 - - var/deltaT = 0 - var/deltapH = 0 - var/stepChemAmmount = 0 for(var/B in cached_required_reagents) if(!has_reagent(B, cached_required_reagents[B])) @@ -425,8 +420,8 @@ matching_other = 1 //FermiChem - if (chem_temp > ExplodeTemp)//Check to see if reaction is too hot! - if (FermiExplode == TRUE) + if (chem_temp > C.ExplodeTemp)//Check to see if reaction is too hot! + if (C.FermiExplode == TRUE) //To be added! else FermiExplode() @@ -454,6 +449,7 @@ selected_reaction = competitor var/list/cached_required_reagents = selected_reaction.required_reagents//update reagents list var/list/cached_results = selected_reaction.results//resultant chemical list + var/special_react_result = selected_reaction.check_special_react(src) var/list/multiplier = INFINITY //Wat for(var/B in cached_required_reagents) // @@ -462,84 +458,92 @@ //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. - if (C.FermiChem == TRUE) - message_admins("Hee!!!! Someone is doing a Fermi reaction!!! I'm so excited!!") - //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) + if(selected_reaction) + var/datum/chemical_reaction/C = selected_reaction + if (C.FermiChem == TRUE) + message_admins("Hee!!!! Someone is doing a Fermi reaction!!! I'm so excited!!") + //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 - while (ammoReacted < multiplier) - //Begin Parse + var/purity = 1 - //Check extremes first - if (chem_temp > ExplodeTemp) - //go to explode proc - 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) - FermiExplode() + while (ammoReacted < multiplier) + //Begin Parse - //For now, purity is handled elsewhere + //Check extremes first + if (chem_temp > C.ExplodeTemp) + //go to explode proc + FermiExplode() - //Calculate DeltaT (Deviation of T from optimal) - if (chem_temp < OptimalTempMax) - deltaT = (((OptimalTempMin - chem_temp)**CurveSharpT)/((OptimalTempMax - OptimalTempMax)**CurveSharpT)) - else if (chem_temp >= C.OptimalTempMax) - deltaT = 1 - else - deltaT = 0 + 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) + FermiExplode() - //Calculate DeltapH (Deviation of pH from optimal) - //Lower range - if (pH < C.OptimalpHMin) - if (pH < (C.OptimalpHMin - C.ReactpHLim)) - deltapH = 0 + //For now, purity is handled elsewhere + + //Calculate DeltaT (Deviation of T from optimal) + if (chem_temp < C.OptimalTempMax) + deltaT = (((C.OptimalTempMin - chem_temp)**C.CurveSharpT)/((C.OptimalTempMax - C.OptimalTempMax)**C.CurveSharpT)) + else if (chem_temp >= C.OptimalTempMax) + deltaT = 1 else - deltapH = (((pH - (C.OptimalpHMin - C.ReactpHLim))**C.CurveSharp)/(C.ReactpHLim**C.CurveSharppH)) - //Upper range - else if (pH > C.OptimalpHMin) - if (pH > (C.OptimalpHMin + C.ReactpHLim)) - deltapH = 0 + deltaT = 0 + + //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 - 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 '[reagent]' which broke for some reason! ([usr])") - //TODO Add CatalystFact + 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 - stepChemAmmount = multiplier * deltaT - if (ammoReacted > 0) - purity = ((purity * ammoReacted) + (deltapH * stepChemAmmount)) /(2 * (ammoReacted + stepChemAmmount)) //This should add the purity to the product - else - purity = deltapH - //Apply pH changes and thermal output of reaction to beaker - chem_temp += (C.ThermicConstant * stepChemAmmount) - pH += (C.HIonRelease * stepChemAmmount) + stepChemAmmount = multiplier * deltaT + if (ammoReacted > 0) + purity = ((purity * ammoReacted) + (deltapH * stepChemAmmount)) /(2 * (ammoReacted + stepChemAmmount)) //This should add the purity to the product + else + purity = deltapH + //Apply pH changes and thermal output of reaction to beaker + chem_temp += (C.ThermicConstant * stepChemAmmount) + pH += (C.HIonRelease * stepChemAmmount) - // End. + // End. - selected_reaction.on_reaction(src, multiplier, special_react_result) + selected_reaction.on_reaction(src, multiplier, special_react_result) - for(var/B in cached_required_reagents) - remove_reagent(B, (stepChemAmmount * cached_required_reagents[B]), safety = 1)//safety? removes reagents from beaker using remove function. + for(var/B in cached_required_reagents) + 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: + 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 - ammoReacted = ammoReacted + stepChemAmmount - - reaction_occurred = 1 - SSblackbox.record_feedback("tally", "Fermi_chemical_reaction", cached_results[P]*ammoReacted, P)//log + reaction_occurred = 1 + SSblackbox.record_feedback("tally", "Fermi_chemical_reaction", ammoReacted, C.id)//log //Standard reaction mechanics: else: diff --git a/modular_citadel/code/datums/status_effects/chems.dm b/modular_citadel/code/datums/status_effects/chems.dm index f4dea1eb6a..55332b2f00 100644 --- a/modular_citadel/code/datums/status_effects/chems.dm +++ b/modular_citadel/code/datums/status_effects/chems.dm @@ -1,5 +1,3 @@ -#define fermiClone = null - /datum/status_effect/chem/SGDF id = "SGDF" //var/mob/living/fermi_Clone 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 26310a813b..b299677c68 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/fermi_reagents.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/fermi_reagents.dm @@ -28,7 +28,7 @@ ///obj/item/reagent/fermi/eigenstate/Initialize() /datum/reagent/fermi/eigenstate/New() - . = ..() //Unneeded? + . = ..() //Needed! location_created = get_turf(src) //Sets up coordinate of where it was created /datum/reagent/fermi/eigenstate/on_mob_life(mob/living/carbon/M) //Teleports to chemistry! @@ -124,6 +124,15 @@ //eigenstate END //Clone serum #chemClone +/datum/reagent/fermi/SDGF + name = "synthetic-derived growth factor" + id = "SDGF" + description = "A rapidly diving mass of Embryonic stem cells. These cells are missing a nucleus and quickly replicate a host’s DNA before growing to form an almost perfect clone of the host. In some cases neural replication takes longer, though the underlying reason underneath has yet to be determined." + color = "#60A584" // rgb: 96, 0, 255 + var/fClone_current_controller = OWNER + var/mob/living/split_personality/clone//there's two so they can swap without overwriting + var/mob/living/split_personality/owner + /datum/reagent/fermi/SGDF/on_mob_life(mob/living/carbon/M) //Clones user, then puts a ghost in them! If that fails, makes a braindead clone. //Setup clone diff --git a/tgstation.dme b/tgstation.dme index e84c616d64..1610d0354d 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -2778,10 +2778,12 @@ #include "modular_citadel\code\datums\components\material_container.dm" #include "modular_citadel\code\datums\components\phantomthief.dm" #include "modular_citadel\code\datums\components\souldeath.dm" +#include "modular_citadel\code\datums\mood_events\chem_events.dm" #include "modular_citadel\code\datums\mood_events\generic_negative_events.dm" #include "modular_citadel\code\datums\mood_events\generic_positive_events.dm" #include "modular_citadel\code\datums\mood_events\moodular.dm" #include "modular_citadel\code\datums\mutations\hulk.dm" +#include "modular_citadel\code\datums\status_effects\chems.dm" #include "modular_citadel\code\datums\status_effects\debuffs.dm" #include "modular_citadel\code\datums\traits\neutral.dm" #include "modular_citadel\code\datums\wires\airlock.dm"