From 51f85c58a424842dc3757f00f2d9a496f4a76172 Mon Sep 17 00:00:00 2001 From: Putnam3145 Date: Mon, 4 Oct 2021 20:56:08 -0700 Subject: [PATCH 1/2] One last ashwalker fix --- code/datums/atmosphere/_atmosphere.dm | 5 +++++ code/datums/atmosphere/planetary.dm | 7 +++++++ code/modules/atmospherics/auxgm/breathing_classes.dm | 6 ++++++ code/modules/surgery/organs/lungs.dm | 3 ++- 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/code/datums/atmosphere/_atmosphere.dm b/code/datums/atmosphere/_atmosphere.dm index 5323b070cd..7fe8e44d75 100644 --- a/code/datums/atmosphere/_atmosphere.dm +++ b/code/datums/atmosphere/_atmosphere.dm @@ -16,6 +16,9 @@ /datum/atmosphere/New() generate_gas_string() +/datum/atmosphere/proc/check_for_sanity(datum/gas_mixture/mix) + return + /datum/atmosphere/proc/generate_gas_string() var/list/spicy_gas = restricted_gases.Copy() var/target_pressure = rand(minimum_pressure, maximum_pressure) @@ -52,6 +55,8 @@ gasmix.adjust_moles(gastype, -moles_to_remove) gasmix.set_moles(gastype, FLOOR(gasmix.get_moles(gastype), 0.1)) + check_for_sanity(gasmix) + // Now finally lets make that string var/list/gas_string_builder = list() for(var/id in gasmix.get_gases()) diff --git a/code/datums/atmosphere/planetary.dm b/code/datums/atmosphere/planetary.dm index 69abba85e5..8089a9a7d1 100644 --- a/code/datums/atmosphere/planetary.dm +++ b/code/datums/atmosphere/planetary.dm @@ -23,6 +23,13 @@ minimum_temp = 270 maximum_temp = 320 +/datum/atmosphere/lavaland/check_for_sanity(datum/gas_mixture/mix) + var/datum/breathing_class/o2_class = GLOB.gas_data.breathing_classes[BREATH_OXY] + var/initial_co2_quantity = mix.get_moles(GAS_CO2) + while(o2_class.get_effective_pp(mix) < 10) + mix.adjust_moles(GAS_CO2, -0.5) + mix.adjust_moles(GAS_O2, 0.5) + /datum/atmosphere/icemoon id = ICEMOON_DEFAULT_ATMOS diff --git a/code/modules/atmospherics/auxgm/breathing_classes.dm b/code/modules/atmospherics/auxgm/breathing_classes.dm index 4abfab58ee..cfc82adbff 100644 --- a/code/modules/atmospherics/auxgm/breathing_classes.dm +++ b/code/modules/atmospherics/auxgm/breathing_classes.dm @@ -14,6 +14,12 @@ var/high_alert_category = "too_much_oxy" var/high_alert_datum = /atom/movable/screen/alert/too_much_oxy +/datum/breathing_class/proc/get_effective_pp(datum/gas_mixture/breath) + var/mol = 0 + for(var/gas in gases) + mol += breath.get_moles(gas) * gases[gas] + return (mol/breath.total_moles()) * breath.return_pressure() + /datum/breathing_class/oxygen gases = list( GAS_O2 = 1, diff --git a/code/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm index e10b05822b..5c914e3d4d 100644 --- a/code/modules/surgery/organs/lungs.dm +++ b/code/modules/surgery/organs/lungs.dm @@ -528,7 +528,8 @@ BZ_brain_damage_min += bz gas_max[GAS_N2] = PP(breath, GAS_N2) + 5 - var/o2_pp = PP(breath, GAS_O2) + var/datum/breathing_class/class = GLOB.gas_data.breathing_classes[breathing_class] + var/o2_pp = class.get_effective_pp(breath) safe_breath_min = 0.3 * o2_pp safe_breath_max = 1.3 * o2_pp ..() From 8070df64920b96fba50cafd5e2f7bb7378b84db4 Mon Sep 17 00:00:00 2001 From: Putnam3145 Date: Tue, 5 Oct 2021 19:07:52 -0700 Subject: [PATCH 2/2] whoops --- code/datums/atmosphere/planetary.dm | 1 - 1 file changed, 1 deletion(-) diff --git a/code/datums/atmosphere/planetary.dm b/code/datums/atmosphere/planetary.dm index 8089a9a7d1..f1d2e85755 100644 --- a/code/datums/atmosphere/planetary.dm +++ b/code/datums/atmosphere/planetary.dm @@ -25,7 +25,6 @@ /datum/atmosphere/lavaland/check_for_sanity(datum/gas_mixture/mix) var/datum/breathing_class/o2_class = GLOB.gas_data.breathing_classes[BREATH_OXY] - var/initial_co2_quantity = mix.get_moles(GAS_CO2) while(o2_class.get_effective_pp(mix) < 10) mix.adjust_moles(GAS_CO2, -0.5) mix.adjust_moles(GAS_O2, 0.5)