From 1044ea6ae979c4c830b2cc792ce2acaa17c4feb6 Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Tue, 20 Jul 2021 18:00:36 -0700 Subject: [PATCH 1/4] Update say_vr.dm --- code/modules/mob/say_vr.dm | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) diff --git a/code/modules/mob/say_vr.dm b/code/modules/mob/say_vr.dm index 94bf45c1b0..88bb526188 100644 --- a/code/modules/mob/say_vr.dm +++ b/code/modules/mob/say_vr.dm @@ -144,33 +144,14 @@ message = "[user] [user.say_emphasis(message)]" var/list/show_to = list() - var/list/processing = list() - var/safety = 25 + var/list/processed = list() for(var/obj/structure/table/T in range(user, 1)) - processing |= T - for(var/i = 1; i <= processing.len; ++i) - var/obj/structure/table/T = processing[i] - if(safety-- <= 0) - to_chat(user, "Table scan aborted early, some people might have not received the message (max 25)") - break - if(get_dist(T, user) > 7) - continue // nah - processing |= T - for(var/mob/living/M in range(T, 1)) // no ghosts/cameramobs - show_to |= M - var/obj/structure/table/other - other = locate() in get_step(T, NORTH) - if(other) - processing |= other - other = locate() in get_step(T, SOUTH) - if(other) - processing |= other - other = locate() in get_step(T, WEST) - if(other) - processing |= other - other = locate() in get_step(T, EAST) - if(other) - processing |= other + if(processed[T]) + continue + for(var/obj/structure/table/T2 in T.connected_floodfill(25)) + processed[T2] = TRUE + for(var/mob/living/L in range(T2, 1)) + show_to |= L for(var/i in show_to) var/mob/M = i 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 2/4] 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" From d38a775a163924e2b2a356007a89d8fb43ef13f1 Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Wed, 21 Jul 2021 21:33:46 -0700 Subject: [PATCH 3/4] Update tables_racks.dm --- code/game/objects/structures/tables_racks.dm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index d787d5d67f..c794dd811e 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -259,9 +259,9 @@ 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); \ + other = locate(/obj/structure/table) in get_step(src, dir); \ + if(other) { \ + other.connected_floodfill_internal(out, processed); \ } RUN_TABLE(NORTH) RUN_TABLE(SOUTH) From 224fb7f22c484834b2e6cdacf488a5fe074cb608 Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Wed, 21 Jul 2021 21:34:10 -0700 Subject: [PATCH 4/4] Update tables_racks.dm --- code/game/objects/structures/tables_racks.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index c794dd811e..065c0d2f28 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -252,7 +252,7 @@ . = list() connected_floodfill_internal(., list()) -/obj/structure/table/proc/connected_floodfill_internal(list/out, list/processed) +/obj/structure/table/proc/connected_floodfill_internal(list/out = list(), list/processed = list()) if(processed[src]) return processed[src] = TRUE