From a2cfb0db71545120e0192d81edad9e7cb75fbc27 Mon Sep 17 00:00:00 2001 From: MistakeNot4892 Date: Sat, 26 Oct 2024 12:50:16 +1100 Subject: [PATCH 1/2] Prevents unsimulated turfs from accumulating CO2 or losing oxygen. --- code/modules/ZAS/Turf.dm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/code/modules/ZAS/Turf.dm b/code/modules/ZAS/Turf.dm index 28c6f073843..4ff0452552a 100644 --- a/code/modules/ZAS/Turf.dm +++ b/code/modules/ZAS/Turf.dm @@ -226,6 +226,10 @@ /turf/return_air() RETURN_TYPE(/datum/gas_mixture) + // TODO: immutable gas mixtures for stuff like this, to avoid creating new datums every time. + if(!simulated) + return make_air() + // ZAS participation if(zone && !zone.invalid) SSair.mark_zone_update(zone) @@ -256,7 +260,7 @@ return FALSE /turf/proc/make_air() - air = new/datum/gas_mixture + air = new /datum/gas_mixture air.temperature = temperature if(initial_gas) air.gas = initial_gas.Copy() From 31a80276e5ebaef7daffe4c4ec013021fd7dceaa Mon Sep 17 00:00:00 2001 From: "natakilar@gmail.com" Date: Wed, 11 Sep 2024 22:44:44 -0400 Subject: [PATCH 2/2] Attempt pipeline fix --- code/modules/atmospherics/datum_pipeline.dm | 14 +++++++++----- code/modules/atmospherics/pipes.dm | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/code/modules/atmospherics/datum_pipeline.dm b/code/modules/atmospherics/datum_pipeline.dm index a48a75e3092..3223d3251c1 100644 --- a/code/modules/atmospherics/datum_pipeline.dm +++ b/code/modules/atmospherics/datum_pipeline.dm @@ -32,8 +32,9 @@ if(air?.volume || liquid?.total_volume) temporarily_store_fluids() - QDEL_NULL(air) - QDEL_NULL(liquid) + + QDEL_NULL(air) + QDEL_NULL(liquid) for(var/obj/machinery/atmospherics/pipe/P in members) P.parent = null @@ -51,17 +52,20 @@ for(var/obj/machinery/atmospherics/pipe/member in members) if(!member.check_pressure(pressure)) members.Remove(member) + + // Safety check. + if(member.parent == src) + member.parent = null break //Only delete 1 pipe per process /datum/pipeline/proc/temporarily_store_fluids() //Update individual gas_mixtures by volume ratio var/liquid_transfer_per_pipe = min(REAGENT_UNITS_PER_PIPE, (liquid && length(members)) ? (liquid.total_volume / length(members)) : 0) - if(!liquid_transfer_per_pipe && !liquid_transfer_per_pipe) + if(!air?.volume && !liquid_transfer_per_pipe) return for(var/obj/machinery/atmospherics/pipe/member in members) - if(air?.volume) member.air_temporary = new member.air_temporary.copy_from(air) @@ -69,7 +73,7 @@ member.air_temporary.multiply(member.volume / air.volume) if(liquid_transfer_per_pipe) - member.liquid_temporary = new(REAGENT_UNITS_PER_PIPE, src) + member.liquid_temporary = new(REAGENT_UNITS_PER_PIPE, member) liquid.trans_to_holder(member.liquid_temporary, liquid_transfer_per_pipe) /datum/pipeline/proc/build_pipeline(obj/machinery/atmospherics/pipe/base) diff --git a/code/modules/atmospherics/pipes.dm b/code/modules/atmospherics/pipes.dm index 18d383289da..651028edca7 100644 --- a/code/modules/atmospherics/pipes.dm +++ b/code/modules/atmospherics/pipes.dm @@ -244,6 +244,7 @@ //TODO: leak to turf, doing pfshhhhh if(prob(5)) burst() + else return 1 else return 1