diff --git a/code/_globalvars/lists/objects.dm b/code/_globalvars/lists/objects.dm
index 66ce6b862f1..d8bfbf0eac3 100644
--- a/code/_globalvars/lists/objects.dm
+++ b/code/_globalvars/lists/objects.dm
@@ -19,7 +19,6 @@ GLOBAL_LIST_EMPTY(pandemics)
GLOBAL_LIST_EMPTY(all_areas)
GLOBAL_LIST_EMPTY_TYPED(all_unique_areas, /area) // List of all unique areas. AKA areas with there_can_be_many = FALSE
-GLOBAL_LIST_EMPTY(machines)
GLOBAL_LIST_EMPTY(telescreens) /// List of entertainment telescreens connected to the "news" cameranet
GLOBAL_LIST_EMPTY(rcd_list) //list of Rapid Construction Devices.
diff --git a/code/controllers/subsystem/SSair.dm b/code/controllers/subsystem/SSair.dm
index 06057844d02..980e0bc1076 100644
--- a/code/controllers/subsystem/SSair.dm
+++ b/code/controllers/subsystem/SSair.dm
@@ -174,8 +174,8 @@ SUBSYSTEM_DEF(air)
setup_overlays() // Assign icons and such for gas-turf-overlays
setup_turfs()
- setup_atmos_machinery(GLOB.machines)
- setup_pipenets(GLOB.machines)
+ setup_atmos_machinery(SSmachines.get_by_type(/obj/machinery/atmospherics))
+ setup_pipenets(SSmachines.get_by_type(/obj/machinery/atmospherics))
for(var/obj/machinery/atmospherics/A in machinery_to_construct)
A.initialize_atmos_network()
diff --git a/code/controllers/subsystem/SSmachinery.dm b/code/controllers/subsystem/SSmachinery.dm
index e17cf6ec8d6..2e6f32c7bcb 100644
--- a/code/controllers/subsystem/SSmachinery.dm
+++ b/code/controllers/subsystem/SSmachinery.dm
@@ -9,6 +9,12 @@ SUBSYSTEM_DEF(machines)
offline_implications = "Machinery will no longer process. Shuttle call recommended."
cpu_display = SS_CPUDISPLAY_HIGH
+ /// Associative list of all machines that exist.
+ VAR_PRIVATE/list/machines_by_type = list()
+
+ /// All machines, not just those that are processing.
+ VAR_PRIVATE/list/all_machines = list()
+
var/list/processing = list()
var/list/currentrun = list()
/// All regional powernets (/datum/regional_powernet) in the world
@@ -21,6 +27,37 @@ SUBSYSTEM_DEF(machines)
makepowernets()
fire()
+/// Registers a machine with the machine subsystem; should only be called by the machine itself during its creation.
+/datum/controller/subsystem/machines/proc/register_machine(obj/machinery/machine)
+ LAZYADD(machines_by_type[machine.type], machine)
+ all_machines |= machine
+
+/// Removes a machine from the machine subsystem; should only be called by the machine itself inside Destroy.
+/datum/controller/subsystem/machines/proc/unregister_machine(obj/machinery/machine)
+ var/list/existing = machines_by_type[machine.type]
+ existing -= machine
+ if(!length(existing))
+ machines_by_type -= machine.type
+ all_machines -= machine
+
+/// Gets a list of all machines that are either the passed type or a subtype.
+/datum/controller/subsystem/machines/proc/get_by_type(obj/machinery/machine_type, subtypes = TRUE)
+ if(!ispath(machine_type))
+ machine_type = machine_type.type
+ if(!ispath(machine_type, /obj/machinery))
+ CRASH("called SSmachines.get_by_type with a non-machine type [machine_type]")
+ . = list()
+ if(machine_type in machines_by_type)
+ . |= machines_by_type[machine_type]
+
+ if(!subtypes)
+ return
+
+ for(var/next_type in subtypesof(machine_type))
+ var/list/found_machines = machines_by_type[next_type]
+ if(found_machines)
+ . |= found_machines
+
/datum/controller/subsystem/machines/get_metrics()
. = ..()
var/list/cust = list()
@@ -39,7 +76,7 @@ SUBSYSTEM_DEF(machines)
propagate_network(PC, PC.powernet)
/datum/controller/subsystem/machines/get_stat_details()
- return "Machines: [length(processing)] | Powernets: [length(powernets)] | Deferred: [length(deferred_powernet_rebuilds)]"
+ return "Machines: [length(all_machines)] | Powernets: [length(powernets)] | Deferred: [length(deferred_powernet_rebuilds)]"
/datum/controller/subsystem/machines/proc/process_defered_powernets(resumed = 0)
if(!resumed)
diff --git a/code/controllers/subsystem/non_firing/SSlate_mapping.dm b/code/controllers/subsystem/non_firing/SSlate_mapping.dm
index e3b34f58e83..a5274bd0d58 100644
--- a/code/controllers/subsystem/non_firing/SSlate_mapping.dm
+++ b/code/controllers/subsystem/non_firing/SSlate_mapping.dm
@@ -14,7 +14,7 @@ SUBSYSTEM_DEF(late_mapping)
GLOB.air_alarms = sortAtom(GLOB.air_alarms)
GLOB.apcs = sortAtom(GLOB.apcs)
- for(var/obj/machinery/computer/shuttle/console in GLOB.machines)
+ for(var/obj/machinery/computer/shuttle/console in SSmachines.get_by_type(/obj/machinery/computer/shuttle))
if(console.find_destinations_in_late_mapping)
console.connect()
diff --git a/code/datums/mind.dm b/code/datums/mind.dm
index 588b5cc26c1..ed95351ecd8 100644
--- a/code/datums/mind.dm
+++ b/code/datums/mind.dm
@@ -406,7 +406,7 @@
. += "OPERATIVE|no"
. += "
To shuttle, undress, dress up."
var/code
- for(var/obj/machinery/nuclearbomb/bombue in GLOB.machines)
+ for(var/obj/machinery/nuclearbomb/bombue in SSmachines.get_by_type(/obj/machinery/nuclearbomb))
if(length(bombue.r_code) <= 5 && bombue.r_code != "LOLNO" && bombue.r_code != "ADMIN")
code = bombue.r_code
break
@@ -1190,7 +1190,7 @@
if("tellcode")
var/code
- for(var/obj/machinery/nuclearbomb/bombue in GLOB.machines)
+ for(var/obj/machinery/nuclearbomb/bombue in SSmachines.get_by_type(/obj/machinery/nuclearbomb))
if(length(bombue.r_code) <= 5 && bombue.r_code != "LOLNO" && bombue.r_code != "ADMIN")
code = bombue.r_code
break
diff --git a/code/datums/station_traits/neutral_traits.dm b/code/datums/station_traits/neutral_traits.dm
index 03cac88b537..58d1e640bb3 100644
--- a/code/datums/station_traits/neutral_traits.dm
+++ b/code/datums/station_traits/neutral_traits.dm
@@ -91,7 +91,7 @@
/datum/station_trait/rave/on_round_start()
. = ..()
- for(var/obj/machinery/light/light in GLOB.machines)
+ for(var/obj/machinery/light/light in SSmachines.get_by_type(/obj/machinery/light))
var/turf/our_turf = get_turf(light)
var/area/our_area = get_area(light)
if(is_station_level(our_turf.z) || istype(our_area, /area/mine/outpost) || istype(our_area, /area/mine/laborcamp))
diff --git a/code/game/gamemodes/malfunction/Malf_Modules.dm b/code/game/gamemodes/malfunction/Malf_Modules.dm
index 7894bc29e55..f25bbf213ee 100644
--- a/code/game/gamemodes/malfunction/Malf_Modules.dm
+++ b/code/game/gamemodes/malfunction/Malf_Modules.dm
@@ -342,7 +342,7 @@
unlock_sound = 'sound/items/rped.ogg'
/datum/ai_module/upgrade_turrets/upgrade(mob/living/silicon/ai/AI)
- for(var/obj/machinery/porta_turret/ai_turret/turret in GLOB.machines)
+ for(var/obj/machinery/porta_turret/ai_turret/turret in SSmachines.get_by_type(/obj/machinery/porta_turret/ai_turret))
var/turf/T = get_turf(turret)
if(is_station_level(T.z))
turret.health += 30
@@ -431,7 +431,7 @@
uses = 1
/datum/spell/ai_spell/break_fire_alarms/cast(list/targets, mob/user)
- for(var/obj/machinery/firealarm/F in GLOB.machines)
+ for(var/obj/machinery/firealarm/F in SSmachines.get_by_type(/obj/machinery/firealarm))
if(!is_station_level(F.z))
continue
F.emagged = TRUE
@@ -456,7 +456,7 @@
uses = 1
/datum/spell/ai_spell/break_air_alarms/cast(list/targets, mob/user)
- for(var/obj/machinery/alarm/AA in GLOB.machines)
+ for(var/obj/machinery/alarm/AA in SSmachines.get_by_type(/obj/machinery/alarm))
if(!is_station_level(AA.z))
continue
AA.emagged = TRUE
diff --git a/code/game/gamemodes/miniantags/abduction/abduction.dm b/code/game/gamemodes/miniantags/abduction/abduction.dm
index 7052199a26c..5b80a9e4d37 100644
--- a/code/game/gamemodes/miniantags/abduction/abduction.dm
+++ b/code/game/gamemodes/miniantags/abduction/abduction.dm
@@ -46,7 +46,7 @@
return ..()
/datum/game_mode/abduction/proc/get_team_console(team_number)
- for(var/obj/machinery/abductor/console/C in GLOB.machines)
+ for(var/obj/machinery/abductor/console/C in SSmachines.get_by_type(/obj/machinery/abductor/console))
if(C.team == team_number)
return C
@@ -127,7 +127,7 @@
var/mob/living/carbon/human/H = M.current
var/datum/species/abductor/S = H.dna.species
ab_team = S.team
- for(var/obj/machinery/abductor/experiment/E in GLOB.machines)
+ for(var/obj/machinery/abductor/experiment/E in SSmachines.get_by_type(/obj/machinery/abductor/experiment))
if(E.team == ab_team)
if(E.points >= target_amount)
return TRUE
diff --git a/code/game/gamemodes/miniantags/abduction/abduction_gear.dm b/code/game/gamemodes/miniantags/abduction/abduction_gear.dm
index 87079b34383..69b2ea4c582 100644
--- a/code/game/gamemodes/miniantags/abduction/abduction_gear.dm
+++ b/code/game/gamemodes/miniantags/abduction/abduction_gear.dm
@@ -171,7 +171,7 @@ CONTENTS:
COOLDOWN_START(src, abductor_adrenaline, combat_cooldown)
/obj/item/clothing/suit/armor/abductor/Destroy()
- for(var/obj/machinery/abductor/console/C in GLOB.machines)
+ for(var/obj/machinery/abductor/console/C in SSmachines.get_by_type(/obj/machinery/abductor/console))
if(C.vest == src)
C.vest = null
break
diff --git a/code/game/gamemodes/miniantags/abduction/abduction_outfits.dm b/code/game/gamemodes/miniantags/abduction/abduction_outfits.dm
index 5b2f73c5245..e4c4a7bed44 100644
--- a/code/game/gamemodes/miniantags/abduction/abduction_outfits.dm
+++ b/code/game/gamemodes/miniantags/abduction/abduction_outfits.dm
@@ -6,7 +6,7 @@
l_ear = /obj/item/radio/headset/abductor
/datum/outfit/abductor/proc/get_team_console(team_number)
- for(var/obj/machinery/abductor/console/C in GLOB.machines)
+ for(var/obj/machinery/abductor/console/C in SSmachines.get_by_type(/obj/machinery/abductor/console))
if(C.team == team_number)
return C
diff --git a/code/game/gamemodes/miniantags/abduction/machinery/console.dm b/code/game/gamemodes/miniantags/abduction/machinery/console.dm
index aaebe354404..954c3d03f34 100644
--- a/code/game/gamemodes/miniantags/abduction/machinery/console.dm
+++ b/code/game/gamemodes/miniantags/abduction/machinery/console.dm
@@ -210,7 +210,7 @@
if(vest == V)
return FALSE
- for(var/obj/machinery/abductor/console/C in GLOB.machines)
+ for(var/obj/machinery/abductor/console/C in SSmachines.get_by_type(/obj/machinery/abductor/console))
if(C.vest == V)
C.vest = null
break
diff --git a/code/game/gamemodes/nuclear/nuclear_challenge.dm b/code/game/gamemodes/nuclear/nuclear_challenge.dm
index fab0120d75d..920bfc441f9 100644
--- a/code/game/gamemodes/nuclear/nuclear_challenge.dm
+++ b/code/game/gamemodes/nuclear/nuclear_challenge.dm
@@ -54,7 +54,7 @@
to_chat(user, "You've attracted the attention of powerful forces within the syndicate. A bonus bundle of telecrystals has been granted to your team. Great things await you if you complete the mission.")
to_chat(user, "Your bonus telecrystals have been split between your team's uplinks.")
- for(var/obj/machinery/computer/shuttle/syndicate/S in GLOB.machines)
+ for(var/obj/machinery/computer/shuttle/syndicate/S in SSmachines.get_by_type(/obj/machinery/computer/shuttle/syndicate))
S.challenge = TRUE
S.challenge_time = world.time
@@ -93,7 +93,7 @@
if((world.time - SSticker.round_start_time) > CHALLENGE_TIME_LIMIT) // Only count after the round started
to_chat(user, "It's too late to declare hostilities. Your benefactors are already busy with other schemes. You'll have to make do with what you have on hand.")
return FALSE
- for(var/obj/machinery/computer/shuttle/syndicate/S in GLOB.machines)
+ for(var/obj/machinery/computer/shuttle/syndicate/S in SSmachines.get_by_type(/obj/machinery/computer/shuttle/syndicate))
if(S.moved)
to_chat(user, "The shuttle has already been moved! You have forfeit the right to declare war.")
return FALSE
diff --git a/code/game/gamemodes/nuclear/pinpointer.dm b/code/game/gamemodes/nuclear/pinpointer.dm
index 39a02066705..fd6e062cb5b 100644
--- a/code/game/gamemodes/nuclear/pinpointer.dm
+++ b/code/game/gamemodes/nuclear/pinpointer.dm
@@ -143,7 +143,7 @@
/obj/item/pinpointer/examine(mob/user)
. = ..()
if(shows_nuke_timer)
- for(var/obj/machinery/nuclearbomb/bomb in GLOB.machines)
+ for(var/obj/machinery/nuclearbomb/bomb in SSmachines.get_by_type(/obj/machinery/nuclearbomb))
if(bomb.timing)
. += "Extreme danger. Arming signal detected. Time remaining: [bomb.timeleft]"
diff --git a/code/game/gamemodes/wizard/magic_tarot.dm b/code/game/gamemodes/wizard/magic_tarot.dm
index 73916a518f1..35bfaf4382d 100644
--- a/code/game/gamemodes/wizard/magic_tarot.dm
+++ b/code/game/gamemodes/wizard/magic_tarot.dm
@@ -460,7 +460,7 @@
/datum/tarot/the_hermit/activate(mob/living/target)
var/list/viable_vendors = list()
- for(var/obj/machinery/economy/vending/candidate in GLOB.machines)
+ for(var/obj/machinery/economy/vending/candidate in SSmachines.get_by_type(/obj/machinery/economy/vending))
if(!is_station_level(candidate.z))
continue
viable_vendors += candidate
diff --git a/code/game/gamemodes/wizard/raginmages.dm b/code/game/gamemodes/wizard/raginmages.dm
index 82217d065fd..d8cc9a371f7 100644
--- a/code/game/gamemodes/wizard/raginmages.dm
+++ b/code/game/gamemodes/wizard/raginmages.dm
@@ -146,7 +146,7 @@
/datum/game_mode/wizard/raginmages/proc/populate_magivends()
// Makes magivends PLENTIFUL
- for(var/obj/machinery/economy/vending/magivend/magic in GLOB.machines)
+ for(var/obj/machinery/economy/vending/magivend/magic in SSmachines.get_by_type(/obj/machinery/economy/vending/magivend))
for(var/key in magic.products)
magic.products[key] = 20 // and so, there was prosperity for ragin mages everywhere
magic.product_records.Cut()
diff --git a/code/game/machinery/buttons.dm b/code/game/machinery/buttons.dm
index 58318739393..2c5a8a65135 100644
--- a/code/game/machinery/buttons.dm
+++ b/code/game/machinery/buttons.dm
@@ -153,11 +153,11 @@
active = TRUE
icon_state = "launcheract"
- for(var/obj/machinery/sparker/M in GLOB.machines)
+ for(var/obj/machinery/sparker/M in SSmachines.get_by_type(/obj/machinery/sparker))
if(M.id == id)
INVOKE_ASYNC(M, TYPE_PROC_REF(/obj/machinery/sparker, spark))
- for(var/obj/machinery/igniter/M in GLOB.machines)
+ for(var/obj/machinery/igniter/M in SSmachines.get_by_type(/obj/machinery/igniter))
if(M.id == id)
use_power(50)
M.on = !M.on
diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm
index 44a917c543d..b00a92e8d64 100644
--- a/code/game/machinery/cryopod.dm
+++ b/code/game/machinery/cryopod.dm
@@ -679,7 +679,7 @@
var/obj/O = person_to_cryo.loc
O.force_eject_occupant(person_to_cryo)
var/list/free_cryopods = list()
- for(var/obj/machinery/cryopod/P in GLOB.machines)
+ for(var/obj/machinery/cryopod/P in SSmachines.get_by_type(/obj/machinery/cryopod))
if(P.occupant)
continue
if((ishuman(person_to_cryo) && istype(get_area(P), /area/station/public/sleep)) || istype(P, /obj/machinery/cryopod/robot))
diff --git a/code/game/machinery/doors/brigdoors.dm b/code/game/machinery/doors/brigdoors.dm
index 9a815f019b3..061bc9725f8 100644
--- a/code/game/machinery/doors/brigdoors.dm
+++ b/code/game/machinery/doors/brigdoors.dm
@@ -130,7 +130,7 @@
targets += M
RegisterSignal(M, COMSIG_PARENT_QDELETING, PROC_REF(on_target_qdel))
- for(var/obj/machinery/flasher/F in GLOB.machines)
+ for(var/obj/machinery/flasher/F in SSmachines.get_by_type(/obj/machinery/flasher))
if(F.id == id)
targets += F
RegisterSignal(F, COMSIG_PARENT_QDELETING, PROC_REF(on_target_qdel))
@@ -140,7 +140,7 @@
targets += C
RegisterSignal(C, COMSIG_PARENT_QDELETING, PROC_REF(on_target_qdel))
- for(var/obj/machinery/treadmill_monitor/T in GLOB.machines)
+ for(var/obj/machinery/treadmill_monitor/T in SSmachines.get_by_type(/obj/machinery/treadmill_monitor))
if(T.id == id)
targets += T
RegisterSignal(T, COMSIG_PARENT_QDELETING, PROC_REF(on_target_qdel))
diff --git a/code/game/machinery/flasher.dm b/code/game/machinery/flasher.dm
index fbb7298600c..445d3731b57 100644
--- a/code/game/machinery/flasher.dm
+++ b/code/game/machinery/flasher.dm
@@ -162,7 +162,7 @@
active = TRUE
icon_state = "launcheract"
- for(var/obj/machinery/flasher/M in GLOB.machines)
+ for(var/obj/machinery/flasher/M in SSmachines.get_by_type(/obj/machinery/flasher))
if(M.id == id)
spawn()
M.flash()
diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm
index bb71aacf8eb..21f173041ff 100644
--- a/code/game/machinery/machinery.dm
+++ b/code/game/machinery/machinery.dm
@@ -38,7 +38,7 @@
/obj/machinery/Initialize(mapload)
. = ..()
- GLOB.machines += src
+ SSmachines.register_machine(src)
var/area/machine_area = get_area(src)
if(machine_area)
@@ -81,7 +81,7 @@
/obj/machinery/Destroy()
change_power_mode(NO_POWER_USE) //we want to clear our static power usage on the local powernet
machine_powernet?.unregister_machine(src)
- GLOB.machines.Remove(src)
+ SSmachines.unregister_machine(src)
if(!speed_process)
STOP_PROCESSING(SSmachines, src)
else
diff --git a/code/game/machinery/magnetic_module.dm b/code/game/machinery/magnetic_module.dm
index 7e0e012b648..f1d598a43ec 100644
--- a/code/game/machinery/magnetic_module.dm
+++ b/code/game/machinery/magnetic_module.dm
@@ -213,7 +213,7 @@
/obj/machinery/magnetic_controller/LateInitialize()
if(autolink)
- // GLOB.machines is populated in /machinery/Initialize
+ // SSmachines is populated in /machinery/Initialize
// so linkage gets delayed until that one finished.
link_magnets()
@@ -227,7 +227,7 @@
/obj/machinery/magnetic_controller/proc/link_magnets()
magnets = list()
- for(var/obj/machinery/magnetic_module/M in GLOB.machines)
+ for(var/obj/machinery/magnetic_module/M in SSmachines.get_by_type(/obj/machinery/magnetic_module))
if(M.freq == frequency && M.code == code)
magnets.Add(M)
RegisterSignal(M, COMSIG_PARENT_QDELETING, PROC_REF(on_magnet_del), TRUE)
diff --git a/code/game/machinery/syndicatebomb.dm b/code/game/machinery/syndicatebomb.dm
index 2e5e9e9f265..4bba8b00f76 100644
--- a/code/game/machinery/syndicatebomb.dm
+++ b/code/game/machinery/syndicatebomb.dm
@@ -663,7 +663,7 @@
to_chat(user, "Nothing happens.")
return
- for(var/obj/machinery/syndicatebomb/B in GLOB.machines)
+ for(var/obj/machinery/syndicatebomb/B in SSmachines.get_by_type(/obj/machinery/syndicatebomb))
if(B.active)
B.detonation_timer = world.time + BUTTON_DELAY
detonated++
diff --git a/code/game/machinery/wall_holosign.dm b/code/game/machinery/wall_holosign.dm
index 3e89ef7c651..76532c8ac18 100644
--- a/code/game/machinery/wall_holosign.dm
+++ b/code/game/machinery/wall_holosign.dm
@@ -68,7 +68,7 @@
else
icon_state = "light0"
- for(var/obj/machinery/holosign/M in GLOB.machines)
+ for(var/obj/machinery/holosign/M in SSmachines.get_by_type(/obj/machinery/holosign))
if(M.id == src.id)
spawn( 0 )
M.toggle()
diff --git a/code/game/objects/items/weapons/teleportation.dm b/code/game/objects/items/weapons/teleportation.dm
index cdc92438172..1e1ec62192b 100644
--- a/code/game/objects/items/weapons/teleportation.dm
+++ b/code/game/objects/items/weapons/teleportation.dm
@@ -53,7 +53,7 @@
to_chat(user, "\The [src] is malfunctioning.")
return
var/list/L = list()
- for(var/obj/machinery/computer/teleporter/com in GLOB.machines)
+ for(var/obj/machinery/computer/teleporter/com in SSmachines.get_by_type(/obj/machinery/computer/teleporter))
if(com.target)
if(com.power_station && com.power_station.teleporter_hub && com.power_station.engaged)
L["[com.id] (Active)"] = com.target
diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm
index 4f28cbb3e4a..f1809f1281b 100644
--- a/code/modules/admin/topic.dm
+++ b/code/modules/admin/topic.dm
@@ -3118,12 +3118,12 @@
if("blackout")
SSblackbox.record_feedback("tally", "admin_secrets_fun_used", 1, "Black Out")
message_admins("[key_name_admin(usr)] broke all lights", 1)
- for(var/obj/machinery/light/L in GLOB.machines)
+ for(var/obj/machinery/light/L in SSmachines.get_by_type(/obj/machinery/light))
L.break_light_tube()
if("whiteout")
SSblackbox.record_feedback("tally", "admin_secrets_fun_used", 1, "Fix All Lights")
message_admins("[key_name_admin(usr)] fixed all lights", 1)
- for(var/obj/machinery/light/L in GLOB.machines)
+ for(var/obj/machinery/light/L in SSmachines.get_by_type(/obj/machinery/light))
L.fix()
L.switchcount = 0
if("floorlava")
diff --git a/code/modules/admin/verbs/bloom_edit.dm b/code/modules/admin/verbs/bloom_edit.dm
index 864c7f17911..f8f2b7ee826 100644
--- a/code/modules/admin/verbs/bloom_edit.dm
+++ b/code/modules/admin/verbs/bloom_edit.dm
@@ -62,7 +62,7 @@
GLOB.configuration.lighting_effects.exposure_contrast_base = initial(GLOB.configuration.lighting_effects.exposure_contrast_base)
GLOB.configuration.lighting_effects.exposure_contrast_power = initial(GLOB.configuration.lighting_effects.exposure_contrast_power)
if("update_lamps")
- for(var/obj/machinery/light/L in GLOB.machines)
+ for(var/obj/machinery/light/L in SSmachines.get_by_type(/obj/machinery/light))
if(L.glow_overlay || L.exposure_overlay)
L.update_bloom()
return TRUE
diff --git a/code/modules/admin/verbs/deathsquad.dm b/code/modules/admin/verbs/deathsquad.dm
index dd526796c25..e984f4b1ce0 100644
--- a/code/modules/admin/verbs/deathsquad.dm
+++ b/code/modules/admin/verbs/deathsquad.dm
@@ -77,7 +77,7 @@ GLOBAL_VAR_INIT(deathsquad_sent, FALSE)
// Find the nuclear auth code
var/nuke_code
var/new_nuke = FALSE
- for(var/obj/machinery/nuclearbomb/N in GLOB.machines)
+ for(var/obj/machinery/nuclearbomb/N in SSmachines.get_by_type(/obj/machinery/nuclearbomb))
if(istype(N, /obj/machinery/nuclearbomb/syndicate) || !N.core)
continue
var/temp_code = text2num(N.r_code)
diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm
index 1e1a973c5b5..b41c4535933 100644
--- a/code/modules/admin/verbs/debug.dm
+++ b/code/modules/admin/verbs/debug.dm
@@ -511,31 +511,31 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
else
areas_with_multiple_air_alarms |= A.type
- for(var/obj/machinery/requests_console/RC in GLOB.machines)
+ for(var/obj/machinery/requests_console/RC in SSmachines.get_by_type(/obj/machinery/requests_console))
var/area/A = get_area(RC)
if(!A)
continue
areas_with_RC |= A.type
- for(var/obj/machinery/light/L in GLOB.machines)
+ for(var/obj/machinery/light/L in SSmachines.get_by_type(/obj/machinery/light))
var/area/A = get_area(L)
if(!A)
continue
areas_with_light |= A.type
- for(var/obj/machinery/light_switch/LS in GLOB.machines)
+ for(var/obj/machinery/light_switch/LS in SSmachines.get_by_type(/obj/machinery/light_switch))
var/area/A = get_area(LS)
if(!A)
continue
areas_with_LS |= A.type
- for(var/obj/item/radio/intercom/I in GLOB.global_radios)
+ for(var/obj/item/radio/intercom/I in SSmachines.get_by_type(/obj/item/radio/intercom))
var/area/A = get_area(I)
if(!A)
continue
areas_with_intercom |= A.type
- for(var/obj/machinery/camera/C in GLOB.machines)
+ for(var/obj/machinery/camera/C in SSmachines.get_by_type(/obj/machinery/camera))
var/area/A = get_area(C)
if(!A)
continue
@@ -679,11 +679,11 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
if(alert("Are you sure? This will start up the engine. Should only be used during debug!", null,"Yes","No") != "Yes")
return
- for(var/obj/machinery/power/emitter/E in GLOB.machines)
+ for(var/obj/machinery/power/emitter/E in SSmachines.get_by_type(/obj/machinery/power/emitter))
if(E.anchored)
E.active = TRUE
- for(var/obj/machinery/field/generator/F in GLOB.machines)
+ for(var/obj/machinery/field/generator/F in SSmachines.get_by_type(/obj/machinery/field/generator))
if(!F.active)
F.active = TRUE
F.state = 2
@@ -694,13 +694,13 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
F.update_icon()
spawn(30)
- for(var/obj/machinery/the_singularitygen/G in GLOB.machines)
+ for(var/obj/machinery/the_singularitygen/G in SSmachines.get_by_type(/obj/machinery/the_singularitygen))
if(G.anchored)
var/obj/singularity/S = new /obj/singularity(get_turf(G))
S.energy = 800
break
- for(var/obj/machinery/power/rad_collector/Rad in GLOB.machines)
+ for(var/obj/machinery/power/rad_collector/Rad in SSmachines.get_by_type(/obj/machinery/power/rad_collector))
if(Rad.anchored)
if(!Rad.loaded_tank)
var/obj/item/tank/internals/plasma/Plasma = new/obj/item/tank/internals/plasma(Rad)
@@ -712,7 +712,7 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
if(!Rad.active)
Rad.toggle_power()
- for(var/obj/machinery/power/smes/SMES in GLOB.machines)
+ for(var/obj/machinery/power/smes/SMES in SSmachines.get_by_type(/obj/machinery/power/smes))
if(SMES.anchored)
SMES.input_attempt = 1
diff --git a/code/modules/admin/verbs/massmodvar.dm b/code/modules/admin/verbs/massmodvar.dm
index 729cc1fb071..57a496be06d 100644
--- a/code/modules/admin/verbs/massmodvar.dm
+++ b/code/modules/admin/verbs/massmodvar.dm
@@ -228,7 +228,7 @@
CHECK_TICK
else if(ispath(T, /obj/machinery))
- for(var/obj/machinery/thing in GLOB.machines)
+ for(var/obj/machinery/thing in SSmachines.get_by_type(/obj/machinery))
if(typecache[thing.type])
. += thing
CHECK_TICK
diff --git a/code/modules/admin/verbs/striketeam_syndicate.dm b/code/modules/admin/verbs/striketeam_syndicate.dm
index 7b63458729f..4131c3c071e 100644
--- a/code/modules/admin/verbs/striketeam_syndicate.dm
+++ b/code/modules/admin/verbs/striketeam_syndicate.dm
@@ -38,7 +38,7 @@ GLOBAL_VAR_INIT(sent_syndicate_strike_team, 0)
// Find the nuclear auth code
var/nuke_code
var/temp_code
- for(var/obj/machinery/nuclearbomb/N in GLOB.machines)
+ for(var/obj/machinery/nuclearbomb/N in SSmachines.get_by_type(/obj/machinery/nuclearbomb))
temp_code = text2num(N.r_code)
if(temp_code)//if it's actually a number. It won't convert any non-numericals.
nuke_code = N.r_code
diff --git a/code/modules/events/apc_short.dm b/code/modules/events/apc_short.dm
index df54a35c756..c241774d4e8 100644
--- a/code/modules/events/apc_short.dm
+++ b/code/modules/events/apc_short.dm
@@ -107,7 +107,7 @@
if(announce)
GLOB.minor_announcement.Announce("All SMESs on \the [station_name()] have been recharged. We apologize for the inconvenience.", "Power Systems Nominal", 'sound/AI/power_restore.ogg')
// fix all of the SMESs
- for(var/obj/machinery/power/smes/S in GLOB.machines)
+ for(var/obj/machinery/power/smes/S in SSmachines.get_by_type(/obj/machinery/power/smes))
if(!is_station_level(S.z))
continue
S.charge = S.capacity
diff --git a/code/modules/events/brand_intelligence.dm b/code/modules/events/brand_intelligence.dm
index d7af1044ebc..8b1989f7ad8 100644
--- a/code/modules/events/brand_intelligence.dm
+++ b/code/modules/events/brand_intelligence.dm
@@ -28,7 +28,7 @@
/datum/event/brand_intelligence/start()
var/list/obj/machinery/economy/vending/leaderables = list()
- for(var/obj/machinery/economy/vending/candidate in GLOB.machines)
+ for(var/obj/machinery/economy/vending/candidate in SSmachines.get_by_type(/obj/machinery/economy/vending))
if(!is_station_level(candidate.z))
continue
RegisterSignal(candidate, COMSIG_PARENT_QDELETING, PROC_REF(vendor_destroyed))
diff --git a/code/modules/events/prison_break.dm b/code/modules/events/prison_break.dm
index 4899a039ea2..9c623ff8c34 100644
--- a/code/modules/events/prison_break.dm
+++ b/code/modules/events/prison_break.dm
@@ -45,7 +45,7 @@
if(areas && length(areas) > 0)
var/my_department = "[station_name()] firewall subroutines"
var/rc_message = "An unknown malicious program has been detected in the [english_list(areaName)] lighting and airlock control systems at [station_time_timestamp()]. Systems will be fully compromised within approximately one minute. Direct intervention is required immediately.
"
- for(var/obj/machinery/message_server/MS in GLOB.machines)
+ for(var/obj/machinery/message_server/MS in SSmachines.get_by_type(/obj/machinery/message_server))
MS.send_rc_message("Engineering", my_department, rc_message, "", "", RQ_HIGHPRIORITY)
else
stack_trace("Could not initiate grey-tide. Unable to find suitable containment area.")
diff --git a/code/modules/events/vent_clog.dm b/code/modules/events/vent_clog.dm
index f00a3415d2f..dba624a68bf 100644
--- a/code/modules/events/vent_clog.dm
+++ b/code/modules/events/vent_clog.dm
@@ -10,7 +10,7 @@
/datum/event/vent_clog/setup()
endWhen = rand(25, 100)
- for(var/obj/machinery/atmospherics/unary/vent_scrubber/temp_vent in GLOB.machines)
+ for(var/obj/machinery/atmospherics/unary/vent_scrubber/temp_vent in SSmachines.get_by_type(/obj/machinery/atmospherics/unary/vent_scrubber))
if(is_station_level(temp_vent.loc.z))
if(length(temp_vent.parent.other_atmosmch) > 50)
vents += temp_vent
diff --git a/code/modules/food_and_drinks/kitchen_machinery/monkeyrecycler.dm b/code/modules/food_and_drinks/kitchen_machinery/monkeyrecycler.dm
index 6c8c512f58b..5251e8e941b 100644
--- a/code/modules/food_and_drinks/kitchen_machinery/monkeyrecycler.dm
+++ b/code/modules/food_and_drinks/kitchen_machinery/monkeyrecycler.dm
@@ -38,7 +38,7 @@ GLOBAL_LIST_EMPTY(monkey_recyclers)
/obj/machinery/monkey_recycler/proc/locate_camera_console()
if(length(connected))
return // we're already connected!
- for(var/obj/machinery/computer/camera_advanced/xenobio/xeno_camera in GLOB.machines)
+ for(var/obj/machinery/computer/camera_advanced/xenobio/xeno_camera in SSmachines.get_by_type(/obj/machinery/computer/camera_advanced/xenobio))
if(get_area(xeno_camera) == get_area(loc))
xeno_camera.connected_recycler = src
connected |= xeno_camera
diff --git a/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm b/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm
index 719d9cc091a..121792f2e48 100644
--- a/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm
+++ b/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm
@@ -155,7 +155,7 @@
if(tgui_alert(usr, "Are you sure you want to respawn as a drone?", "Are you sure?", list("Yes", "No")) != "Yes")
return
- for(var/obj/machinery/drone_fabricator/DF in GLOB.machines)
+ for(var/obj/machinery/drone_fabricator/DF in SSmachines.get_by_type(/obj/machinery/drone_fabricator))
if(DF.stat & NOPOWER || !DF.produce_drones)
continue
diff --git a/code/modules/mob/living/silicon/robot/drone/maint_drone.dm b/code/modules/mob/living/silicon/robot/drone/maint_drone.dm
index cf71c9bf3f6..4468839dce8 100644
--- a/code/modules/mob/living/silicon/robot/drone/maint_drone.dm
+++ b/code/modules/mob/living/silicon/robot/drone/maint_drone.dm
@@ -426,7 +426,7 @@
return FALSE // Pretty damn hard to path through space
var/turf/target
- for(var/obj/machinery/drone_fabricator/DF in GLOB.machines)
+ for(var/obj/machinery/drone_fabricator/DF in SSmachines.get_by_type(/obj/machinery/drone_fabricator))
if(DF.z != z)
continue
target = get_turf(DF)
diff --git a/code/modules/paperwork/photography.dm b/code/modules/paperwork/photography.dm
index 33efb5cd384..038fcd899ea 100644
--- a/code/modules/paperwork/photography.dm
+++ b/code/modules/paperwork/photography.dm
@@ -660,13 +660,13 @@ GLOBAL_LIST_INIT(SpookyGhosts, list("ghost","shade","shade2","ghost-narsie","hor
if(camera && on)
if(get_dist(src, M) <= canhear_range)
talk_into(M, msg)
- for(var/obj/machinery/computer/security/telescreen/entertainment/T in GLOB.machines)
+ for(var/obj/machinery/computer/security/telescreen/entertainment/T in GLOB.telescreens)
if(usr && (usr.unique_datum_id in T.watchers))
T.atom_say("[M.name]: [msg]") // Uses appearance for identifying speaker, not voice
/obj/item/videocam/hear_message(mob/M as mob, msg)
if(camera && on)
- for(var/obj/machinery/computer/security/telescreen/entertainment/T in GLOB.machines)
+ for(var/obj/machinery/computer/security/telescreen/entertainment/T in GLOB.telescreens)
if(usr && (usr.unique_datum_id in T.watchers))
T.atom_say("*[M.name] [msg]") // Uses appearance for identifying speaker, not voice
diff --git a/code/modules/paperwork/ticketmachine.dm b/code/modules/paperwork/ticketmachine.dm
index 7c96f931fae..978304aef15 100644
--- a/code/modules/paperwork/ticketmachine.dm
+++ b/code/modules/paperwork/ticketmachine.dm
@@ -79,7 +79,7 @@
if(allowed(usr) || user.can_advanced_admin_interact())
icon_state = "doorctrl1"
addtimer(CALLBACK(src, TYPE_PROC_REF(/atom, update_icon)), 15)
- for(var/obj/machinery/ticket_machine/M in GLOB.machines)
+ for(var/obj/machinery/ticket_machine/M in SSmachines.get_by_type(/obj/machinery/ticket_machine))
if(M.id == id)
if(cooldown)
return
diff --git a/code/modules/power/engines/singularity/singularity.dm b/code/modules/power/engines/singularity/singularity.dm
index b62f39a0235..b001e4df127 100644
--- a/code/modules/power/engines/singularity/singularity.dm
+++ b/code/modules/power/engines/singularity/singularity.dm
@@ -56,7 +56,7 @@ GLOBAL_VAR_INIT(global_singulo_id, 1)
START_PROCESSING(SSobj, src)
GLOB.poi_list |= src
GLOB.singularities += src
- for(var/obj/machinery/power/singularity_beacon/singubeacon in GLOB.machines)
+ for(var/obj/machinery/power/singularity_beacon/singubeacon in SSmachines.get_by_type(/obj/machinery/power/singularity_beacon))
if(singubeacon.active)
beacon_target = singubeacon
break
diff --git a/code/modules/power/generators/treadmill.dm b/code/modules/power/generators/treadmill.dm
index 1fe399551f0..b94b0fd0920 100644
--- a/code/modules/power/generators/treadmill.dm
+++ b/code/modules/power/generators/treadmill.dm
@@ -151,7 +151,7 @@
/obj/machinery/treadmill_monitor/Initialize(mapload)
. = ..()
if(id)
- for(var/obj/machinery/power/treadmill/T in GLOB.machines)
+ for(var/obj/machinery/power/treadmill/T in SSmachines.get_by_type(/obj/machinery/power/treadmill))
if(T.id == id)
treadmill = T
break
diff --git a/code/modules/security_levels/keycard_authentication.dm b/code/modules/security_levels/keycard_authentication.dm
index 01c9a58f30c..e2ca41871b4 100644
--- a/code/modules/security_levels/keycard_authentication.dm
+++ b/code/modules/security_levels/keycard_authentication.dm
@@ -144,7 +144,7 @@
/obj/machinery/keycard_auth/proc/broadcast_request()
update_icon()
set_light(1, LIGHTING_MINIMUM_POWER)
- for(var/obj/machinery/keycard_auth/KA in GLOB.machines)
+ for(var/obj/machinery/keycard_auth/KA in SSmachines.get_by_type(/obj/machinery/keycard_auth))
if(KA == src)
continue
KA.receive_request(src)
diff --git a/code/modules/shuttle/assault_pod.dm b/code/modules/shuttle/assault_pod.dm
index 8f22628c081..b3e1d6365e5 100644
--- a/code/modules/shuttle/assault_pod.dm
+++ b/code/modules/shuttle/assault_pod.dm
@@ -55,7 +55,7 @@
landing_zone.dir = lz_dir
landing_zone.register() //new docking ports must be registered
- for(var/obj/machinery/computer/shuttle/S in GLOB.machines)
+ for(var/obj/machinery/computer/shuttle/S in SSmachines.get_by_type(/obj/machinery/computer/shuttle))
if(S.shuttleId == shuttle_id)
S.possible_destinations = "[landing_zone.id]"
diff --git a/code/modules/shuttle/dock_generator.dm b/code/modules/shuttle/dock_generator.dm
index 132e66a13d3..c020b71e8af 100644
--- a/code/modules/shuttle/dock_generator.dm
+++ b/code/modules/shuttle/dock_generator.dm
@@ -110,7 +110,7 @@
port.id = "whiteship_custom_[dock_count]"
port.register()
- for(var/obj/machinery/computer/shuttle/white_ship/S in GLOB.machines)
+ for(var/obj/machinery/computer/shuttle/white_ship/S in SSmachines.get_by_type(/obj/machinery/computer/shuttle/white_ship))
S.possible_destinations = null
S.connect()
possible_destinations = S.possible_destinations
@@ -119,7 +119,7 @@
to_chat(user, "Landing zone set.")
/obj/item/whiteship_port_generator/AltClick(mob/user, modifiers)
- for(var/obj/machinery/computer/shuttle/white_ship/S in GLOB.machines)
+ for(var/obj/machinery/computer/shuttle/white_ship/S in SSmachines.get_by_type(/obj/machinery/computer/shuttle/white_ship))
possible_destinations = S.possible_destinations
break
diff --git a/code/modules/station_goals/bluespace_tap.dm b/code/modules/station_goals/bluespace_tap.dm
index 08569b9663d..6cddb3d8200 100644
--- a/code/modules/station_goals/bluespace_tap.dm
+++ b/code/modules/station_goals/bluespace_tap.dm
@@ -23,7 +23,7 @@
if(..())
return TRUE
var/highscore = 0
- for(var/obj/machinery/power/bluespace_tap/T in GLOB.machines)
+ for(var/obj/machinery/power/bluespace_tap/T in SSmachines.get_by_type(/obj/machinery/power/bluespace_tap))
highscore = max(highscore, T.total_points)
to_chat(world, "Bluespace Harvester Highscore: [highscore >= goal ? "": ""][highscore]")
if(highscore >= goal)
diff --git a/code/modules/station_goals/bsa.dm b/code/modules/station_goals/bsa.dm
index 67f69aab290..a0a298760f5 100644
--- a/code/modules/station_goals/bsa.dm
+++ b/code/modules/station_goals/bsa.dm
@@ -22,7 +22,7 @@
/datum/station_goal/bluespace_cannon/check_completion()
if(..())
return TRUE
- for(var/obj/machinery/bsa/full/B in GLOB.machines)
+ for(var/obj/machinery/bsa/full/B in SSmachines.get_by_type(/obj/machinery/bsa/full))
if(B && !B.stat && is_station_contact(B.z))
return TRUE
return FALSE
diff --git a/code/modules/station_goals/dna_vault.dm b/code/modules/station_goals/dna_vault.dm
index 0f2627476be..cf3222a0886 100644
--- a/code/modules/station_goals/dna_vault.dm
+++ b/code/modules/station_goals/dna_vault.dm
@@ -52,7 +52,7 @@
/datum/station_goal/dna_vault/check_completion()
if(..())
return TRUE
- for(var/obj/machinery/dna_vault/V in GLOB.machines)
+ for(var/obj/machinery/dna_vault/V in SSmachines.get_by_type(/obj/machinery/dna_vault))
if(length(V.animals) >= animal_count && length(V.plants) >= plant_count && length(V.dna) >= human_count && is_station_contact(V.z))
return TRUE
return FALSE
diff --git a/code/modules/station_goals/shield.dm b/code/modules/station_goals/shield.dm
index b4cf11f17c3..ab9f4ffd65f 100644
--- a/code/modules/station_goals/shield.dm
+++ b/code/modules/station_goals/shield.dm
@@ -109,7 +109,7 @@
var/list/data = list()
data["satellites"] = list()
- for(var/obj/machinery/satellite/S in GLOB.machines)
+ for(var/obj/machinery/satellite/S in SSmachines.get_by_type(/obj/machinery/satellite))
var/turf/T = get_turf(S)
data["satellites"] += list(list(
"id" = S.id,
@@ -173,7 +173,7 @@
offset_y = new_offset_y
/obj/machinery/computer/sat_control/proc/toggle(id)
- for(var/obj/machinery/satellite/S in GLOB.machines)
+ for(var/obj/machinery/satellite/S in SSmachines.get_by_type(/obj/machinery/satellite))
if(S.id == id && atoms_share_level(src, S))
if(!S.toggle())
notice = "You can only activate satellites which are in space"
@@ -191,7 +191,7 @@
notice = "Throwing simulated meteors ([G.thrown]/100)..."
notice_color = "white"
return
-
+
var/total_meteors = length(G.defended) + length(G.collisions)
if(total_meteors == 0)
notice = "No simulation yet."
diff --git a/code/modules/telesci/rcs.dm b/code/modules/telesci/rcs.dm
index fc3dc3b2c57..58d77767f9e 100644
--- a/code/modules/telesci/rcs.dm
+++ b/code/modules/telesci/rcs.dm
@@ -58,7 +58,7 @@
var/list/L = list() // List of avaliable telepads
var/list/areaindex = list() // Telepad area location
- for(var/obj/machinery/telepad_cargo/R in GLOB.machines)
+ for(var/obj/machinery/telepad_cargo/R in SSmachines.get_by_type(/obj/machinery/telepad_cargo))
if(R.stage)
continue
var/turf/T = get_turf(R)