From 4b21f5f8ad57ef3d77252239e6306817a3edfae5 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Sat, 15 Aug 2015 15:46:52 -0400 Subject: [PATCH] Fixes pipes disappearing when wrenching fails --- code/controllers/Processes/garbage.dm | 4 ++++ code/game/machinery/pipe/construction.dm | 18 +++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/code/controllers/Processes/garbage.dm b/code/controllers/Processes/garbage.dm index 31a28a91a58..b3f1917f6b2 100644 --- a/code/controllers/Processes/garbage.dm +++ b/code/controllers/Processes/garbage.dm @@ -80,6 +80,10 @@ var/list/delayed_garbage = list() /datum/controller/process/garbage_collector/getStatName() return ..()+"([garbage_collector.destroyed.len]/[garbage_collector.dels]/[garbage_collector.hard_dels])" +// Tests if an atom has been deleted. +/proc/deleted(atom/A) + return !A || !isnull(A.gcDestroyed) + // Should be treated as a replacement for the 'del' keyword. // Datums passed to this will be given a chance to clean up references to allow the GC to collect them. /proc/qdel(var/datum/A) diff --git a/code/game/machinery/pipe/construction.dm b/code/game/machinery/pipe/construction.dm index 9bee0af72f4..c6d257c5cb1 100644 --- a/code/game/machinery/pipe/construction.dm +++ b/code/game/machinery/pipe/construction.dm @@ -463,7 +463,7 @@ Buildable meters var/turf/T = P.loc P.level = T.intact ? 2 : 1 P.initialize() - if (!P) + if (deleted(P)) usr << pipefailtext return 1 P.build_network() @@ -482,7 +482,7 @@ Buildable meters var/turf/T = P.loc P.level = T.intact ? 2 : 1 P.initialize() - if (!P) + if (deleted(P)) usr << pipefailtext return 1 P.build_network() @@ -501,7 +501,7 @@ Buildable meters var/turf/T = P.loc P.level = T.intact ? 2 : 1 P.initialize() - if (!P) + if (deleted(P)) usr << pipefailtext return 1 P.build_network() @@ -520,7 +520,7 @@ Buildable meters var/turf/T = P.loc P.level = T.intact ? 2 : 1 P.initialize() - if (!P) + if (deleted(P)) usr << pipefailtext return 1 P.build_network() @@ -539,7 +539,7 @@ Buildable meters //var/turf/T = P.loc //P.level = T.intact ? 2 : 1 P.initialize() - if (!P) + if (deleted(P)) usr << pipefailtext return 1 P.build_network() @@ -574,7 +574,7 @@ Buildable meters var/turf/T = M.loc M.level = T.intact ? 2 : 1 M.initialize() - if (!M) + if (deleted(M)) usr << pipefailtext return 1 M.build_network() @@ -643,7 +643,7 @@ Buildable meters var/turf/T = M.loc M.level = T.intact ? 2 : 1 M.initialize() - if (!M) + if (deleted(M)) usr << pipefailtext return 1 M.build_network() @@ -722,7 +722,7 @@ Buildable meters //var/turf/T = P.loc //P.level = T.intact ? 2 : 1 P.initialize() - if (!P) + if (deleted(P)) usr << pipefailtext //"There's nothing to connect this pipe to! (with how the pipe code works, at least one end needs to be connected to something, otherwise the game deletes the segment)" return 1 P.build_network() @@ -905,7 +905,7 @@ Buildable meters var/turf/T = P.loc P.level = T.intact ? 2 : 1 P.initialize() - if (!P) + if (deleted(P)) usr << pipefailtext return 1 P.build_network()