diff --git a/code/modules/food_and_drinks/recipes/drinks_recipes.dm b/code/modules/food_and_drinks/recipes/drinks_recipes.dm index f87eebe35b..8d63d68878 100644 --- a/code/modules/food_and_drinks/recipes/drinks_recipes.dm +++ b/code/modules/food_and_drinks/recipes/drinks_recipes.dm @@ -381,6 +381,33 @@ id = "neurotoxin" results = list("neurotoxin" = 2) required_reagents = list("gargleblaster" = 1, "morphine" = 1) + //FermiChem vars: Easy to make, but hard to make potent + OptimalTempMin = 200 // Lower area of bell curve for determining heat based rate reactions + OptimalTempMax = 950 // Upper end for above + ExplodeTemp = 999 //Temperature at which reaction explodes + OptimalpHMin = 4.6 // Lowest value of pH determining pH a 1 value for pH based rate reactions (Plateu phase) + OptimalpHMax = 5.2 // Higest value for above + ReactpHLim = 5 // How far out pH wil react, giving impurity place (Exponential phase) + CatalystFact = 0 // How much the catalyst affects the reaction (0 = no catalyst) + CurveSharpT = 2 // How sharp the temperature exponential curve is (to the power of value) + CurveSharppH = 4 // How sharp the pH exponential curve is (to the power of value) + ThermicConstant = 10 //Temperature change per 1u produced + HIonRelease = 0.02 //pH change per 1u reaction + RateUpLim = 5 //Optimal/max rate possible if all conditions are perfect + FermiChem = TRUE//If the chemical uses the Fermichem reaction mechanics + FermiExplode = FALSE //If the chemical explodes in a special way + PurityMin = 0 //The minimum purity something has to be above, otherwise it explodes. + +/datum/chemical_reaction/neurotoxin/FermiFinish(datum/reagents/holder, var/atom/my_atom) + var/datum/reagent/consumable/ethanol/neurotoxin/Nt = locate(/datum/reagent/consumable/ethanol/neurotoxin) in my_atom.reagents.reagent_list + var/cached_volume = Nt.volume + if(Nt.purity < 0.5) + holder.remove_reagent(src.id, cached_volume) + holder.add_reagent("neuroweak", cached_volume) + +/datum/chemical_reaction/neurotoxin/FermiExplode(datum/reagents, var/atom/my_atom, volume, temp, pH)//reduced size + volume = volume/10 + ..() /datum/chemical_reaction/snowwhite name = "Snow White" @@ -807,4 +834,4 @@ id = "commander_and_chief" results = list("commander_and_chief" = 50) required_reagents = list("alliescocktail" = 50, "champagne" = 20, "doctorsdelight" = 10, "quintuple_sec" = 10, "screwdrivercocktail" = 10) - mix_message = "When your powers combine, I am Captain Pl-..." \ No newline at end of file + mix_message = "When your powers combine, I am Captain Pl-..." diff --git a/code/modules/reagents/chemistry/machinery/chem_master.dm b/code/modules/reagents/chemistry/machinery/chem_master.dm index c5ff9bb70b..85cf5e5011 100644 --- a/code/modules/reagents/chemistry/machinery/chem_master.dm +++ b/code/modules/reagents/chemistry/machinery/chem_master.dm @@ -397,9 +397,9 @@ state = "Gas" var/const/P = 3 //The number of seconds between life ticks var/T = initial(R.metabolization_rate) * (60 / P) - if(istype(R, /datum/reagent/fermi)) + var/datum/chemical_reaction/Rcr = get_chemical_reaction(R.id) + if(Rcr && Rcr.FermiChem) fermianalyze = TRUE - var/datum/chemical_reaction/Rcr = get_chemical_reaction(R.id) var/pHpeakCache = (Rcr.OptimalpHMin + Rcr.OptimalpHMax)/2 var/datum/reagent/targetReagent = beaker.reagents.has_reagent("[R.id]") diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm index c21629ce8f..520148848c 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -33,18 +33,20 @@ var/addiction_stage4_end = 40 var/overdosed = 0 // You fucked up and this is now triggering its overdose effects, purge that shit quick. var/self_consuming = FALSE + var/metabolizing = FALSE + var/invisible = FALSE //Set to true if it doesn't appear on handheld health analyzers. //Fermichem vars: var/purity = 1 //How pure a chemical is from 0 - 1. var/addProc = FALSE //If the chemical should force an on_new() call - var/turf/loc = null //Should be the creation location! + var/turf/loc = null //Should be the creation location! var/pH = 7 //pH of the specific reagent, used for calculating the sum pH of a holder. + var/SplitChem = FALSE //If the chem splits on metabolism var/ImpureChem = "fermiTox"// What chemical is metabolised with an inpure reaction var/InverseChemVal = 0.25 // If the impurity is below 0.5, replace ALL of the chem with InverseChem upon metabolising var/InverseChem = "fermiTox"// What chem is metabolised when purity is below InverseChemVal, this shouldn't be made, but if it does, well, I guess I'll know about it. var/DoNotSplit = FALSE // If impurity is handled within the main chem itself var/OnMobMergeCheck = FALSE //Call on_mob_life proc when reagents are merging. - var/metabolizing = FALSE - var/invisible = FALSE //Set to true if it doesn't appear on handheld health analyzers. + /datum/reagent/Destroy() // This should only be called by the holder, so it's already handled clearing its references . = ..() @@ -74,7 +76,27 @@ return // Called when this reagent is first added to a mob -/datum/reagent/proc/on_mob_add(mob/living/L) +/datum/reagent/proc/on_mob_add(mob/living/L, amount) + if(SplitChem) + var/mob/living/carbon/M = L + if(!M) + return + if(purity < 0) + CRASH("Purity below 0 for chem: [id], Please let Fermis Know!") + if (purity == 1 || DoNotSplit == TRUE) + log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume]u of [id]") + return + else if (InverseChemVal > purity)//Turns all of a added reagent into the inverse chem + M.reagents.remove_reagent(id, amount, FALSE) + M.reagents.add_reagent(InverseChem, amount, FALSE, other_purity = 1) + log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume]u of [InverseChem]") + return + else + var/impureVol = amount * (1 - purity) //turns impure ratio into impure chem + M.reagents.remove_reagent(id, (impureVol), FALSE) + M.reagents.add_reagent(ImpureChem, impureVol, FALSE, other_purity = 1) + log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume - impureVol]u of [id]") + log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume]u of [ImpureChem]") return // Called when this reagent is removed while inside a mob @@ -97,7 +119,32 @@ return // Called when two reagents of the same are mixing. -/datum/reagent/proc/on_merge(data) +/datum/reagent/proc/on_merge(data, amount, mob/living/carbon/M, purity) + if(SplitChem) + if(!ishuman(M)) + return + if (purity < 0) + CRASH("Purity below 0 for chem: [id], Please let Fermis Know!") + if (purity == 1 || DoNotSplit == TRUE) + log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume]u of [id] in themselves") + return + else if (InverseChemVal > purity) + M.reagents.remove_reagent(id, amount, FALSE) + M.reagents.add_reagent(InverseChem, amount, FALSE, other_purity = 1) + for(var/datum/reagent/fermi/R in M.reagents.reagent_list) + if(R.name == "") + R.name = name//Negative effects are hidden + log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume]u of [InverseChem]") + return + else + var/impureVol = amount * (1 - purity) + M.reagents.remove_reagent(id, impureVol, FALSE) + M.reagents.add_reagent(ImpureChem, impureVol, FALSE, other_purity = 1) + for(var/datum/reagent/fermi/R in M.reagents.reagent_list) + if(R.name == "") + R.name = name//Negative effects are hidden + log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume - impureVol]u of [id]") + log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume]u of [ImpureChem]") return /datum/reagent/proc/on_update(atom/A) diff --git a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm index afd2be3f53..88073ca5f3 100644 --- a/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/alcohol_reagents.dm @@ -1373,6 +1373,7 @@ All effects don't start immediately, but rather get worse over time; the rate is /datum/reagent/consumable/ethanol/neurotoxin name = "Neurotoxin" + id = "neurotoxin" description = "A strong neurotoxin that puts the subject into a death-like state." color = "#2E2E61" // rgb: 46, 46, 97 boozepwr = 50 @@ -1382,6 +1383,10 @@ All effects don't start immediately, but rather get worse over time; the rate is glass_icon_state = "neurotoxinglass" glass_name = "Neurotoxin" glass_desc = "A drink that is guaranteed to knock you silly." + SplitChem = TRUE + ImpureChem = "neuroweak" + InverseChemVal = 0 //Clear conversion + InverseChem = "neuroweak" /datum/reagent/consumable/ethanol/neurotoxin/proc/pickt() return (pick(TRAIT_PARALYSIS_L_ARM,TRAIT_PARALYSIS_R_ARM,TRAIT_PARALYSIS_R_LEG,TRAIT_PARALYSIS_L_LEG)) @@ -1390,12 +1395,12 @@ All effects don't start immediately, but rather get worse over time; the rate is M.set_drugginess(50) M.dizziness +=2 M.adjustBrainLoss(1*REM, 150) - if(prob(20)) + if(prob(20) && !holder.has_reagent("neuroweak")) M.adjustStaminaLoss(10) M.drop_all_held_items() to_chat(M, "You cant feel your hands!") if(current_cycle > 5) - if(prob(20)) + if(prob(20) && !holder.has_reagent("neuroweak")) var/t = pickt() ADD_TRAIT(M, t, type) M.adjustStaminaLoss(10) @@ -1417,6 +1422,25 @@ All effects don't start immediately, but rather get worse over time; the rate is M.adjustStaminaLoss(10) ..() +/datum/reagent/consumable/ethanol/neuroweak + name = "Neuro-Smash" + id = "neuroweak" + description = "A mostly safe alcoholic drink for the true daredevils. Counteracts Neurotoxins." + boozepwr = 60 + pH = 8 + +/datum/reagent/consumable/ethanol/neuroweak/on_mob_life(mob/living/carbon/M) + if(holder.has_reagent("neurotoxin")) + M.adjustBrainLoss(-1*REM, 150) + M.reagents.remove_reagent("neurotoxin", 1.5 * REAGENTS_METABOLISM, FALSE) + if(holder.has_reagent("fentanyl")) + M.adjustBrainLoss(-1*REM, 150) + M.reagents.remove_reagent("fentanyl", 0.75 * REAGENTS_METABOLISM, FALSE) + else + M.adjustBrainLoss(-0.5*REM, 150) + M.dizziness +=2 + ..() + /datum/reagent/consumable/ethanol/hippies_delight name = "Hippie's Delight" id = "hippiesdelight" @@ -2133,7 +2157,7 @@ All effects don't start immediately, but rather get worse over time; the rate is glass_icon_state = "commander_and_chief" glass_name = "Commander and Chief" glass_desc = "The gems of this majestic chalice represent the departments and their Heads." - + /datum/reagent/consumable/ethanol/commander_and_chief/on_mob_life(mob/living/carbon/M) if(M.mind && HAS_TRAIT(M.mind, TRAIT_CAPTAIN_METABOLISM)) M.heal_bodypart_damage(2,2,2) diff --git a/code/modules/reagents/chemistry/reagents/drink_reagents.dm b/code/modules/reagents/chemistry/reagents/drink_reagents.dm index 42b4d983d3..dd51ce2bc7 100644 --- a/code/modules/reagents/chemistry/reagents/drink_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drink_reagents.dm @@ -13,6 +13,7 @@ glass_icon_state = "glass_orange" glass_name = "glass of orange juice" glass_desc = "Vitamins! Yay!" + pH = 3.3 /datum/reagent/consumable/orangejuice/on_mob_life(mob/living/carbon/M) if(M.getOxyLoss() && prob(30)) @@ -45,6 +46,7 @@ glass_icon_state = "glass_green" glass_name = "glass of lime juice" glass_desc = "A glass of sweet-sour lime juice." + pH = 2.2 /datum/reagent/consumable/limejuice/on_mob_life(mob/living/carbon/M) if(M.getToxLoss() && prob(20)) @@ -125,6 +127,7 @@ glass_icon_state = "lemonglass" glass_name = "glass of lemon juice" glass_desc = "Sour..." + pH = 2 /datum/reagent/consumable/banana name = "Banana Juice" 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 275c244a83..d7122e85e3 100644 --- a/modular_citadel/code/modules/reagents/chemistry/reagents/fermi_reagents.dm +++ b/modular_citadel/code/modules/reagents/chemistry/reagents/fermi_reagents.dm @@ -6,58 +6,17 @@ id = "fermi" taste_description = "affection and love!" can_synth = FALSE + SplitChem = TRUE //This should process fermichems to find out how pure they are and what effect to do. /datum/reagent/fermi/on_mob_add(mob/living/carbon/M, amount) . = ..() - if(!M) - return - if(purity < 0) - CRASH("Purity below 0 for chem: [id], Please let Fermis Know!") - if (purity == 1 || DoNotSplit == TRUE) - log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume]u of [id]") - return - else if (InverseChemVal > purity)//Turns all of a added reagent into the inverse chem - M.reagents.remove_reagent(id, amount, FALSE) - M.reagents.add_reagent(InverseChem, amount, FALSE, other_purity = 1) - log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume]u of [InverseChem]") - return - else - var/impureVol = amount * (1 - purity) //turns impure ratio into impure chem - M.reagents.remove_reagent(id, (impureVol), FALSE) - M.reagents.add_reagent(ImpureChem, impureVol, FALSE, other_purity = 1) - log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume - impureVol]u of [id]") - log_game("FERMICHEM: [M] ckey: [M.key] has ingested [volume]u of [ImpureChem]") - return + //When merging two fermichems, see above /datum/reagent/fermi/on_merge(data, amount, mob/living/carbon/M, purity)//basically on_mob_add but for merging . = ..() - if(!ishuman(M)) - return - if (purity < 0) - CRASH("Purity below 0 for chem: [id], Please let Fermis Know!") - if (purity == 1 || DoNotSplit == TRUE) - log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume]u of [id] in themselves") - return - else if (InverseChemVal > purity) - M.reagents.remove_reagent(id, amount, FALSE) - M.reagents.add_reagent(InverseChem, amount, FALSE, other_purity = 1) - for(var/datum/reagent/fermi/R in M.reagents.reagent_list) - if(R.name == "") - R.name = name//Negative effects are hidden - log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume]u of [InverseChem]") - return - else - var/impureVol = amount * (1 - purity) - M.reagents.remove_reagent(id, impureVol, FALSE) - M.reagents.add_reagent(ImpureChem, impureVol, FALSE, other_purity = 1) - for(var/datum/reagent/fermi/R in M.reagents.reagent_list) - if(R.name == "") - R.name = name//Negative effects are hidden - log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume - impureVol]u of [id]") - log_game("FERMICHEM: [M] ckey: [M.key] has merged [volume]u of [ImpureChem]") - return + //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/modular_citadel/code/modules/reagents/chemistry/recipes/fermi.dm b/modular_citadel/code/modules/reagents/chemistry/recipes/fermi.dm index 94bad98752..d993322fcb 100644 --- a/modular_citadel/code/modules/reagents/chemistry/recipes/fermi.dm +++ b/modular_citadel/code/modules/reagents/chemistry/recipes/fermi.dm @@ -2,15 +2,15 @@ mix_sound = 'sound/effects/bubbles.ogg' //Called for every reaction step -/datum/chemical_reaction/fermi/proc/FermiCreate(holder) +/datum/chemical_reaction/proc/FermiCreate(holder) return //Called when reaction STOP_PROCESSING -/datum/chemical_reaction/fermi/proc/FermiFinish(datum/reagents/holder) +/datum/chemical_reaction/proc/FermiFinish(datum/reagents/holder) return //Called when temperature is above a certain threshold, or if purity is too low. -/datum/chemical_reaction/fermi/proc/FermiExplode(datum/reagents, var/atom/my_atom, volume, temp, pH, Exploding = FALSE) +/datum/chemical_reaction/proc/FermiExplode(datum/reagents, var/atom/my_atom, volume, temp, pH, Exploding = FALSE) if (Exploding == TRUE) return @@ -101,10 +101,10 @@ PurityMin = 0.4 //The minimum purity something has to be above, otherwise it explodes. /datum/chemical_reaction/fermi/eigenstate/FermiFinish(datum/reagents/holder, var/atom/my_atom)//Strange how this doesn't work but the other does. - if(!locate(/datum/reagent/fermi/eigenstate) in my_atom.reagents.reagent_list) + var/datum/reagent/fermi/eigenstate/E = locate(/datum/reagent/fermi/eigenstate) in my_atom.reagents.reagent_list + if(!E) return var/turf/open/location = get_turf(my_atom) - var/datum/reagent/fermi/eigenstate/E = locate(/datum/reagent/fermi/eigenstate) in my_atom.reagents.reagent_list if(location) E.location_created = location E.data.["location_created"] = location