Pipe network datum Destroy() cleanup

* Every pipe in a pipeline has a reference to the pipeline.  This needs to be cleared, both so the pipeline can be gc'd, and also so the pipes don't try and keep using the qdel'd pipeline.
* Same story for each pipeline in a pipe network, and each machine in a pipe network.
* Pipe networks are also in the pipe_networks global list.  While the controller would detect and remove it from the list on the next tick, cleaning up ourselves is the responsible thing to do.
This commit is contained in:
Leshana
2017-06-05 21:51:00 -04:00
parent 8752999a14
commit 010cca1d44
2 changed files with 11 additions and 0 deletions

View File

@@ -16,6 +16,15 @@ datum/pipe_network
..()
Destroy()
pipe_networks -= src
for(var/datum/pipeline/line_member in line_members)
line_member.network = null
for(var/obj/machinery/atmospherics/normal_member in normal_members)
normal_member.reassign_network(src, null)
gases.Cut() // Do not qdel the gases, we don't own them
return ..()
proc/process()
//Equalize gases amongst pipe if called for
if(update)

View File

@@ -14,6 +14,8 @@ datum/pipeline
if(air && air.volume)
temporarily_store_air()
for(var/obj/machinery/atmospherics/pipe/P in members)
P.parent = null
. = ..()