From 357246a115cbe2392c0542c9a7cfee3e7a8323be Mon Sep 17 00:00:00 2001 From: mikomyazaki Date: Fri, 11 Feb 2022 16:28:01 +0000 Subject: [PATCH] Puts holopads on their own list in SSmachines, reduces searching through all machines, frequently, while the UI is open. --- code/controllers/subsystems/machinery.dm | 2 ++ code/game/machinery/hologram.dm | 4 +++- code/modules/overmap/ships/ship.dm | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/code/controllers/subsystems/machinery.dm b/code/controllers/subsystems/machinery.dm index 6d874666c24..e88cb2f4ac3 100644 --- a/code/controllers/subsystems/machinery.dm +++ b/code/controllers/subsystems/machinery.dm @@ -19,6 +19,7 @@ var/tmp/powerusers_this_tick = 0 var/list/all_cameras = list() + var/list/obj/machinery/hologram/holopad/all_holopads = list() var/list/all_status_displays = list() // Note: This contains both ai_status_display and status_display. var/list/gravity_generators = list() @@ -32,6 +33,7 @@ /datum/controller/subsystem/machinery/Recover() all_cameras = SSmachinery.all_cameras + all_holopads = SSmachinery.all_holopads recipe_datums = SSmachinery.recipe_datums /datum/controller/subsystem/machinery/proc/queue_rcon_update() diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm index 4b07fa1c938..b231ccb7017 100644 --- a/code/game/machinery/hologram.dm +++ b/code/game/machinery/hologram.dm @@ -64,6 +64,7 @@ Possible to do for anyone motivated enough: get_holopad_id() desc += " Its ID is '[holopad_id]'" + SSmachinery.all_holopads += src listening_objects += src light_color = long_range ? rgb(225, 173, 125) : rgb(125, 180, 225) @@ -121,7 +122,7 @@ Possible to do for anyone motivated enough: /obj/machinery/hologram/holopad/vueui_data_change(var/list/data, var/mob/user, var/datum/vueui/ui) data = data || list() LAZYINITLIST(data["holopad_list"]) - for(var/obj/machinery/hologram/holopad/H in SSmachinery.processing_machines - src) + for(var/obj/machinery/hologram/holopad/H as anything in SSmachinery.all_holopads - src) if(can_connect(H) && H.operable()) data["holopad_list"]["\ref[H]"] = list("id" = H.holopad_id, "busy" = (H.has_established_connection() || H.incoming_connection), "ref" = "\ref[H]") data["command_auth"] = has_command_auth(user) @@ -444,6 +445,7 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/ end_call() clear_holos(TRUE) listening_objects -= src + SSmachinery.all_holopads -= src return ..() /obj/effect/overlay/hologram diff --git a/code/modules/overmap/ships/ship.dm b/code/modules/overmap/ships/ship.dm index 7a45aa34201..b66c5f329e3 100644 --- a/code/modules/overmap/ships/ship.dm +++ b/code/modules/overmap/ships/ship.dm @@ -213,7 +213,7 @@ ..() for(var/obj/machinery/computer/ship/S in SSmachinery.all_machines) S.attempt_hook_up(src) - for(var/obj/machinery/hologram/holopad/H in SSmachinery.all_machines) + for(var/obj/machinery/hologram/holopad/H as anything in SSmachinery.all_holopads) H.attempt_hook_up(src) for(var/datum/ship_engine/E in ship_engines) if(check_ownership(E.holder))