From 16622ac95ac1a722968f83a55888f89dec1e5a2c Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Tue, 20 Jul 2021 18:06:49 -0700 Subject: [PATCH] Update tables_racks.dm --- code/game/objects/structures/tables_racks.dm | 26 ++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index 6356424aaf..d787d5d67f 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -243,6 +243,32 @@ new framestack(T, framestackamount) qdel(src) + +/** + * Gets all connected tables + * Cardinals only + */ +/obj/structure/table/proc/connected_floodfill(max = 25) + . = list() + connected_floodfill_internal(., list()) + +/obj/structure/table/proc/connected_floodfill_internal(list/out, list/processed) + if(processed[src]) + return + processed[src] = TRUE + out += src + var/obj/structure/table/other +#define RUN_TABLE(dir) \ + T = locate(/obj/structure/table) in get_step(src, dir); \ + if(T) { \ + T.connected_floodfill_internal(out, processed); \ + } + RUN_TABLE(NORTH) + RUN_TABLE(SOUTH) + RUN_TABLE(EAST) + RUN_TABLE(WEST) +#undef RUN_TABLE + /obj/structure/table/greyscale icon = 'icons/obj/smooth_structures/table_greyscale.dmi' icon_state = "table"