[MIRROR] Machine list is now stored in SSmachines | Remove excessive use of global lists for specific machine types [MDB IGNORE] (#22481)

* Machine list is now stored in SSmachines | Remove excessive use of global lists for specific machine types

* Resolve merge conflicts

* Modular adjustments

* destroy this double return on destroy

---------

Co-authored-by: Zephyr <12817816+ZephyrTFA@users.noreply.github.com>
Co-authored-by: Giz <vinylspiders@gmail.com>
This commit is contained in:
SkyratBot
2023-07-16 04:51:23 +02:00
committed by GitHub
parent 05a542d043
commit 0a03e8a2a7
88 changed files with 266 additions and 254 deletions
+1 -1
View File
@@ -28,7 +28,7 @@
/datum/fax_panel_interface/New()
//Get all faxes, and save them to our list.
for(var/obj/machinery/fax/fax in GLOB.machines)
for(var/obj/machinery/fax/fax as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/fax))
available_faxes += WEAKREF(fax)
//Get all stamps
+1 -1
View File
@@ -1349,7 +1349,7 @@
if(!check_rights(R_ADMIN))
return
var/code = random_nukecode()
for(var/obj/machinery/nuclearbomb/selfdestruct/SD in GLOB.nuke_list)
for(var/obj/machinery/nuclearbomb/selfdestruct/SD as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/nuclearbomb/selfdestruct))
SD.r_code = code
message_admins("[key_name_admin(usr)] has set the self-destruct \
code to \"[code]\".")
+1 -1
View File
@@ -277,7 +277,7 @@
SSshuttle.hostile_environments.Cut()
SSshuttle.checkHostileEnvironment()
/client/proc/toggle_nuke(obj/machinery/nuclearbomb/N in GLOB.nuke_list)
/client/proc/toggle_nuke(obj/machinery/nuclearbomb/N in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/nuclearbomb))
set category = "Admin.Events"
set name = "Toggle Nuke"
set popup_menu = FALSE
+3 -3
View File
@@ -7,19 +7,19 @@
SSblackbox.record_feedback("tally", "admin_verb", 1, "Check Plumbing") // If you are copy-pasting this, ensure the 4th parameter is unique to the new proc!
//all plumbing - yes, some things might get stated twice, doesn't matter.
for(var/obj/machinery/atmospherics/components/pipe in GLOB.machines)
for(var/obj/machinery/atmospherics/components/pipe as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/atmospherics/components))
if(pipe.z && (!pipe.nodes || !pipe.nodes.len || (null in pipe.nodes)))
to_chat(usr, "Unconnected [pipe.name] located at [ADMIN_VERBOSEJMP(pipe)]", confidential = TRUE)
//Pipes
for(var/obj/machinery/atmospherics/pipe/pipe in GLOB.machines)
for(var/obj/machinery/atmospherics/pipe/pipe as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/atmospherics/pipe))
if(istype(pipe, /obj/machinery/atmospherics/pipe/smart) || istype(pipe, /obj/machinery/atmospherics/pipe/layer_manifold))
continue
if(pipe.z && (!pipe.nodes || !pipe.nodes.len || (null in pipe.nodes)))
to_chat(usr, "Unconnected [pipe.name] located at [ADMIN_VERBOSEJMP(pipe)]", confidential = TRUE)
//Nodes
for(var/obj/machinery/atmospherics/node1 in GLOB.machines)
for(var/obj/machinery/atmospherics/node1 as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/atmospherics))
for(var/obj/machinery/atmospherics/node2 in node1.nodes)
if(!(node1 in node2.nodes))
to_chat(usr, "One-way connection in [node1.name] located at [ADMIN_VERBOSEJMP(node1)]", confidential = TRUE)
+3 -3
View File
@@ -299,7 +299,7 @@
areas_all.Add(A.type)
CHECK_TICK
for(var/obj/machinery/power/apc/APC in GLOB.apcs_list)
for(var/obj/machinery/power/apc/APC as anything in SSmachines.get_machines_by_type(/obj/machinery/power/apc))
var/area/A = APC.area
if(!A)
dat += "Skipped over [APC] in invalid location, [APC.loc]."
@@ -328,7 +328,7 @@
areas_with_RC.Add(A.type)
CHECK_TICK
for(var/obj/machinery/light/L in GLOB.machines)
for(var/obj/machinery/light/L as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/light))
var/area/A = get_area(L)
if(!A)
dat += "Skipped over [L] in invalid location, [L.loc].<br>"
@@ -337,7 +337,7 @@
areas_with_light.Add(A.type)
CHECK_TICK
for(var/obj/machinery/light_switch/LS in GLOB.machines)
for(var/obj/machinery/light_switch/LS as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/light_switch))
var/area/A = get_area(LS)
if(!A)
dat += "Skipped over [LS] in invalid location, [LS.loc].<br>"
+1 -1
View File
@@ -259,7 +259,7 @@
//SKYRAT EDIT END
//Open the Armory doors
if(ertemplate.opendoors)
for(var/obj/machinery/door/poddoor/ert/door in GLOB.airlocks)
for(var/obj/machinery/door/poddoor/ert/door as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door/poddoor/ert))
door.open()
CHECK_TICK
return TRUE
+5 -5
View File
@@ -71,7 +71,7 @@ GLOBAL_DATUM(everyone_a_traitor, /datum/everyone_is_a_traitor_controller)
if("maint_access_engiebrig")
if(!is_debugger)
return
for(var/obj/machinery/door/airlock/maintenance/doors in GLOB.airlocks)
for(var/obj/machinery/door/airlock/maintenance/doors as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door/airlock/maintenance))
if ((ACCESS_MAINT_TUNNELS in doors.req_access) || (ACCESS_MAINT_TUNNELS in doors.req_one_access))
doors.req_access = list()
doors.req_one_access = list(ACCESS_BRIG, ACCESS_ENGINEERING)
@@ -79,7 +79,7 @@ GLOBAL_DATUM(everyone_a_traitor, /datum/everyone_is_a_traitor_controller)
if("maint_access_brig")
if(!is_debugger)
return
for(var/obj/machinery/door/airlock/maintenance/doors in GLOB.airlocks)
for(var/obj/machinery/door/airlock/maintenance/doors as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door/airlock/maintenance))
if ((ACCESS_MAINT_TUNNELS in doors.req_access) || (ACCESS_MAINT_TUNNELS in doors.req_one_access))
doors.req_access = list(ACCESS_BRIG)
doors.req_one_access = list()
@@ -328,7 +328,7 @@ GLOBAL_DATUM(everyone_a_traitor, /datum/everyone_is_a_traitor_controller)
if(!is_funmin)
return
SSblackbox.record_feedback("nested tally", "admin_secrets_fun_used", 1, list("Egalitarian Station"))
for(var/obj/machinery/door/airlock/W in GLOB.airlocks)
for(var/obj/machinery/door/airlock/W as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door/airlock))
if(is_station_level(W.z) && !istype(get_area(W), /area/station/command) && !istype(get_area(W), /area/station/commons) && !istype(get_area(W), /area/station/service) && !istype(get_area(W), /area/station/command/heads_quarters) && !istype(get_area(W), /area/station/security/prison))
W.req_access = list()
message_admins("[key_name_admin(holder)] activated Egalitarian Station mode")
@@ -348,7 +348,7 @@ GLOBAL_DATUM(everyone_a_traitor, /datum/everyone_is_a_traitor_controller)
return
SSblackbox.record_feedback("nested tally", "admin_secrets_fun_used", 1, list("Break All Lights"))
message_admins("[key_name_admin(holder)] broke all lights")
for(var/obj/machinery/light/L in GLOB.machines)
for(var/obj/machinery/light/L as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/light))
L.break_light_tube()
stoplag()
if("whiteout")
@@ -356,7 +356,7 @@ GLOBAL_DATUM(everyone_a_traitor, /datum/everyone_is_a_traitor_controller)
return
SSblackbox.record_feedback("nested tally", "admin_secrets_fun_used", 1, list("Fix All Lights"))
message_admins("[key_name_admin(holder)] fixed all lights")
for(var/obj/machinery/light/L in GLOB.machines)
for(var/obj/machinery/light/L as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/light))
L.fix()
stoplag()
if("customportal")