diff --git a/code/modules/atmospherics/datum_pipeline.dm b/code/modules/atmospherics/datum_pipeline.dm index 61b7f9688c2..cace579e65b 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 f107e3b59c1..8e96923a062 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