diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index 957a2a1a52..fb064b6146 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -128,14 +128,12 @@ /datum/reagents/proc/remove_all(amount = 1) var/list/cached_reagents = reagent_list - if((total_volume - amount) <= 0)//Because this can result in 0, I don't want it to crash. - pH = 7 if(total_volume > 0) var/part = amount / total_volume for(var/reagent in cached_reagents) var/datum/reagent/R = reagent remove_reagent(R.id, R.volume * part, ignore_pH = TRUE) - + pH = REAGENT_NORMAL_PH update_total() handle_reactions() return amount @@ -404,7 +402,7 @@ for(var/B in cached_required_reagents) - if(!has_reagent(B, cached_required_reagents[B]*CHEMICAL_QUANTISATION_LEVEL))//Allows vols at less than 1 to react. + if(!has_reagent(B, cached_required_reagents[B]))//Allows vols at less than 1 to react. break total_matching_reagents++ for(var/B in cached_required_catalysts) @@ -504,6 +502,7 @@ for(var/B in cached_required_reagents) // multiplier = min(multiplier, round((get_reagent_amount(B) / cached_required_reagents[B]), CHEMICAL_QUANTISATION_LEVEL)) + for(var/B in cached_required_reagents) remove_reagent(B, (multiplier * cached_required_reagents[B]), safety = 1, ignore_pH = TRUE) @@ -546,17 +545,17 @@ var/list/cached_required_reagents = C.required_reagents//update reagents list var/list/cached_results = C.results//resultant chemical list var/multiplier = INFINITY - for(var/B in cached_required_reagents) // multiplier = min(multiplier, round((get_reagent_amount(B) / cached_required_reagents[B]), 0.0001)) - if (multiplier == 0)//clarity + if (multiplier <= 0)//clarity fermiEnd() return - for(var/P in C.required_catalysts) - if(!has_reagent(P)) - fermiEnd() - return + if(C.required_catalysts) + for(var/P in C.required_catalysts) + if(!has_reagent(P)) + fermiEnd() + return if (!fermiIsReacting) CRASH("Fermi has refused to stop reacting even though we asked her nicely.") @@ -869,7 +868,6 @@ var/new_total = cached_total + amount var/cached_temp = chem_temp var/list/cached_reagents = reagent_list - var/cached_pH = pH @@ -963,7 +961,7 @@ var/datum/reagent/R = A if (R.id == reagent) if((total_volume - amount) <= 0)//Because this can result in 0, I don't want it to crash. - pH = 7 + pH = REAGENT_NORMAL_PH //In practice this is really confusing and players feel like it randomly melts their beakers, but I'm not sure how else to handle it. We'll see how it goes and I can remove this if it confuses people. else if (!ignore_pH) //if (((pH > R.pH) && (pH <= 7)) || ((pH < R.pH) && (pH >= 7))) diff --git a/code/modules/reagents/chemistry/recipes/medicine.dm b/code/modules/reagents/chemistry/recipes/medicine.dm index d49e7a2d3d..15959d96ec 100644 --- a/code/modules/reagents/chemistry/recipes/medicine.dm +++ b/code/modules/reagents/chemistry/recipes/medicine.dm @@ -101,7 +101,8 @@ if(St.purity < 1) St.volume *= St.purity St.purity = 1 - N.volume -= 0.002 + var/amount = CLAMP(0.002, 0, N.volume) + N.volume -= amount St.data["grown_volume"] = St.data["grown_volume"] + added_volume /datum/chemical_reaction/styptic_powder diff --git a/modular_citadel/code/modules/reagents/chemistry/recipes/fermi.dm b/modular_citadel/code/modules/reagents/chemistry/recipes/fermi.dm index de56b4be68..47f71d1acf 100644 --- a/modular_citadel/code/modules/reagents/chemistry/recipes/fermi.dm +++ b/modular_citadel/code/modules/reagents/chemistry/recipes/fermi.dm @@ -28,7 +28,7 @@ return //Called when temperature is above a certain threshold, or if purity is too low. -/datum/chemical_reaction/proc/FermiExplode(datum/reagents, var/atom/my_atom, volume, temp, pH, Exploding = FALSE) +/datum/chemical_reaction/proc/FermiExplode(datum/reagents/R0, var/atom/my_atom, volume, temp, pH, Exploding = FALSE) if (Exploding == TRUE) return @@ -76,7 +76,7 @@ var/datum/effect_system/smoke_spread/chem/s = new() R.my_atom = my_atom //Give the gas a fingerprint - for (var/datum/reagent/reagent in my_atom.reagents.reagent_list) //make gas for reagents, has to be done this way, otherwise it never stops Exploding + for (var/datum/reagent/reagent in R0.reagent_list) //make gas for reagents, has to be done this way, otherwise it never stops Exploding R.add_reagent(reagent.id, reagent.volume/3) //Seems fine? I think I fixed the infinite explosion bug. if (reagent.purity < 0.6)