From 646e8d0b836c33526e4fb450a159331f5d4b38f7 Mon Sep 17 00:00:00 2001 From: Aranclanos Date: Tue, 2 Sep 2014 19:22:27 -0300 Subject: [PATCH] added a new proc for atmos machinery, nullifyPipenetwork(). As their name says, it will nullify the references of a pipenet network datum. Added qdel for pipenet network datums, this removes most of the singularity lag. Makes datums work on the garbage collector. --- code/ATMOSPHERICS/atmospherics.dm | 3 +++ .../components/binary_devices/binary_atmos_base.dm | 4 ++++ .../components/trinary_devices/trinary_base.dm | 5 +++++ code/ATMOSPHERICS/components/unary/unary_base.dm | 3 +++ code/ATMOSPHERICS/components/valve.dm | 4 ++++ code/ATMOSPHERICS/datum_pipe_network.dm | 13 +++++++++---- code/ATMOSPHERICS/datum_pipeline.dm | 10 +--------- code/controllers/garbage.dm | 3 ++- 8 files changed, 31 insertions(+), 14 deletions(-) diff --git a/code/ATMOSPHERICS/atmospherics.dm b/code/ATMOSPHERICS/atmospherics.dm index 2bb51158cbb..7a7b7b16949 100644 --- a/code/ATMOSPHERICS/atmospherics.dm +++ b/code/ATMOSPHERICS/atmospherics.dm @@ -87,3 +87,6 @@ Pipelines + Other Objects -> Pipe network qdel(src) else return ..() + +/obj/machinery/atmospherics/proc/nullifyPipenetwork() + return \ No newline at end of file diff --git a/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm b/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm index 923bb5ea0c2..27c9085e6ac 100644 --- a/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm +++ b/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm @@ -128,3 +128,7 @@ node2 = null return null + +/obj/machinery/atmospherics/binary/nullifyPipenetwork() + network1 = null + network2 = null \ No newline at end of file diff --git a/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm b/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm index deb86fb9f8e..4976ebb5feb 100644 --- a/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm @@ -160,3 +160,8 @@ node3 = null return null + +/obj/machinery/atmospherics/trinary/nullifyPipenetwork() + network1 = null + network2 = null + network3 = null \ No newline at end of file diff --git a/code/ATMOSPHERICS/components/unary/unary_base.dm b/code/ATMOSPHERICS/components/unary/unary_base.dm index 3ee2600b1e4..3efd0b1d2a6 100644 --- a/code/ATMOSPHERICS/components/unary/unary_base.dm +++ b/code/ATMOSPHERICS/components/unary/unary_base.dm @@ -97,3 +97,6 @@ del(network) return null + +/obj/machinery/atmospherics/unary/nullifyPipenetwork() + network = null \ No newline at end of file diff --git a/code/ATMOSPHERICS/components/valve.dm b/code/ATMOSPHERICS/components/valve.dm index 499b41e55ef..707e971c290 100644 --- a/code/ATMOSPHERICS/components/valve.dm +++ b/code/ATMOSPHERICS/components/valve.dm @@ -304,3 +304,7 @@ obj/machinery/atmospherics/valve/attack_hand(mob/user as mob) close() else open() + +/obj/machinery/atmospherics/valve/nullifyPipenetwork() + network_node1 = null + network_node2 = null \ No newline at end of file diff --git a/code/ATMOSPHERICS/datum_pipe_network.dm b/code/ATMOSPHERICS/datum_pipe_network.dm index 7956edb5a34..4a4b9b5191d 100644 --- a/code/ATMOSPHERICS/datum_pipe_network.dm +++ b/code/ATMOSPHERICS/datum_pipe_network.dm @@ -12,7 +12,14 @@ var/global/list/datum/pipe_network/pipe_networks = list() /datum/pipe_network/New() air_transient = new() + ..() +/datum/pipe_network/Destroy() + pipe_networks -= src + for(var/datum/pipeline/P in line_members) + P.network = null + for(var/obj/machinery/atmospherics/A in normal_members) + A.nullifyPipenetwork() ..() /datum/pipe_network/proc/process() @@ -30,7 +37,7 @@ var/global/list/datum/pipe_network/pipe_networks = list() //Notes: Assuming that members will add themselves to appropriate roster in network_expand() if(!start_normal) - del(src) + qdel(src) start_normal.network_expand(src, reference) @@ -39,7 +46,7 @@ var/global/list/datum/pipe_network/pipe_networks = list() if((normal_members.len>0)||(line_members.len>0)) pipe_networks += src else - del(src) + qdel(src) /datum/pipe_network/proc/merge(datum/pipe_network/giver) if(giver==src) return 0 @@ -56,8 +63,6 @@ var/global/list/datum/pipe_network/pipe_networks = list() for(var/datum/pipeline/line_member in giver.line_members) line_member.network = src - del(giver) - update_network_gases() return 1 diff --git a/code/ATMOSPHERICS/datum_pipeline.dm b/code/ATMOSPHERICS/datum_pipeline.dm index f686941aa35..bff793b1c0d 100644 --- a/code/ATMOSPHERICS/datum_pipeline.dm +++ b/code/ATMOSPHERICS/datum_pipeline.dm @@ -8,14 +8,6 @@ var/alert_pressure = 0 -/datum/pipeline/Del() - if(network) - del(network) - - if(air && air.volume) - temporarily_store_air() - ..() - /datum/pipeline/proc/process()//This use to be called called from the pipe networks //Check to see if pressure is within acceptable limits @@ -146,7 +138,7 @@ var/pipenetwarnings = 10 /datum/pipeline/Destroy() if(network) - del(network) + qdel(network) if(air && air.volume) temporarily_store_air() for(var/obj/machinery/atmospherics/pipe/P in members) diff --git a/code/controllers/garbage.dm b/code/controllers/garbage.dm index 322bc086d89..501ea8a2d92 100644 --- a/code/controllers/garbage.dm +++ b/code/controllers/garbage.dm @@ -70,7 +70,8 @@ var/datum/controller/garbage_collector/garbage = new() // This should be overridden to remove all references pointing to the object being destroyed. // Return true if the the GC controller should allow the object to continue existing. (Useful if pooling objects.) /datum/proc/Destroy() - del(src) + //del(src) + return /datum/var/gc_destroyed //Time when this object was destroyed.