From 7b9f87a550a105268ea7073f1db6c5d69ce429aa Mon Sep 17 00:00:00 2001 From: 170141183460469231731687303715884105727 Date: Sun, 25 Jul 2021 19:41:35 +0100 Subject: [PATCH 1/7] Test --- .../atmospherics/machinery/pipes/pipes.dm | 1 + .../atmospherics/machinery/pipes/smart.dm | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/code/modules/atmospherics/machinery/pipes/pipes.dm b/code/modules/atmospherics/machinery/pipes/pipes.dm index 62ff2734d1b66..2bcbe8ab3d9a3 100644 --- a/code/modules/atmospherics/machinery/pipes/pipes.dm +++ b/code/modules/atmospherics/machinery/pipes/pipes.dm @@ -127,6 +127,7 @@ update_pipe_icon() update_layer() + /obj/machinery/atmospherics/proc/update_node_icon() for(var/i in 1 to device_type) if(nodes[i]) diff --git a/code/modules/atmospherics/machinery/pipes/smart.dm b/code/modules/atmospherics/machinery/pipes/smart.dm index 32e0583acd347..d82aaadcf9ae0 100644 --- a/code/modules/atmospherics/machinery/pipes/smart.dm +++ b/code/modules/atmospherics/machinery/pipes/smart.dm @@ -11,6 +11,32 @@ GLOBAL_LIST_INIT(atmos_components, typecacheof(list(/obj/machinery/atmospherics) construction_type = /obj/item/pipe/quaternary pipe_state = "manifold4w" connection_num = 0 + var/list/connections + +/obj/machinery/atmospherics/pipe/smart/proc/check_connections() + connection_num = 0 + connections = NONE + for(var/direction in GLOB.cardinals) + var/turf/turf = get_step(src, direction) + if(!turf) + continue + for(var/obj/machinery/atmospherics/machine in turf) + if(connection_check(machine, piping_layer)) + connections |= direction + connection_num++ + break + + switch(connection_num) + if(0) + dir = 2 + if(1) + dir = connections + if(2) + dir = check_binary_direction(connections) + if(3) + dir = connections + if(4) + dir = 15 /obj/machinery/atmospherics/pipe/smart/update_pipe_icon() icon = 'icons/obj/atmospherics/pipes/pipes_bitmask.dmi' @@ -56,6 +82,7 @@ GLOBAL_LIST_INIT(atmos_components, typecacheof(list(/obj/machinery/atmospherics) bitfield |= WEST_SHORTPIPE icon_state = "[bitfield]_[piping_layer]" + check_connections() /obj/machinery/atmospherics/pipe/smart/SetInitDirections(init_dir) if(init_dir) From 262a526d3157ca452e54cece0fef01dd0f74902e Mon Sep 17 00:00:00 2001 From: 170141183460469231731687303715884105727 Date: Tue, 10 Aug 2021 19:34:05 +0100 Subject: [PATCH 2/7] Test --- .../atmospherics/machinery/pipes/smart.dm | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/code/modules/atmospherics/machinery/pipes/smart.dm b/code/modules/atmospherics/machinery/pipes/smart.dm index d82aaadcf9ae0..0681b6227c128 100644 --- a/code/modules/atmospherics/machinery/pipes/smart.dm +++ b/code/modules/atmospherics/machinery/pipes/smart.dm @@ -13,19 +13,7 @@ GLOBAL_LIST_INIT(atmos_components, typecacheof(list(/obj/machinery/atmospherics) connection_num = 0 var/list/connections -/obj/machinery/atmospherics/pipe/smart/proc/check_connections() - connection_num = 0 - connections = NONE - for(var/direction in GLOB.cardinals) - var/turf/turf = get_step(src, direction) - if(!turf) - continue - for(var/obj/machinery/atmospherics/machine in turf) - if(connection_check(machine, piping_layer)) - connections |= direction - connection_num++ - break - +/obj/machinery/atmospherics/pipe/smart/proc/check_connections(connections, connection_num) switch(connection_num) if(0) dir = 2 @@ -47,6 +35,7 @@ GLOBAL_LIST_INIT(atmos_components, typecacheof(list(/obj/machinery/atmospherics) continue var/obj/machinery/atmospherics/node = nodes[i] var/connected_dir = get_dir(src, node) + connections |= connected_dir bits++ switch(connected_dir) if(NORTH) @@ -82,7 +71,7 @@ GLOBAL_LIST_INIT(atmos_components, typecacheof(list(/obj/machinery/atmospherics) bitfield |= WEST_SHORTPIPE icon_state = "[bitfield]_[piping_layer]" - check_connections() + check_connections(connections, connection_num) /obj/machinery/atmospherics/pipe/smart/SetInitDirections(init_dir) if(init_dir) From 3659f79fd77e18c8d91c78e7dec50acf0dfdba91 Mon Sep 17 00:00:00 2001 From: 170141183460469231731687303715884105727 Date: Tue, 10 Aug 2021 20:31:15 +0100 Subject: [PATCH 3/7] Forgot to do this thing. --- code/modules/atmospherics/machinery/pipes/smart.dm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/code/modules/atmospherics/machinery/pipes/smart.dm b/code/modules/atmospherics/machinery/pipes/smart.dm index 0681b6227c128..e73121640e612 100644 --- a/code/modules/atmospherics/machinery/pipes/smart.dm +++ b/code/modules/atmospherics/machinery/pipes/smart.dm @@ -13,16 +13,16 @@ GLOBAL_LIST_INIT(atmos_components, typecacheof(list(/obj/machinery/atmospherics) connection_num = 0 var/list/connections -/obj/machinery/atmospherics/pipe/smart/proc/check_connections(connections, connection_num) - switch(connection_num) +/obj/machinery/atmospherics/pipe/smart/proc/check_connections(connected, connection_number) + switch(connection_number) if(0) dir = 2 if(1) - dir = connections + dir = connected if(2) - dir = check_binary_direction(connections) + dir = check_binary_direction(connected) if(3) - dir = connections + dir = connected if(4) dir = 15 @@ -30,12 +30,15 @@ GLOBAL_LIST_INIT(atmos_components, typecacheof(list(/obj/machinery/atmospherics) icon = 'icons/obj/atmospherics/pipes/pipes_bitmask.dmi' var/bitfield = NONE var/bits = 0 + connections = 0 + connection_num = 0 for(var/i in 1 to device_type) if(!nodes[i]) continue var/obj/machinery/atmospherics/node = nodes[i] var/connected_dir = get_dir(src, node) connections |= connected_dir + connection_num += 1 bits++ switch(connected_dir) if(NORTH) From 93e1a2dcb2a16c18082505c4cec2a9df15d78442 Mon Sep 17 00:00:00 2001 From: 170141183460469231731687303715884105727 Date: Tue, 10 Aug 2021 21:08:59 +0100 Subject: [PATCH 4/7] Okay --- .../atmospherics/machinery/pipes/smart.dm | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/code/modules/atmospherics/machinery/pipes/smart.dm b/code/modules/atmospherics/machinery/pipes/smart.dm index e73121640e612..ff893056359cd 100644 --- a/code/modules/atmospherics/machinery/pipes/smart.dm +++ b/code/modules/atmospherics/machinery/pipes/smart.dm @@ -10,22 +10,9 @@ GLOBAL_LIST_INIT(atmos_components, typecacheof(list(/obj/machinery/atmospherics) device_type = QUATERNARY construction_type = /obj/item/pipe/quaternary pipe_state = "manifold4w" - connection_num = 0 + var/connection_num var/list/connections -/obj/machinery/atmospherics/pipe/smart/proc/check_connections(connected, connection_number) - switch(connection_number) - if(0) - dir = 2 - if(1) - dir = connected - if(2) - dir = check_binary_direction(connected) - if(3) - dir = connected - if(4) - dir = 15 - /obj/machinery/atmospherics/pipe/smart/update_pipe_icon() icon = 'icons/obj/atmospherics/pipes/pipes_bitmask.dmi' var/bitfield = NONE @@ -74,7 +61,17 @@ GLOBAL_LIST_INIT(atmos_components, typecacheof(list(/obj/machinery/atmospherics) bitfield |= WEST_SHORTPIPE icon_state = "[bitfield]_[piping_layer]" - check_connections(connections, connection_num) + switch(connection_num) + if(0) + dir = 2 + if(1) + dir = connections + if(2) + dir = check_binary_direction(connections) + if(3) + dir = connections + if(4) + dir = 15 /obj/machinery/atmospherics/pipe/smart/SetInitDirections(init_dir) if(init_dir) From 44f1fa37e444d936d6eab808819439b0db27a608 Mon Sep 17 00:00:00 2001 From: 170141183460469231731687303715884105727 Date: Tue, 10 Aug 2021 21:15:01 +0100 Subject: [PATCH 5/7] Why did I do that? --- code/modules/atmospherics/machinery/pipes/smart.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/atmospherics/machinery/pipes/smart.dm b/code/modules/atmospherics/machinery/pipes/smart.dm index ff893056359cd..aaa3c8b83b3ba 100644 --- a/code/modules/atmospherics/machinery/pipes/smart.dm +++ b/code/modules/atmospherics/machinery/pipes/smart.dm @@ -10,7 +10,7 @@ GLOBAL_LIST_INIT(atmos_components, typecacheof(list(/obj/machinery/atmospherics) device_type = QUATERNARY construction_type = /obj/item/pipe/quaternary pipe_state = "manifold4w" - var/connection_num + connection_num = 0 var/list/connections /obj/machinery/atmospherics/pipe/smart/update_pipe_icon() From e7fc337ce5326012e3b51ad88f14e8cec1db7f96 Mon Sep 17 00:00:00 2001 From: 170141183460469231731687303715884105727 Date: Tue, 10 Aug 2021 21:15:38 +0100 Subject: [PATCH 6/7] Arghh --- code/modules/atmospherics/machinery/pipes/smart.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/atmospherics/machinery/pipes/smart.dm b/code/modules/atmospherics/machinery/pipes/smart.dm index aaa3c8b83b3ba..4091c886744f5 100644 --- a/code/modules/atmospherics/machinery/pipes/smart.dm +++ b/code/modules/atmospherics/machinery/pipes/smart.dm @@ -18,7 +18,7 @@ GLOBAL_LIST_INIT(atmos_components, typecacheof(list(/obj/machinery/atmospherics) var/bitfield = NONE var/bits = 0 connections = 0 - connection_num = 0 + connection_num = NONE for(var/i in 1 to device_type) if(!nodes[i]) continue From 44b66e3410be101581a8e9ff8947b814523cc30b Mon Sep 17 00:00:00 2001 From: 170141183460469231731687303715884105727 Date: Tue, 10 Aug 2021 21:26:17 +0100 Subject: [PATCH 7/7] Not sure how that got here. --- code/modules/atmospherics/machinery/pipes/pipes.dm | 1 - 1 file changed, 1 deletion(-) diff --git a/code/modules/atmospherics/machinery/pipes/pipes.dm b/code/modules/atmospherics/machinery/pipes/pipes.dm index 2bcbe8ab3d9a3..62ff2734d1b66 100644 --- a/code/modules/atmospherics/machinery/pipes/pipes.dm +++ b/code/modules/atmospherics/machinery/pipes/pipes.dm @@ -127,7 +127,6 @@ update_pipe_icon() update_layer() - /obj/machinery/atmospherics/proc/update_node_icon() for(var/i in 1 to device_type) if(nodes[i])