From d8938a4e5bc0abac5cda9c6d6f73b0c5d2e055f4 Mon Sep 17 00:00:00 2001 From: Leshana Date: Fri, 9 Mar 2018 12:36:43 -0500 Subject: [PATCH] Fix pipe construction conflicting with existing pipes too much. Bug in the init_dirs_cache was not setting direction of pipes, making all cached dirs be for south. Because mapped in pipes didn't have piping layer set, mapped in pipes conflicted. The full-tile check for unary machines forgot to exclude *itself* --- code/ATMOSPHERICS/_atmospherics_helpers.dm | 37 +++++++++++++++++++ code/ATMOSPHERICS/atmospherics.dm | 5 ++- .../components/unary/unary_base.dm | 1 + code/ATMOSPHERICS/pipes/cap.dm | 4 ++ code/ATMOSPHERICS/pipes/manifold.dm | 4 ++ code/ATMOSPHERICS/pipes/manifold4w.dm | 4 ++ code/ATMOSPHERICS/pipes/simple.dm | 4 ++ code/game/machinery/pipe/construction.dm | 2 +- code/modules/multiz/pipes.dm | 4 ++ 9 files changed, 62 insertions(+), 3 deletions(-) diff --git a/code/ATMOSPHERICS/_atmospherics_helpers.dm b/code/ATMOSPHERICS/_atmospherics_helpers.dm index 6fc2b923dd..b5cd6486b9 100644 --- a/code/ATMOSPHERICS/_atmospherics_helpers.dm +++ b/code/ATMOSPHERICS/_atmospherics_helpers.dm @@ -455,3 +455,40 @@ var/sink_pressure = sink.return_pressure() return (source_pressure - sink_pressure)/(R_IDEAL_GAS_EQUATION * (source.temperature/source_volume + sink.temperature/sink_volume)) + +// +// Debugging helper procs +// + +/proc/atmos_piping_layer_str(piping_layer) + switch(piping_layer) + if(PIPING_LAYER_SUPPLY) + return "SUPPLY" + if(PIPING_LAYER_REGULAR) + return "REGULAR" + if(PIPING_LAYER_SCRUBBER) + return "SCRUBBER" + +/proc/atmos_pipe_flags_str(pipe_flags) + var/list/dat = list() + if(pipe_flags & PIPING_ALL_LAYER) + dat += "ALL_LAYER" + if(pipe_flags & PIPING_ONE_PER_TURF) + dat += "ONE_PER_TURF" + if(pipe_flags & PIPING_DEFAULT_LAYER_ONLY) + dat += "DEFAULT_LAYER_ONLY" + if(pipe_flags & PIPING_CARDINAL_AUTONORMALIZE) + dat += "CARDINAL_AUTONORMALIZE" + return dat.Join("|") + +/proc/atmos_connect_types_str(connect_types) + var/list/dat = list() + if(connect_types & CONNECT_TYPE_REGULAR) + dat += "REGULAR" + if(connect_types & CONNECT_TYPE_SUPPLY) + dat += "SUPPLY" + if(connect_types & CONNECT_TYPE_SCRUBBER) + dat += "SCRUBBER" + if(connect_types & CONNECT_TYPE_HE) + dat += "HE" + return dat.Join("|") diff --git a/code/ATMOSPHERICS/atmospherics.dm b/code/ATMOSPHERICS/atmospherics.dm index 940c5edf1c..fc074184d8 100644 --- a/code/ATMOSPHERICS/atmospherics.dm +++ b/code/ATMOSPHERICS/atmospherics.dm @@ -33,11 +33,12 @@ Pipelines + Other Objects -> Pipe network var/obj/machinery/atmospherics/node1 var/obj/machinery/atmospherics/node2 -/obj/machinery/atmospherics/New() +/obj/machinery/atmospherics/New(loc, newdir) ..() if(!icon_manager) icon_manager = new() - + if(!isnull(newdir)) + set_dir(newdir) if(!pipe_color) pipe_color = color color = null diff --git a/code/ATMOSPHERICS/components/unary/unary_base.dm b/code/ATMOSPHERICS/components/unary/unary_base.dm index db395ad6fc..12d6822ad4 100644 --- a/code/ATMOSPHERICS/components/unary/unary_base.dm +++ b/code/ATMOSPHERICS/components/unary/unary_base.dm @@ -104,6 +104,7 @@ // Returns TRUE if something is blocking, FALSE if its okay to continue. /obj/machinery/atmospherics/unary/proc/check_for_obstacles() for(var/obj/machinery/atmospherics/M in loc) + if(M == src) continue if((M.pipe_flags & pipe_flags & PIPING_ONE_PER_TURF)) //Only one dense/requires density object per tile, eg connectors/cryo/heater/coolers. visible_message("\The [src]'s cannot be connected, something is hogging the tile!") return TRUE diff --git a/code/ATMOSPHERICS/pipes/cap.dm b/code/ATMOSPHERICS/pipes/cap.dm index 8e56319d69..4bcf200140 100644 --- a/code/ATMOSPHERICS/pipes/cap.dm +++ b/code/ATMOSPHERICS/pipes/cap.dm @@ -79,6 +79,7 @@ desc = "An endcap for scrubbers pipes" icon_state = "cap-scrubbers" connect_types = CONNECT_TYPE_SCRUBBER + piping_layer = PIPING_LAYER_SCRUBBER layer = 2.38 icon_connect_type = "-scrubbers" color = PIPE_COLOR_RED @@ -88,6 +89,7 @@ desc = "An endcap for supply pipes" icon_state = "cap-supply" connect_types = CONNECT_TYPE_SUPPLY + piping_layer = PIPING_LAYER_SUPPLY layer = 2.39 icon_connect_type = "-supply" color = PIPE_COLOR_BLUE @@ -102,6 +104,7 @@ desc = "An endcap for scrubbers pipes" icon_state = "cap-f-scrubbers" connect_types = CONNECT_TYPE_SCRUBBER + piping_layer = PIPING_LAYER_SCRUBBER layer = 2.38 icon_connect_type = "-scrubbers" color = PIPE_COLOR_RED @@ -111,6 +114,7 @@ desc = "An endcap for supply pipes" icon_state = "cap-f-supply" connect_types = CONNECT_TYPE_SUPPLY + piping_layer = PIPING_LAYER_SUPPLY layer = 2.39 icon_connect_type = "-supply" color = PIPE_COLOR_BLUE diff --git a/code/ATMOSPHERICS/pipes/manifold.dm b/code/ATMOSPHERICS/pipes/manifold.dm index 8df3b4326a..bca6dd3379 100644 --- a/code/ATMOSPHERICS/pipes/manifold.dm +++ b/code/ATMOSPHERICS/pipes/manifold.dm @@ -165,6 +165,7 @@ desc = "A manifold composed of scrubbers pipes" icon_state = "map-scrubbers" connect_types = CONNECT_TYPE_SCRUBBER + piping_layer = PIPING_LAYER_SCRUBBER layer = 2.38 icon_connect_type = "-scrubbers" color = PIPE_COLOR_RED @@ -174,6 +175,7 @@ desc = "A manifold composed of supply pipes" icon_state = "map-supply" connect_types = CONNECT_TYPE_SUPPLY + piping_layer = PIPING_LAYER_SUPPLY layer = 2.39 icon_connect_type = "-supply" color = PIPE_COLOR_BLUE @@ -209,6 +211,7 @@ desc = "A manifold composed of scrubbers pipes" icon_state = "map-scrubbers" connect_types = CONNECT_TYPE_SCRUBBER + piping_layer = PIPING_LAYER_SCRUBBER layer = 2.38 icon_connect_type = "-scrubbers" color = PIPE_COLOR_RED @@ -218,6 +221,7 @@ desc = "A manifold composed of supply pipes" icon_state = "map-supply" connect_types = CONNECT_TYPE_SUPPLY + piping_layer = PIPING_LAYER_SUPPLY layer = 2.39 icon_connect_type = "-supply" color = PIPE_COLOR_BLUE diff --git a/code/ATMOSPHERICS/pipes/manifold4w.dm b/code/ATMOSPHERICS/pipes/manifold4w.dm index 1bd556b3fb..88adc47d62 100644 --- a/code/ATMOSPHERICS/pipes/manifold4w.dm +++ b/code/ATMOSPHERICS/pipes/manifold4w.dm @@ -167,6 +167,7 @@ desc = "A manifold composed of scrubbers pipes" icon_state = "map_4way-scrubbers" connect_types = CONNECT_TYPE_SCRUBBER + piping_layer = PIPING_LAYER_SCRUBBER layer = 2.38 icon_connect_type = "-scrubbers" color = PIPE_COLOR_RED @@ -176,6 +177,7 @@ desc = "A manifold composed of supply pipes" icon_state = "map_4way-supply" connect_types = CONNECT_TYPE_SUPPLY + piping_layer = PIPING_LAYER_SUPPLY layer = 2.39 icon_connect_type = "-supply" color = PIPE_COLOR_BLUE @@ -211,6 +213,7 @@ desc = "A manifold composed of scrubbers pipes" icon_state = "map_4way-scrubbers" connect_types = CONNECT_TYPE_SCRUBBER + piping_layer = PIPING_LAYER_SCRUBBER layer = 2.38 icon_connect_type = "-scrubbers" color = PIPE_COLOR_RED @@ -220,6 +223,7 @@ desc = "A manifold composed of supply pipes" icon_state = "map_4way-supply" connect_types = CONNECT_TYPE_SUPPLY + piping_layer = PIPING_LAYER_SUPPLY layer = 2.39 icon_connect_type = "-supply" color = PIPE_COLOR_BLUE diff --git a/code/ATMOSPHERICS/pipes/simple.dm b/code/ATMOSPHERICS/pipes/simple.dm index 289e8b4274..77290e5d8a 100644 --- a/code/ATMOSPHERICS/pipes/simple.dm +++ b/code/ATMOSPHERICS/pipes/simple.dm @@ -172,6 +172,7 @@ desc = "A one meter section of scrubbers pipe" icon_state = "intact-scrubbers" connect_types = CONNECT_TYPE_SCRUBBER + piping_layer = PIPING_LAYER_SCRUBBER layer = 2.38 icon_connect_type = "-scrubbers" color = PIPE_COLOR_RED @@ -181,6 +182,7 @@ desc = "A one meter section of supply pipe" icon_state = "intact-supply" connect_types = CONNECT_TYPE_SUPPLY + piping_layer = PIPING_LAYER_SUPPLY layer = 2.39 icon_connect_type = "-supply" color = PIPE_COLOR_BLUE @@ -216,6 +218,7 @@ desc = "A one meter section of scrubbers pipe" icon_state = "intact-scrubbers" connect_types = CONNECT_TYPE_SCRUBBER + piping_layer = PIPING_LAYER_SCRUBBER layer = 2.38 icon_connect_type = "-scrubbers" color = PIPE_COLOR_RED @@ -225,6 +228,7 @@ desc = "A one meter section of supply pipe" icon_state = "intact-supply" connect_types = CONNECT_TYPE_SUPPLY + piping_layer = PIPING_LAYER_SUPPLY layer = 2.39 icon_connect_type = "-supply" color = PIPE_COLOR_BLUE diff --git a/code/game/machinery/pipe/construction.dm b/code/game/machinery/pipe/construction.dm index 9c67a9bc5d..e4e42bbd7b 100644 --- a/code/game/machinery/pipe/construction.dm +++ b/code/game/machinery/pipe/construction.dm @@ -223,7 +223,7 @@ Buildable meters pipe_init_dirs_cache[type] = list() if(!pipe_init_dirs_cache[type]["[dir]"]) - var/obj/machinery/atmospherics/temp = new type(null, FALSE, dir) + var/obj/machinery/atmospherics/temp = new type(null, dir) pipe_init_dirs_cache[type]["[dir]"] = temp.get_init_dirs() qdel(temp) diff --git a/code/modules/multiz/pipes.dm b/code/modules/multiz/pipes.dm index 2f6e1e8dde..8d03c8f862 100644 --- a/code/modules/multiz/pipes.dm +++ b/code/modules/multiz/pipes.dm @@ -200,6 +200,7 @@ obj/machinery/atmospherics/pipe/zpipe/up/scrubbers name = "upwards scrubbers pipe" desc = "A scrubbers pipe segment to connect upwards." connect_types = CONNECT_TYPE_SCRUBBER + piping_layer = PIPING_LAYER_SCRUBBER layer = 2.38 icon_connect_type = "-scrubbers" color = PIPE_COLOR_RED @@ -209,6 +210,7 @@ obj/machinery/atmospherics/pipe/zpipe/up/supply name = "upwards supply pipe" desc = "A supply pipe segment to connect upwards." connect_types = CONNECT_TYPE_SUPPLY + piping_layer = PIPING_LAYER_SUPPLY layer = 2.39 icon_connect_type = "-supply" color = PIPE_COLOR_BLUE @@ -218,6 +220,7 @@ obj/machinery/atmospherics/pipe/zpipe/down/scrubbers name = "downwards scrubbers pipe" desc = "A scrubbers pipe segment to connect downwards." connect_types = CONNECT_TYPE_SCRUBBER + piping_layer = PIPING_LAYER_SCRUBBER layer = 2.38 icon_connect_type = "-scrubbers" color = PIPE_COLOR_RED @@ -227,6 +230,7 @@ obj/machinery/atmospherics/pipe/zpipe/down/supply name = "downwards supply pipe" desc = "A supply pipe segment to connect downwards." connect_types = CONNECT_TYPE_SUPPLY + piping_layer = PIPING_LAYER_SUPPLY layer = 2.39 icon_connect_type = "-supply" color = PIPE_COLOR_BLUE