From fa1884b15d96f5c6e0025c2f776395b389896885 Mon Sep 17 00:00:00 2001 From: EgorDinamit Date: Thu, 15 Feb 2024 14:48:37 +0300 Subject: [PATCH] Fix attempt --- code/game/machinery/atmoalter/canister.dm | 6 +++--- .../machinery/atmoalter/portable_atmospherics.dm | 12 +++--------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/code/game/machinery/atmoalter/canister.dm b/code/game/machinery/atmoalter/canister.dm index 9e3475cae86..dcba9d30d1c 100644 --- a/code/game/machinery/atmoalter/canister.dm +++ b/code/game/machinery/atmoalter/canister.dm @@ -33,10 +33,10 @@ /// Associative list of gases for this canister to begin with and the moles to have. A negative value will fill the tank to its starting pressure with the gas. var/list/initial_gases = list() /// A temperature in Kelvin for this canister's air contents to begin with. Use this for pre-chilled gases. - var/initial_temperature + var/initial_temperature = null /obj/machinery/portable_atmospherics/canister/Initialize(mapload) - . = ..(mapload) + . = ..() if(prob(1)) desc += " Does not hold GAS." // huhuhu create_initial_gases() @@ -46,7 +46,7 @@ if (initial_gases?.len) for (var/gas_id in initial_gases) air_contents.adjust_gas(gas_id, initial_gases[gas_id] < 0 ? MolesForPressure() : initial_gases[gas_id]) - if (initial_temperature) + if(!isnull(initial_temperature)) air_contents.temperature = initial_temperature update_icon() diff --git a/code/game/machinery/atmoalter/portable_atmospherics.dm b/code/game/machinery/atmoalter/portable_atmospherics.dm index 234adee9c1a..88e646fb88a 100644 --- a/code/game/machinery/atmoalter/portable_atmospherics.dm +++ b/code/game/machinery/atmoalter/portable_atmospherics.dm @@ -15,14 +15,6 @@ var/maximum_pressure = 90 * ONE_ATMOSPHERE atom_flags = ATOM_FLAG_NO_TEMP_CHANGE | ATOM_FLAG_CLIMBABLE -/obj/machinery/portable_atmospherics/New() - ..() - - air_contents.volume = volume - air_contents.temperature = T20C - - return 1 - /obj/machinery/portable_atmospherics/Destroy() QDEL_NULL(air_contents) QDEL_NULL(holding) @@ -30,6 +22,8 @@ /obj/machinery/portable_atmospherics/Initialize() ..() + air_contents.volume = volume + air_contents.temperature = T20C return INITIALIZE_HINT_LATELOAD /obj/machinery/portable_atmospherics/LateInitialize() @@ -50,7 +44,7 @@ GAS_OXYGEN = O2STANDARD * MolesForPressure(), GAS_NITROGEN = N2STANDARD * MolesForPressure()) -/obj/machinery/portable_atmospherics/proc/MolesForPressure(var/target_pressure = start_pressure) +/obj/machinery/portable_atmospherics/proc/MolesForPressure(target_pressure = start_pressure) return (target_pressure * air_contents.volume) / (R_IDEAL_GAS_EQUATION * air_contents.temperature) /obj/machinery/portable_atmospherics/on_update_icon()