Skip to content

Commit

Permalink
Fix attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorDinamit committed Feb 15, 2024
1 parent 2f8ce52 commit fa1884b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
6 changes: 3 additions & 3 deletions code/game/machinery/atmoalter/canister.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()

Expand Down
12 changes: 3 additions & 9 deletions code/game/machinery/atmoalter/portable_atmospherics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,15 @@
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)
. = ..()

/obj/machinery/portable_atmospherics/Initialize()
..()
air_contents.volume = volume
air_contents.temperature = T20C
return INITIALIZE_HINT_LATELOAD

/obj/machinery/portable_atmospherics/LateInitialize()
Expand All @@ -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()
Expand Down

0 comments on commit fa1884b

Please sign in to comment.