From 0a03e8a2a757d0cbda70190f74f8b700365e96b4 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sun, 16 Jul 2023 04:51:23 +0200 Subject: [PATCH] [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 --- code/__HELPERS/game.dm | 2 +- code/_globalvars/lists/objects.dm | 52 ++++++++--------- code/controllers/subsystem/economy.dm | 2 +- code/controllers/subsystem/machines.dm | 57 ++++++++++++++++++- code/controllers/subsystem/nightshift.dm | 2 +- code/controllers/subsystem/shuttle.dm | 6 +- .../run_away_from_target.dm | 3 +- code/datums/station_traits/negative_traits.dm | 2 +- .../dynamic/dynamic_rulesets_midround.dm | 3 +- .../dynamic/dynamic_rulesets_roundstart.dm | 21 +++---- code/game/gamemodes/events.dm | 50 ++++++++-------- code/game/machinery/_machinery.dm | 4 +- code/game/machinery/camera/motion.dm | 4 +- code/game/machinery/civilian_bounties.dm | 2 +- code/game/machinery/computer/apc_control.dm | 33 ++++++----- code/game/machinery/computer/arena.dm | 6 +- code/game/machinery/computer/mechlaunchpad.dm | 2 +- code/game/machinery/computer/telescreen.dm | 2 +- code/game/machinery/doors/airlock.dm | 4 +- code/game/machinery/doors/door.dm | 2 - .../embedded_controller/access_controller.dm | 8 +-- code/game/machinery/mass_driver.dm | 2 +- code/game/machinery/mechlaunchpad.dm | 5 -- .../machinery/satellite/satellite_control.dm | 4 +- code/game/machinery/status_display.dm | 8 --- code/game/machinery/syndicatebomb.dm | 2 +- .../effects/anomalies/anomalies_gravity.dm | 2 +- .../items/implants/implant_abductor.dm | 2 +- code/game/objects/items/mail.dm | 2 +- code/game/objects/items/teleportation.dm | 2 +- .../construction_console_aux.dm | 2 +- code/modules/admin/admin_fax_panel.dm | 2 +- code/modules/admin/topic.dm | 2 +- code/modules/admin/verbs/adminevents.dm | 2 +- code/modules/admin/verbs/atmosdebug.dm | 6 +- code/modules/admin/verbs/debug.dm | 6 +- code/modules/admin/verbs/ert.dm | 2 +- code/modules/admin/verbs/secrets.dm | 10 ++-- code/modules/antagonists/abductor/abductor.dm | 2 +- .../equipment/gear/abductor_clothing.dm | 2 +- .../antagonists/abductor/machinery/console.dm | 10 ++-- .../antagonists/malf_ai/malf_ai_modules.dm | 14 ++--- .../equipment/nuclear_bomb/_nuclear_bomb.dm | 2 - .../nukeop/equipment/pinpointer.dm | 11 ++-- code/modules/antagonists/nukeop/nukeop.dm | 8 +-- code/modules/antagonists/pirate/pirate.dm | 2 +- .../pirate/pirate_shuttle_equipment.dm | 2 +- .../final_objective/battlecruiser.dm | 2 +- .../grand_ritual/grand_ritual_finale.dm | 2 +- code/modules/assembly/doorcontrol.dm | 16 +++--- code/modules/events/brand_intelligence.dm | 2 +- code/modules/events/electrical_storm.dm | 7 +-- .../events/ghost_role/alien_infestation.dm | 2 +- .../events/gravity_generator_blackout.dm | 4 +- code/modules/events/scrubber_overflow.dm | 4 +- code/modules/events/vent_clog.dm | 4 +- code/modules/holiday/holidays.dm | 2 +- .../industrial_lift/tram/tram_lift_master.dm | 2 +- code/modules/mafia/controller.dm | 2 +- .../ruins/spaceruin_code/TheDerelict.dm | 2 +- code/modules/mining/aux_base.dm | 4 +- code/modules/mob/living/silicon/ai/ai.dm | 6 +- .../computers/item/computer.dm | 1 - .../computers/machinery/console_presets.dm | 2 +- .../file_system/programs/alarm.dm | 8 --- .../file_system/programs/bounty_board.dm | 4 -- .../file_system/programs/radar.dm | 4 +- .../file_system/programs/sm_monitor.dm | 2 +- code/modules/paperwork/fax.dm | 6 +- code/modules/paperwork/ticketmachine.dm | 2 +- code/modules/power/apc/apc_main.dm | 4 -- code/modules/power/singularity/singularity.dm | 2 +- .../delamination_effects.dm | 4 +- .../modules/power/turbine/turbine_computer.dm | 2 +- .../projectile/energy/net_snare.dm | 2 +- code/modules/requests/request_manager.dm | 2 +- code/modules/shuttle/assault_pod.dm | 2 +- .../modules/shuttle/battlecruiser_starfury.dm | 2 +- code/modules/shuttle/navigation_computer.dm | 3 - code/modules/shuttle/shuttle.dm | 2 +- code/modules/station_goals/dna_vault.dm | 3 +- code/modules/station_goals/meteor_shield.dm | 6 +- .../ammo_workbench/code/ammo_workbench.dm | 1 - modular_skyrat/modules/apc_arcing/apc.dm | 2 +- .../autotransfer/code/transfer_vote.dm | 2 +- .../code/structures/technologists_lectern.dm | 4 +- .../code/cortical_borer_antag.dm | 4 +- .../ices_events/code/events/ev_scrubbers.dm | 2 +- 88 files changed, 266 insertions(+), 254 deletions(-) diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index bd12a99efe5..2ccd05f4c24 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -419,7 +419,7 @@ ///Disable power in the station APCs /proc/power_fail(duration_min, duration_max) - for(var/obj/machinery/power/apc/current_apc as anything in GLOB.apcs_list) + for(var/obj/machinery/power/apc/current_apc as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/power/apc)) if(!current_apc.cell || !SSmapping.level_trait(current_apc.z, ZTRAIT_STATION)) continue var/area/apc_area = current_apc.area diff --git a/code/_globalvars/lists/objects.dm b/code/_globalvars/lists/objects.dm index fb6be9e1b9c..2fd384e69a9 100644 --- a/code/_globalvars/lists/objects.dm +++ b/code/_globalvars/lists/objects.dm @@ -1,36 +1,35 @@ -/// Index for all cables, so that powernets don't have to look through the entire world all the time +/// List of all cables, so that powernets don't have to look through the entire world all the time GLOBAL_LIST_EMPTY(cable_list) -/// list of all /obj/effect/portal + +/// List of all portals GLOBAL_LIST_EMPTY(portals) -/// list of all airlocks -GLOBAL_LIST_EMPTY(airlocks) -/// list of all curtains + +/// List of all curtains for button tracking GLOBAL_LIST_EMPTY(curtains) -/// list of all mechs. Used by hostile mobs target tracking. + +/// List of all mechs for hostile mob target tracking GLOBAL_LIST_EMPTY(mechas_list) -/// list of all communication consoles and AIs, for automatic shuttle calls when there are none. + +/// List of all atoms that can call the shuttle, for automatic shuttle calls when there are none. GLOBAL_LIST_EMPTY(shuttle_caller_list) -/// list of ALL machines -GLOBAL_LIST_EMPTY(machines) -/// list of all /obj/machinery/computer/camera_advanced/shuttle_docker -GLOBAL_LIST_EMPTY(navigation_computers) -/// important to keep track of for managing nukeops war declarations. + +/// List of all nukie shuttle boards, for forcing launch delay if they declare war GLOBAL_LIST_EMPTY(syndicate_shuttle_boards) -/// list of all bot nagivation beacons, used for patrolling. + +/// List of all nav beacons indexed by stringified z level GLOBAL_LIST_EMPTY(navbeacons) -/// list of all tracking beacons used by teleporters + +/// List of all active teleport beacons GLOBAL_LIST_EMPTY(teleportbeacons) -/// list of all MULEbot delivery beacons. + +/// List of all active delivery beacons GLOBAL_LIST_EMPTY(deliverybeacons) -/// list of all tags associated with delivery beacons. + +/// List of all active delivery beacon locations GLOBAL_LIST_EMPTY(deliverybeacontags) -GLOBAL_LIST_EMPTY(nuke_list) -/// list of all machines or programs that can display station alerts -GLOBAL_LIST_EMPTY(alarmdisplay) -/// list of all singularities on the station + +/// List of all singularity components that exist GLOBAL_LIST_EMPTY_TYPED(singularities, /datum/component/singularity) -/// list of all /obj/machinery/mechpad -GLOBAL_LIST_EMPTY(mechpad_list) /// list of all /datum/chemical_reaction datums indexed by their typepath. Use this for general lookup stuff GLOBAL_LIST(chemical_reactions_list) @@ -64,8 +63,6 @@ GLOBAL_LIST_EMPTY(cooking_recipes_atoms) GLOBAL_LIST_EMPTY(rcd_list) /// list of wallmounted intercom radios. GLOBAL_LIST_EMPTY(intercoms_list) -/// list of all Area Power Controller machines, separate from machines for powernet speeeeeeed. -GLOBAL_LIST_EMPTY(apcs_list) /// list of all current implants that are tracked to work out what sort of trek everyone is on. Sadly not on lavaworld not implemented... GLOBAL_LIST_EMPTY(tracked_implants) /// list of implants the prisoner console can track and send inject commands too @@ -83,23 +80,22 @@ GLOBAL_LIST_EMPTY(stairs) GLOBAL_LIST_EMPTY(janitor_devices) GLOBAL_LIST_EMPTY(trophy_cases) GLOBAL_LIST_EMPTY(experiment_handlers) + ///This is a global list of all signs you can change an existing sign or new sign backing to, when using a pen on them. GLOBAL_LIST_INIT(editable_sign_types, populate_editable_sign_types()) GLOBAL_LIST_EMPTY(wire_color_directory) GLOBAL_LIST_EMPTY(wire_name_directory) -GLOBAL_LIST_EMPTY(ai_status_displays) - /// List of all instances of /obj/effect/mob_spawn/ghost_role in the game world GLOBAL_LIST_EMPTY(mob_spawners) + /// List of all mobs with the "ghost_direct_control" component GLOBAL_LIST_EMPTY(joinable_mobs) -/// List of all station alert consoles, /obj/machinery/computer/station_alert -GLOBAL_LIST_EMPTY(alert_consoles) /// List of area names of roundstart station cyborg rechargers, for the low charge/no charge cyborg screen alert tooltips. GLOBAL_LIST_EMPTY(roundstart_station_borgcharger_areas) + /// List of area names of roundstart station mech rechargers, for the low charge/no charge mech screen alert tooltips. GLOBAL_LIST_EMPTY(roundstart_station_mechcharger_areas) diff --git a/code/controllers/subsystem/economy.dm b/code/controllers/subsystem/economy.dm index 634a102a826..01b54f2319c 100644 --- a/code/controllers/subsystem/economy.dm +++ b/code/controllers/subsystem/economy.dm @@ -118,7 +118,7 @@ SUBSYSTEM_DEF(economy) // Assoc list of "z level" -> if it's on the station // Hack, is station z level is too expensive to do for each machine, I hate this place var/list/station_z_status = list() - for(var/obj/machinery/vending/vending_lad in GLOB.machines) + for(var/obj/machinery/vending/vending_lad as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/vending)) if(istype(vending_lad, /obj/machinery/vending/custom)) continue var/vending_level = vending_lad.z diff --git a/code/controllers/subsystem/machines.dm b/code/controllers/subsystem/machines.dm index 51578de0c34..8a0b17f195b 100644 --- a/code/controllers/subsystem/machines.dm +++ b/code/controllers/subsystem/machines.dm @@ -3,6 +3,13 @@ SUBSYSTEM_DEF(machines) init_order = INIT_ORDER_MACHINES flags = SS_KEEP_TIMING wait = 2 SECONDS + + /// Assosciative 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() ///List of all powernets on the server. @@ -13,6 +20,46 @@ SUBSYSTEM_DEF(machines) fire() return SS_INIT_SUCCESS +/// 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_machines_by_type_and_subtypes(obj/machinery/machine_type) + if(!ispath(machine_type)) + machine_type = machine_type.type + if(!ispath(machine_type, /obj/machinery)) + CRASH("called get_machines_by_type_and_subtypes with a non-machine type [machine_type]") + var/list/machines = list() + for(var/next_type in typesof(machine_type)) + var/list/found_machines = machines_by_type[next_type] + if(found_machines) + machines += found_machines + return machines + + +/// Gets a list of all machines that are the exact passed type. +/datum/controller/subsystem/machines/proc/get_machines_by_type(obj/machinery/machine_type) + if(!ispath(machine_type)) + machine_type = machine_type.type + if(!ispath(machine_type, /obj/machinery)) + CRASH("called get_machines_by_type with a non-machine type [machine_type]") + + var/list/machines = machines_by_type[machine_type] + return machines?.Copy() || list() + +/datum/controller/subsystem/machines/proc/get_all_machines() + return all_machines.Copy() + /datum/controller/subsystem/machines/proc/makepowernets() for(var/datum/powernet/power_network as anything in powernets) qdel(power_network) @@ -25,7 +72,7 @@ SUBSYSTEM_DEF(machines) propagate_network(power_cable, power_cable.powernet) /datum/controller/subsystem/machines/stat_entry(msg) - msg = "M:[length(processing)]|PN:[length(powernets)]" + msg = "M:[length(all_machines)]|MT:[length(machines_by_type)]|PM:[length(processing)]|PN:[length(powernets)]" return ..() /datum/controller/subsystem/machines/fire(resumed = FALSE) @@ -56,7 +103,11 @@ SUBSYSTEM_DEF(machines) propagate_network(PC,PC.powernet) /datum/controller/subsystem/machines/Recover() - if (istype(SSmachines.processing)) + if(islist(SSmachines.processing)) processing = SSmachines.processing - if (istype(SSmachines.powernets)) + if(islist(SSmachines.powernets)) powernets = SSmachines.powernets + if(islist(SSmachines.all_machines)) + all_machines = SSmachines.all_machines + if(islist(SSmachines.machines_by_type)) + machines_by_type = SSmachines.machines_by_type diff --git a/code/controllers/subsystem/nightshift.dm b/code/controllers/subsystem/nightshift.dm index f1b9bb8a48d..c82c7c1e771 100644 --- a/code/controllers/subsystem/nightshift.dm +++ b/code/controllers/subsystem/nightshift.dm @@ -46,7 +46,7 @@ SUBSYSTEM_DEF(nightshift) /datum/controller/subsystem/nightshift/proc/update_nightshift(active, announce = TRUE, resumed = FALSE, forced = FALSE) if(!resumed) - currentrun = GLOB.apcs_list.Copy() + currentrun = SSmachines.get_machines_by_type(/obj/machinery/power/apc) nightshift_active = active if(announce) if (active) diff --git a/code/controllers/subsystem/shuttle.dm b/code/controllers/subsystem/shuttle.dm index a4288ba5e95..3e4e65e2baa 100644 --- a/code/controllers/subsystem/shuttle.dm +++ b/code/controllers/subsystem/shuttle.dm @@ -805,9 +805,9 @@ SUBSYSTEM_DEF(shuttle) hidden_shuttle_turf_images -= remove_images hidden_shuttle_turf_images += add_images - for(var/V in GLOB.navigation_computers) - var/obj/machinery/computer/camera_advanced/shuttle_docker/C = V - C.update_hidden_docking_ports(remove_images, add_images) + for(var/obj/machinery/computer/camera_advanced/shuttle_docker/docking_computer \ + as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/computer/camera_advanced/shuttle_docker)) + docking_computer.update_hidden_docking_ports(remove_images, add_images) QDEL_LIST(remove_images) diff --git a/code/datums/ai/basic_mobs/basic_ai_behaviors/run_away_from_target.dm b/code/datums/ai/basic_mobs/basic_ai_behaviors/run_away_from_target.dm index c082817f4fb..b00f3ee2766 100644 --- a/code/datums/ai/basic_mobs/basic_ai_behaviors/run_away_from_target.dm +++ b/code/datums/ai/basic_mobs/basic_ai_behaviors/run_away_from_target.dm @@ -31,7 +31,8 @@ var/turf/target_destination = get_turf(controller.pawn) for (var/i in 1 to run_distance) var/turf/test_destination = get_ranged_target_turf_direct(controller.pawn, target, range = i, offset = 180) - if (test_destination.is_blocked_turf(exclude_mobs = TRUE, source_atom = controller.pawn, ignore_atoms = GLOB.airlocks)) + var/list/airlocks = SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door/airlock) + if (test_destination.is_blocked_turf(exclude_mobs = TRUE, source_atom = controller.pawn, ignore_atoms = airlocks)) break target_destination = test_destination if (target_destination == get_turf(controller.pawn)) diff --git a/code/datums/station_traits/negative_traits.dm b/code/datums/station_traits/negative_traits.dm index da28ce782fd..4fc6a464a9c 100644 --- a/code/datums/station_traits/negative_traits.dm +++ b/code/datums/station_traits/negative_traits.dm @@ -81,7 +81,7 @@ /datum/station_trait/blackout/on_round_start() . = ..() - for(var/obj/machinery/power/apc/apc as anything in GLOB.apcs_list) + for(var/obj/machinery/power/apc/apc as anything in SSmachines.get_machines_by_type(/obj/machinery/power/apc)) if(is_station_level(apc.z) && prob(60)) apc.overload_lighting() diff --git a/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm b/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm index 44a53ac00a5..84bb24393cd 100644 --- a/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm +++ b/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm @@ -485,7 +485,8 @@ /datum/dynamic_ruleset/midround/from_ghosts/xenomorph/execute() // 50% chance of being incremented by one required_candidates += prob(50) - for(var/obj/machinery/atmospherics/components/unary/vent_pump/temp_vent in GLOB.machines) + var/list/vent_pumps = SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/atmospherics/components/unary/vent_pump) + for(var/obj/machinery/atmospherics/components/unary/vent_pump/temp_vent as anything in vent_pumps) if(QDELETED(temp_vent)) continue if(is_station_level(temp_vent.loc.z) && !temp_vent.welded) diff --git a/code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm b/code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm index 8a3b5eb5736..975b5dc7e2b 100644 --- a/code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm +++ b/code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm @@ -632,16 +632,17 @@ GLOBAL_VAR_INIT(revolutionary_win, FALSE) /datum/dynamic_ruleset/roundstart/nuclear/clown_ops/pre_execute() . = ..() - if(.) - var/obj/machinery/nuclearbomb/syndicate/syndicate_nuke = locate() in GLOB.nuke_list - if(syndicate_nuke) - var/turf/nuke_turf = get_turf(syndicate_nuke) - if(nuke_turf) - new /obj/machinery/nuclearbomb/syndicate/bananium(nuke_turf) - qdel(syndicate_nuke) - for(var/datum/mind/clowns in assigned) - clowns.set_assigned_role(SSjob.GetJobType(/datum/job/clown_operative)) - clowns.special_role = ROLE_CLOWN_OPERATIVE + if(!.) + return + + var/list/nukes = SSmachines.get_machines_by_type(/obj/machinery/nuclearbomb/syndicate) + for(var/obj/machinery/nuclearbomb/syndicate/nuke as anything in nukes) + new /obj/machinery/nuclearbomb/syndicate/bananium(nuke.loc) + qdel(nuke) + + for(var/datum/mind/clowns in assigned) + clowns.set_assigned_role(SSjob.GetJobType(/datum/job/clown_operative)) + clowns.special_role = ROLE_CLOWN_OPERATIVE ////////////////////////////////////////////// // // diff --git a/code/game/gamemodes/events.dm b/code/game/gamemodes/events.dm index 6819805c0c6..ff11c15c65f 100644 --- a/code/game/gamemodes/events.dm +++ b/code/game/gamemodes/events.dm @@ -8,14 +8,15 @@ */ /proc/power_failure() priority_announce("Abnormal activity detected in [station_name()]'s powernet. As a precautionary measure, the station's power will be shut off for an indeterminate duration.", "Critical Power Failure", ANNOUNCER_POWEROFF) - for(var/obj/machinery/power/smes/S in GLOB.machines) - if(istype(get_area(S), /area/station/ai_monitored/turret_protected) || !is_station_level(S.z)) + var/list/all_smes = SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/power/smes) + for(var/obj/machinery/power/smes/smes as anything in all_smes) + if(istype(get_area(smes), /area/station/ai_monitored/turret_protected) || !is_station_level(smes.z)) continue - S.charge = 0 - S.output_level = 0 - S.output_attempt = FALSE - S.update_appearance() - S.power_change() + smes.charge = 0 + smes.output_level = 0 + smes.output_attempt = FALSE + smes.update_appearance() + smes.power_change() for(var/area/station_area as anything in GLOB.areas) if(!station_area.z || !is_station_level(station_area.z)) @@ -30,7 +31,7 @@ station_area.power_environ = FALSE station_area.power_change() - for(var/obj/machinery/power/apc/C in GLOB.apcs_list) + for(var/obj/machinery/power/apc/C as anything in SSmachines.get_machines_by_type(/obj/machinery/power/apc)) if(C.cell && is_station_level(C.z)) var/area/A = C.area if(GLOB.typecache_powerfailure_safe_areas[A.type]) @@ -45,18 +46,20 @@ */ /proc/power_restore() priority_announce("Power has been restored to [station_name()]. We apologize for the inconvenience.", "Power Systems Nominal", ANNOUNCER_POWERON) - for(var/obj/machinery/power/apc/C in GLOB.apcs_list) + for(var/obj/machinery/power/apc/C as anything in SSmachines.get_machines_by_type(/obj/machinery/power/apc)) if(C.cell && is_station_level(C.z)) C.cell.charge = C.cell.maxcharge COOLDOWN_RESET(C, failure_timer) - for(var/obj/machinery/power/smes/S in GLOB.machines) - if(!is_station_level(S.z)) + var/list/all_smes = SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/power/smes) + for(var/obj/machinery/power/smes/smes as anything in all_smes) + if(!is_station_level(smes.z)) continue - S.charge = S.capacity - S.output_level = S.output_level_max - S.output_attempt = TRUE - S.update_appearance() - S.power_change() + smes.charge = smes.capacity + smes.output_level = smes.output_level_max + smes.output_attempt = TRUE + smes.update_appearance() + smes.power_change() + for(var/area/station_area as anything in GLOB.areas) if(!station_area.z || !is_station_level(station_area.z)) continue @@ -79,11 +82,12 @@ */ /proc/power_restore_quick() priority_announce("All SMESs on [station_name()] have been recharged. We apologize for the inconvenience.", "Power Systems Nominal", ANNOUNCER_POWERON) - for(var/obj/machinery/power/smes/S in GLOB.machines) - if(!is_station_level(S.z)) + var/list/all_smes = SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/power/smes) + for(var/obj/machinery/power/smes/smes as anything in all_smes) + if(!is_station_level(smes.z)) continue - S.charge = S.capacity - S.output_level = S.output_level_max - S.output_attempt = TRUE - S.update_appearance() - S.power_change() + smes.charge = smes.capacity + smes.output_level = smes.output_level_max + smes.output_attempt = TRUE + smes.update_appearance() + smes.power_change() diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index b4a06bf7ceb..4455ada5a63 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -163,7 +163,7 @@ /obj/machinery/Initialize(mapload) . = ..() - GLOB.machines += src + SSmachines.register_machine(src) if(ispath(circuit, /obj/item/circuitboard)) circuit = new circuit(src) @@ -194,7 +194,7 @@ setup_area_power_relationship() /obj/machinery/Destroy() - GLOB.machines.Remove(src) + SSmachines.unregister_machine(src) end_processing() dump_inventory_contents() diff --git a/code/game/machinery/camera/motion.dm b/code/game/machinery/camera/motion.dm index a00a1c8bf85..f73a786865c 100644 --- a/code/game/machinery/camera/motion.dm +++ b/code/game/machinery/camera/motion.dm @@ -86,7 +86,7 @@ return localMotionTargets |= WEAKREF(AM) if (!detectTime) - for(var/obj/machinery/computer/security/telescreen/entertainment/TV in GLOB.machines) + for(var/obj/machinery/computer/security/telescreen/entertainment/TV as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/computer/security/telescreen/entertainment)) TV.notify(TRUE) detectTime = world.time + 30 SECONDS @@ -103,5 +103,5 @@ detectTime = world.time + 30 SECONDS else if (world.time > detectTime) detectTime = 0 - for(var/obj/machinery/computer/security/telescreen/entertainment/TV in GLOB.machines) + for(var/obj/machinery/computer/security/telescreen/entertainment/TV as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/computer/security/telescreen/entertainment)) TV.notify(FALSE) diff --git a/code/game/machinery/civilian_bounties.dm b/code/game/machinery/civilian_bounties.dm index 01565b0d98e..5e6c0b2636c 100644 --- a/code/game/machinery/civilian_bounties.dm +++ b/code/game/machinery/civilian_bounties.dm @@ -38,7 +38,7 @@ /obj/machinery/computer/piratepad_control/civilian/LateInitialize() . = ..() if(cargo_hold_id) - for(var/obj/machinery/piratepad/civilian/C in GLOB.machines) + for(var/obj/machinery/piratepad/civilian/C as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/piratepad/civilian)) if(C.cargo_hold_id == cargo_hold_id) pad_ref = WEAKREF(C) return diff --git a/code/game/machinery/computer/apc_control.dm b/code/game/machinery/computer/apc_control.dm index 6cecd17e811..eb4975eb073 100644 --- a/code/game/machinery/computer/apc_control.dm +++ b/code/game/machinery/computer/apc_control.dm @@ -94,22 +94,21 @@ for(var/entry in logs) data["logs"] += list(list("entry" = entry)) - for(var/apc in GLOB.apcs_list) + for(var/obj/machinery/power/apc/apc as anything in SSmachines.get_machines_by_type(/obj/machinery/power/apc)) if(check_apc(apc)) - var/obj/machinery/power/apc/A = apc - var/has_cell = (A.cell) ? TRUE : FALSE + var/has_cell = (apc.cell) ? TRUE : FALSE data["apcs"] += list(list( - "name" = A.area.name, - "operating" = A.operating, - "charge" = (has_cell) ? A.cell.percent() : "NOCELL", - "load" = display_power(A.lastused_total), - "charging" = A.charging, - "chargeMode" = A.chargemode, - "eqp" = A.equipment, - "lgt" = A.lighting, - "env" = A.environ, - "responds" = A.aidisabled || A.panel_open, - "ref" = REF(A) + "name" = apc.area.name, + "operating" = apc.operating, + "charge" = (has_cell) ? apc.cell.percent() : "NOCELL", + "load" = display_power(apc.lastused_total), + "charging" = apc.charging, + "chargeMode" = apc.chargemode, + "eqp" = apc.equipment, + "lgt" = apc.lighting, + "env" = apc.environ, + "responds" = apc.aidisabled || apc.panel_open, + "ref" = REF(apc) ) ) return data @@ -158,7 +157,7 @@ if("access-apc") var/ref = params["ref"] playsound(src, SFX_TERMINAL_TYPE, 50, FALSE) - var/obj/machinery/power/apc/APC = locate(ref) in GLOB.apcs_list + var/obj/machinery/power/apc/APC = locate(ref) in SSmachines.get_machines_by_type(/obj/machinery/power/apc) connect_apc(APC, usr) if("check-logs") log_activity("Checked Logs") @@ -168,7 +167,7 @@ var/ref = params["ref"] var/type = params["type"] var/value = params["value"] - var/obj/machinery/power/apc/target = locate(ref) in GLOB.apcs_list + var/obj/machinery/power/apc/target = locate(ref) in SSmachines.get_machines_by_type(/obj/machinery/power/apc) if(!target) return @@ -197,7 +196,7 @@ usr.log_message("set APC [target.area.name] [type] to [setTo]]", LOG_GAME) if("breaker") var/ref = params["ref"] - var/obj/machinery/power/apc/target = locate(ref) in GLOB.apcs_list + var/obj/machinery/power/apc/target = locate(ref) in SSmachines.get_machines_by_type(/obj/machinery/power/apc) target.toggle_breaker(usr) var/setTo = target.operating ? "On" : "Off" log_activity("Turned APC [target.area.name]'s breaker [setTo]") diff --git a/code/game/machinery/computer/arena.dm b/code/game/machinery/computer/arena.dm index 154b91a3aba..39b39af197b 100644 --- a/code/game/machinery/computer/arena.dm +++ b/code/game/machinery/computer/arena.dm @@ -210,7 +210,7 @@ set_doors(closed = TRUE) /obj/machinery/computer/arena/proc/get_spawn(team) - for(var/obj/machinery/arena_spawn/A in GLOB.machines) + for(var/obj/machinery/arena_spawn/A as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/arena_spawn)) if(A.arena_id == arena_id && A.team == team) return A @@ -244,7 +244,7 @@ /obj/machinery/computer/arena/proc/set_doors(closed = FALSE) - for(var/obj/machinery/door/poddoor/D in GLOB.machines) //I really dislike pathing of these + for(var/obj/machinery/door/poddoor/D as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door/poddoor)) if(D.id != arena_id) continue if(closed) @@ -385,7 +385,7 @@ /obj/machinery/arena_spawn/proc/get_controller() if(_controller && !QDELETED(_controller) && _controller.arena_id == arena_id) return _controller - for(var/obj/machinery/computer/arena/A in GLOB.machines) + for(var/obj/machinery/computer/arena/A as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/computer/arena)) if(A.arena_id == arena_id) _controller = A return _controller diff --git a/code/game/machinery/computer/mechlaunchpad.dm b/code/game/machinery/computer/mechlaunchpad.dm index 5eeeb86f3f8..c89bbab7fa0 100644 --- a/code/game/machinery/computer/mechlaunchpad.dm +++ b/code/game/machinery/computer/mechlaunchpad.dm @@ -35,7 +35,7 @@ connected_mechpad = null /obj/machinery/computer/mechpad/LateInitialize() - for(var/obj/machinery/mechpad/pad in GLOB.mechpad_list) + for(var/obj/machinery/mechpad/pad as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/mechpad)) if(pad == connected_mechpad) continue if(pad.id != id) diff --git a/code/game/machinery/computer/telescreen.dm b/code/game/machinery/computer/telescreen.dm index 1642195ffb6..e776089b088 100644 --- a/code/game/machinery/computer/telescreen.dm +++ b/code/game/machinery/computer/telescreen.dm @@ -271,5 +271,5 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/computer/security/telescreen/entertai is_show_active = !is_show_active say("The [tv_show_name] show has [is_show_active ? "begun" : "ended"]") var/announcement = is_show_active ? pick(tv_starters) : pick(tv_enders) - for(var/obj/machinery/computer/security/telescreen/entertainment/tv in GLOB.machines) + for(var/obj/machinery/computer/security/telescreen/entertainment/tv as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/computer/security/telescreen/entertainment)) tv.update_shows(is_show_active, tv_network_id, announcement) diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 7d5b495e28c..ac42acd062c 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -203,7 +203,7 @@ id_tag = "[port.shuttle_id]_[id_tag]" /obj/machinery/door/airlock/proc/update_other_id() - for(var/obj/machinery/door/airlock/Airlock in GLOB.airlocks) + for(var/obj/machinery/door/airlock/Airlock as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door/airlock)) if(Airlock.closeOtherId == closeOtherId && Airlock != src) if(!(Airlock in close_others)) close_others += Airlock @@ -302,7 +302,7 @@ otherlock.close_others -= src close_others.Cut() if(id_tag) - for(var/obj/machinery/door_buttons/D in GLOB.machines) + for(var/obj/machinery/door_buttons/D as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door_buttons)) D.removeMe(src) QDEL_NULL(note) QDEL_NULL(seal) diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index de867640e8c..c5e1aa39f94 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -69,7 +69,6 @@ update_freelook_sight() air_update_turf(TRUE, TRUE) register_context() - GLOB.airlocks += src if(elevator_mode) if(elevator_linked_id) elevator_status = LIFT_PLATFORM_LOCKED @@ -129,7 +128,6 @@ /obj/machinery/door/Destroy() update_freelook_sight() - GLOB.airlocks -= src if(elevator_mode) GLOB.elevator_doors -= src if(spark_system) diff --git a/code/game/machinery/embedded_controller/access_controller.dm b/code/game/machinery/embedded_controller/access_controller.dm index 3aaf4a9b6f8..094e9c3bbd1 100644 --- a/code/game/machinery/embedded_controller/access_controller.dm +++ b/code/game/machinery/embedded_controller/access_controller.dm @@ -50,11 +50,11 @@ var/busy /obj/machinery/door_buttons/access_button/findObjsByTag() - for(var/obj/machinery/door_buttons/airlock_controller/A in GLOB.machines) + for(var/obj/machinery/door_buttons/airlock_controller/A as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door_buttons/airlock_controller)) if(A.idSelf == idSelf) controller = A break - for(var/obj/machinery/door/airlock/I in GLOB.airlocks) + for(var/obj/machinery/door/airlock/I as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door/airlock)) if(I.id_tag == idDoor) door = I break @@ -120,7 +120,7 @@ exteriorAirlock = null /obj/machinery/door_buttons/airlock_controller/Destroy() - for(var/obj/machinery/door_buttons/access_button/A in GLOB.machines) + for(var/obj/machinery/door_buttons/access_button/A as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door_buttons/access_button)) if(A.controller == src) A.controller = null return ..() @@ -241,7 +241,7 @@ lostPower = FALSE /obj/machinery/door_buttons/airlock_controller/findObjsByTag() - for(var/obj/machinery/door/door as anything in GLOB.airlocks) + for(var/obj/machinery/door/door as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door)) if(door.id_tag == idInterior) interiorAirlock = door else if(door.id_tag == idExterior) diff --git a/code/game/machinery/mass_driver.dm b/code/game/machinery/mass_driver.dm index 28afff8f50b..ff81e528c62 100644 --- a/code/game/machinery/mass_driver.dm +++ b/code/game/machinery/mass_driver.dm @@ -22,7 +22,7 @@ id = MASSDRIVER_SHACK /obj/machinery/mass_driver/Destroy() - for(var/obj/machinery/computer/pod/control in GLOB.machines) + for(var/obj/machinery/computer/pod/control as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/computer/pod)) if(control.id == id) control.connected = null return ..() diff --git a/code/game/machinery/mechlaunchpad.dm b/code/game/machinery/mechlaunchpad.dm index 306ee2be9ed..10f5ab66903 100644 --- a/code/game/machinery/mechlaunchpad.dm +++ b/code/game/machinery/mechlaunchpad.dm @@ -14,11 +14,6 @@ /obj/machinery/mechpad/Initialize(mapload) . = ..() display_name = "Orbital Pad - [get_area_name(src)]" - GLOB.mechpad_list += src - -/obj/machinery/mechpad/Destroy() - GLOB.mechpad_list -= src - return ..() /obj/machinery/mechpad/examine(mob/user) . = ..() diff --git a/code/game/machinery/satellite/satellite_control.dm b/code/game/machinery/satellite/satellite_control.dm index 459382da7ed..e8482fe91df 100644 --- a/code/game/machinery/satellite/satellite_control.dm +++ b/code/game/machinery/satellite/satellite_control.dm @@ -23,7 +23,7 @@ /obj/machinery/computer/sat_control/proc/toggle(toggled_id) var/turf/current_turf = get_turf(src) - for(var/obj/machinery/satellite/satellite in GLOB.machines) + for(var/obj/machinery/satellite/satellite as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/satellite)) if(satellite.id != toggled_id) continue if(satellite.obj_flags & EMAGGED) @@ -36,7 +36,7 @@ var/list/data = list() data["satellites"] = list() - for(var/obj/machinery/satellite/sat in GLOB.machines) + for(var/obj/machinery/satellite/sat as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/satellite)) data["satellites"] += list(list( "id" = sat.id, "active" = sat.active, diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm index cac69d8ac11..7805411d0af 100644 --- a/code/game/machinery/status_display.dm +++ b/code/game/machinery/status_display.dm @@ -442,14 +442,6 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/status_display/evac, 32) MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/status_display/ai, 32) -/obj/machinery/status_display/ai/Initialize(mapload) - . = ..() - GLOB.ai_status_displays.Add(src) - -/obj/machinery/status_display/ai/Destroy() - GLOB.ai_status_displays.Remove(src) - . = ..() - /obj/machinery/status_display/ai/attack_ai(mob/living/silicon/ai/user) if(!isAI(user)) return diff --git a/code/game/machinery/syndicatebomb.dm b/code/game/machinery/syndicatebomb.dm index 3e59f0a455e..402185e0928 100644 --- a/code/game/machinery/syndicatebomb.dm +++ b/code/game/machinery/syndicatebomb.dm @@ -595,7 +595,7 @@ /obj/item/syndicatedetonator/attack_self(mob/user) if(timer < world.time) - for(var/obj/machinery/syndicatebomb/B in GLOB.machines) + for(var/obj/machinery/syndicatebomb/B as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/syndicatebomb)) if(B.active) B.detonation_timer = world.time + BUTTON_DELAY detonated++ diff --git a/code/game/objects/effects/anomalies/anomalies_gravity.dm b/code/game/objects/effects/anomalies/anomalies_gravity.dm index 5fcbafce856..efd49ef502f 100644 --- a/code/game/objects/effects/anomalies/anomalies_gravity.dm +++ b/code/game/objects/effects/anomalies/anomalies_gravity.dm @@ -92,7 +92,7 @@ grav_field = new(src, 7, TRUE, rand(0, 3)) /obj/effect/anomaly/grav/high/detonate() - for(var/obj/machinery/gravity_generator/main/the_generator in GLOB.machines) + for(var/obj/machinery/gravity_generator/main/the_generator as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/gravity_generator/main)) if(is_station_level(the_generator.z)) the_generator.blackout() diff --git a/code/game/objects/items/implants/implant_abductor.dm b/code/game/objects/items/implants/implant_abductor.dm index dc127a2c05b..03f72817edf 100644 --- a/code/game/objects/items/implants/implant_abductor.dm +++ b/code/game/objects/items/implants/implant_abductor.dm @@ -53,7 +53,7 @@ else //If we still cannot find a home associated with our team, we just pick a random pad and make it our own. var/list/consoles = list() - for(var/obj/machinery/abductor/console/found_console in GLOB.machines) + for(var/obj/machinery/abductor/console/found_console as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/abductor/console)) consoles += found_console console = pick(consoles) if(console) diff --git a/code/game/objects/items/mail.dm b/code/game/objects/items/mail.dm index 80f776b6e68..184b7a3decb 100644 --- a/code/game/objects/items/mail.dm +++ b/code/game/objects/items/mail.dm @@ -340,7 +340,7 @@ var/nuclear_option_odds = 0.1 /obj/item/paper/fluff/junkmail_redpill/Initialize(mapload) - var/obj/machinery/nuclearbomb/selfdestruct/self_destruct = locate() in GLOB.nuke_list + var/obj/machinery/nuclearbomb/selfdestruct/self_destruct = locate() in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/nuclearbomb/selfdestruct) if(!self_destruct || !prob(nuclear_option_odds)) // 1 in 1000 chance of getting 2 random nuke code characters. add_raw_text("You need to escape the simulation. Don't forget the numbers, they help you remember: '[rand(0,9)][rand(0,9)][rand(0,9)]...'") return ..() diff --git a/code/game/objects/items/teleportation.dm b/code/game/objects/items/teleportation.dm index f7f5c6c300f..deede6ea83b 100644 --- a/code/game/objects/items/teleportation.dm +++ b/code/game/objects/items/teleportation.dm @@ -175,7 +175,7 @@ return //SKYRAT EDIT END var/list/locations = list() - for(var/obj/machinery/computer/teleporter/computer in GLOB.machines) + for(var/obj/machinery/computer/teleporter/computer as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/computer/teleporter)) var/atom/target = computer.target_ref?.resolve() if(!target) computer.target_ref = null diff --git a/code/game/objects/structures/construction_console/construction_console_aux.dm b/code/game/objects/structures/construction_console/construction_console_aux.dm index 552d7735d43..0b03a79ce52 100644 --- a/code/game/objects/structures/construction_console/construction_console_aux.dm +++ b/code/game/objects/structures/construction_console/construction_console_aux.dm @@ -23,7 +23,7 @@ /obj/machinery/computer/camera_advanced/base_construction/aux/find_spawn_spot() //Aux base controller. Where the eyeobj will spawn. var/obj/machinery/computer/auxiliary_base/aux_controller - for(var/obj/machinery/computer/auxiliary_base/potential_aux_console in GLOB.machines) + for(var/obj/machinery/computer/auxiliary_base/potential_aux_console as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/computer/auxiliary_base)) if(istype(get_area(potential_aux_console), allowed_area)) aux_controller = potential_aux_console break diff --git a/code/modules/admin/admin_fax_panel.dm b/code/modules/admin/admin_fax_panel.dm index e4126d89c5d..fe1f03d7d7e 100644 --- a/code/modules/admin/admin_fax_panel.dm +++ b/code/modules/admin/admin_fax_panel.dm @@ -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 diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 3844b0bd244..08bc3ee2666 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -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]\".") diff --git a/code/modules/admin/verbs/adminevents.dm b/code/modules/admin/verbs/adminevents.dm index 9859e8041b5..a9f425b95ab 100644 --- a/code/modules/admin/verbs/adminevents.dm +++ b/code/modules/admin/verbs/adminevents.dm @@ -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 diff --git a/code/modules/admin/verbs/atmosdebug.dm b/code/modules/admin/verbs/atmosdebug.dm index 81e92a52716..202672e805d 100644 --- a/code/modules/admin/verbs/atmosdebug.dm +++ b/code/modules/admin/verbs/atmosdebug.dm @@ -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) diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index b68db5cdeba..063ba804420 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -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].
" @@ -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].
" diff --git a/code/modules/admin/verbs/ert.dm b/code/modules/admin/verbs/ert.dm index 387f54ef806..a3921fe1f30 100644 --- a/code/modules/admin/verbs/ert.dm +++ b/code/modules/admin/verbs/ert.dm @@ -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 diff --git a/code/modules/admin/verbs/secrets.dm b/code/modules/admin/verbs/secrets.dm index 5dd4989dd8f..5e843041671 100644 --- a/code/modules/admin/verbs/secrets.dm +++ b/code/modules/admin/verbs/secrets.dm @@ -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") diff --git a/code/modules/antagonists/abductor/abductor.dm b/code/modules/antagonists/abductor/abductor.dm index b2d59d3fc77..8ad4628a835 100644 --- a/code/modules/antagonists/abductor/abductor.dm +++ b/code/modules/antagonists/abductor/abductor.dm @@ -204,7 +204,7 @@ explanation_text = "Experiment on [target_amount] humans." /datum/objective/experiment/check_completion() - for(var/obj/machinery/abductor/experiment/E in GLOB.machines) + for(var/obj/machinery/abductor/experiment/E as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/abductor/experiment)) if(!istype(team, /datum/team/abductor_team)) return FALSE var/datum/team/abductor_team/T = team diff --git a/code/modules/antagonists/abductor/equipment/gear/abductor_clothing.dm b/code/modules/antagonists/abductor/equipment/gear/abductor_clothing.dm index f8bef933790..69fd1fcfcf4 100644 --- a/code/modules/antagonists/abductor/equipment/gear/abductor_clothing.dm +++ b/code/modules/antagonists/abductor/equipment/gear/abductor_clothing.dm @@ -155,7 +155,7 @@ /obj/item/clothing/suit/armor/abductor/Destroy() STOP_PROCESSING(SSobj, src) - for(var/obj/machinery/abductor/console/mothership_console in GLOB.machines) + for(var/obj/machinery/abductor/console/mothership_console as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/abductor/console)) if(mothership_console.vest == src) mothership_console.vest = null break diff --git a/code/modules/antagonists/abductor/machinery/console.dm b/code/modules/antagonists/abductor/machinery/console.dm index 494491ab9fd..1dcaaab892b 100644 --- a/code/modules/antagonists/abductor/machinery/console.dm +++ b/code/modules/antagonists/abductor/machinery/console.dm @@ -1,5 +1,5 @@ /proc/get_abductor_console(team_number) - for(var/obj/machinery/abductor/console/C in GLOB.machines) + for(var/obj/machinery/abductor/console/C as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/abductor/console)) if(C.team_number == team_number) return C @@ -206,18 +206,18 @@ if(!team_number) return - for(var/obj/machinery/abductor/pad/p in GLOB.machines) + for(var/obj/machinery/abductor/pad/p as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/abductor/pad)) if(p.team_number == team_number) pad = p pad.console = src break - for(var/obj/machinery/abductor/experiment/e in GLOB.machines) + for(var/obj/machinery/abductor/experiment/e as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/abductor/experiment)) if(e.team_number == team_number) experiment = e e.console = src - for(var/obj/machinery/computer/camera_advanced/abductor/c in GLOB.machines) + for(var/obj/machinery/computer/camera_advanced/abductor/c as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/computer/camera_advanced/abductor)) if(c.team_number == team_number) camera = c c.console = src @@ -252,7 +252,7 @@ if(vest == V) return FALSE - for(var/obj/machinery/abductor/console/C in GLOB.machines) + for(var/obj/machinery/abductor/console/C as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/abductor/console)) if(C.vest == V) C.vest = null break diff --git a/code/modules/antagonists/malf_ai/malf_ai_modules.dm b/code/modules/antagonists/malf_ai/malf_ai_modules.dm index 384e21a3078..238358374c0 100644 --- a/code/modules/antagonists/malf_ai/malf_ai_modules.dm +++ b/code/modules/antagonists/malf_ai/malf_ai_modules.dm @@ -385,7 +385,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module)) /datum/action/innate/ai/lockdown/Activate() hack_in_progress = TRUE - for(var/obj/machinery/door/locked_down as anything in GLOB.airlocks) + for(var/obj/machinery/door/locked_down as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door)) if(QDELETED(locked_down) || !is_station_level(locked_down.z)) continue INVOKE_ASYNC(locked_down, TYPE_PROC_REF(/obj/machinery/door, hostile_lockdown), owner) @@ -405,7 +405,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module)) /// For Lockdown malf AI ability. Opens all doors on the station. /proc/_malf_ai_undo_lockdown() - for(var/obj/machinery/door/locked_down as anything in GLOB.airlocks) + for(var/obj/machinery/door/locked_down as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door)) if(QDELETED(locked_down) || !is_station_level(locked_down.z)) continue INVOKE_ASYNC(locked_down, TYPE_PROC_REF(/obj/machinery/door, disable_lockdown)) @@ -565,7 +565,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module)) desc = "[desc] It has [uses] use\s remaining." /datum/action/innate/ai/blackout/Activate() - 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)) if(prob(30 * apc.overload)) apc.overload_lighting() else @@ -726,12 +726,12 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module)) uses = 1 /datum/action/innate/ai/break_fire_alarms/Activate() - for(var/obj/machinery/firealarm/bellman in GLOB.machines) + for(var/obj/machinery/firealarm/bellman as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/firealarm)) if(!is_station_level(bellman.z)) continue bellman.obj_flags |= EMAGGED bellman.update_appearance() - for(var/obj/machinery/door/firedoor/firelock in GLOB.machines) + for(var/obj/machinery/door/firedoor/firelock as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door/firedoor)) if(!is_station_level(firelock.z)) continue firelock.emag_act(owner_AI, src) @@ -756,7 +756,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module)) uses = 1 /datum/action/innate/ai/emergency_lights/Activate() - 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)) if(is_station_level(L.z)) L.no_low_power = TRUE INVOKE_ASYNC(L, TYPE_PROC_REF(/obj/machinery/light/, update), FALSE) @@ -857,7 +857,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module)) unlock_sound = 'sound/items/rped.ogg' /datum/ai_module/upgrade/upgrade_turrets/upgrade(mob/living/silicon/ai/AI) - for(var/obj/machinery/porta_turret/ai/turret in GLOB.machines) + for(var/obj/machinery/porta_turret/ai/turret as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/porta_turret/ai)) turret.AddElement(/datum/element/empprotection, EMP_PROTECT_SELF | EMP_PROTECT_WIRES | EMP_PROTECT_CONTENTS) turret.max_integrity = 200 turret.repair_damage(200) diff --git a/code/modules/antagonists/nukeop/equipment/nuclear_bomb/_nuclear_bomb.dm b/code/modules/antagonists/nukeop/equipment/nuclear_bomb/_nuclear_bomb.dm index 304e91ef433..39aec80924d 100644 --- a/code/modules/antagonists/nukeop/equipment/nuclear_bomb/_nuclear_bomb.dm +++ b/code/modules/antagonists/nukeop/equipment/nuclear_bomb/_nuclear_bomb.dm @@ -57,7 +57,6 @@ GLOBAL_VAR(station_nuke_source) /obj/machinery/nuclearbomb/Initialize(mapload) . = ..() countdown = new(src) - GLOB.nuke_list += src core = new /obj/item/nuke_core(src) STOP_PROCESSING(SSobj, core) update_appearance() @@ -69,7 +68,6 @@ GLOBAL_VAR(station_nuke_source) if(!exploding) // If we're not exploding, set the alert level back to normal toggle_nuke_safety() - GLOB.nuke_list -= src QDEL_NULL(countdown) QDEL_NULL(core) return ..() diff --git a/code/modules/antagonists/nukeop/equipment/pinpointer.dm b/code/modules/antagonists/nukeop/equipment/pinpointer.dm index 3cf024d3c7a..03faaa5d0ef 100644 --- a/code/modules/antagonists/nukeop/equipment/pinpointer.dm +++ b/code/modules/antagonists/nukeop/equipment/pinpointer.dm @@ -19,7 +19,7 @@ else msg = "Its tracking indicator is blank." . += msg - for(var/obj/machinery/nuclearbomb/bomb as anything in GLOB.nuke_list) + for(var/obj/machinery/nuclearbomb/bomb as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/nuclearbomb)) if(bomb.timing) . += "Extreme danger. Arming signal detected. Time remaining: [bomb.get_time_left()]." @@ -27,7 +27,7 @@ ..() if(!active || alert) return - for(var/obj/machinery/nuclearbomb/bomb as anything in GLOB.nuke_list) + for(var/obj/machinery/nuclearbomb/bomb as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/nuclearbomb)) if(!bomb.timing) continue alert = TRUE @@ -48,10 +48,9 @@ var/mob/living/silicon/ai/A = V if(A.nuking) target = A - for(var/V in GLOB.apcs_list) - var/obj/machinery/power/apc/A = V - if(A.malfhack && A.occupier) - target = A + for(var/obj/machinery/power/apc/apc as anything in SSmachines.get_machines_by_type(/obj/machinery/power/apc)) + if(apc.malfhack && apc.occupier) + target = apc if(TRACK_INFILTRATOR) target = SSshuttle.getShuttle("syndicate") // SKYRAT EDIT ADDITION diff --git a/code/modules/antagonists/nukeop/nukeop.dm b/code/modules/antagonists/nukeop/nukeop.dm index a03556972bc..2e8b53d5dfa 100644 --- a/code/modules/antagonists/nukeop/nukeop.dm +++ b/code/modules/antagonists/nukeop/nukeop.dm @@ -91,14 +91,14 @@ /datum/antagonist/nukeop/proc/assign_nuke() if(nuke_team && !nuke_team.tracked_nuke) nuke_team.memorized_code = random_nukecode() - var/obj/machinery/nuclearbomb/syndicate/nuke = locate() in GLOB.nuke_list + var/obj/machinery/nuclearbomb/syndicate/nuke = locate() in SSmachines.get_machines_by_type(/obj/machinery/nuclearbomb/syndicate) if(nuke) nuke_team.tracked_nuke = nuke if(nuke.r_code == NUKE_CODE_UNSET) nuke.r_code = nuke_team.memorized_code else //Already set by admins/something else? nuke_team.memorized_code = nuke.r_code - for(var/obj/machinery/nuclearbomb/beer/beernuke in GLOB.nuke_list) + for(var/obj/machinery/nuclearbomb/beer/beernuke as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/nuclearbomb/beer)) beernuke.r_code = nuke_team.memorized_code else stack_trace("Syndicate nuke not found during nuke team creation.") @@ -182,7 +182,7 @@ /datum/antagonist/nukeop/proc/admin_tell_code(mob/admin) var/code - for (var/obj/machinery/nuclearbomb/bombue as anything in GLOB.nuke_list) + for (var/obj/machinery/nuclearbomb/bombue as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/nuclearbomb)) if (length(bombue.r_code) <= 5 && bombue.r_code != initial(bombue.r_code)) code = bombue.r_code break @@ -323,7 +323,7 @@ /datum/antagonist/nukeop/lone/assign_nuke() if(nuke_team && !nuke_team.tracked_nuke) nuke_team.memorized_code = random_nukecode() - var/obj/machinery/nuclearbomb/selfdestruct/nuke = locate() in GLOB.nuke_list + var/obj/machinery/nuclearbomb/selfdestruct/nuke = locate() in SSmachines.get_machines_by_type(/obj/machinery/nuclearbomb/selfdestruct) if(nuke) nuke_team.tracked_nuke = nuke if(nuke.r_code == NUKE_CODE_UNSET) diff --git a/code/modules/antagonists/pirate/pirate.dm b/code/modules/antagonists/pirate/pirate.dm index c88c49873af..15a028b24d7 100644 --- a/code/modules/antagonists/pirate/pirate.dm +++ b/code/modules/antagonists/pirate/pirate.dm @@ -57,7 +57,7 @@ /datum/team/pirate/proc/forge_objectives() var/datum/objective/loot/getbooty = new() getbooty.team = src - for(var/obj/machinery/computer/piratepad_control/P in GLOB.machines) + for(var/obj/machinery/computer/piratepad_control/P as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/computer/piratepad_control)) var/area/A = get_area(P) if(istype(A,/area/shuttle/pirate)) getbooty.cargo_hold = P diff --git a/code/modules/antagonists/pirate/pirate_shuttle_equipment.dm b/code/modules/antagonists/pirate/pirate_shuttle_equipment.dm index 105570e9e4b..49a87d05461 100644 --- a/code/modules/antagonists/pirate/pirate_shuttle_equipment.dm +++ b/code/modules/antagonists/pirate/pirate_shuttle_equipment.dm @@ -230,7 +230,7 @@ /obj/machinery/computer/piratepad_control/LateInitialize() . = ..() if(cargo_hold_id) - for(var/obj/machinery/piratepad/P in GLOB.machines) + for(var/obj/machinery/piratepad/P as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/piratepad)) if(P.cargo_hold_id == cargo_hold_id) pad_ref = WEAKREF(P) return diff --git a/code/modules/antagonists/traitor/objectives/final_objective/battlecruiser.dm b/code/modules/antagonists/traitor/objectives/final_objective/battlecruiser.dm index 2e3b9c791bf..b136a6f695c 100644 --- a/code/modules/antagonists/traitor/objectives/final_objective/battlecruiser.dm +++ b/code/modules/antagonists/traitor/objectives/final_objective/battlecruiser.dm @@ -19,7 +19,7 @@ /datum/traitor_objective/ultimate/battlecruiser/on_objective_taken(mob/user) . = ..() team = new() - var/obj/machinery/nuclearbomb/selfdestruct/nuke = locate() in GLOB.nuke_list + var/obj/machinery/nuclearbomb/selfdestruct/nuke = locate() in SSmachines.get_machines_by_type(/obj/machinery/nuclearbomb/selfdestruct) if(nuke.r_code == NUKE_CODE_UNSET) nuke.r_code = random_nukecode() team.nuke = nuke diff --git a/code/modules/antagonists/wizard/grand_ritual/grand_ritual_finale.dm b/code/modules/antagonists/wizard/grand_ritual/grand_ritual_finale.dm index 962fa24450b..4b090b220d0 100644 --- a/code/modules/antagonists/wizard/grand_ritual/grand_ritual_finale.dm +++ b/code/modules/antagonists/wizard/grand_ritual/grand_ritual_finale.dm @@ -290,7 +290,7 @@ /datum/grand_finale/all_access/trigger(mob/living/carbon/human/invoker) message_admins("[key_name(invoker)] removed all door access requirements") - for(var/obj/machinery/door/target_door as anything in GLOB.airlocks) + for(var/obj/machinery/door/target_door as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door)) if(is_station_level(target_door.z)) target_door.unlock() target_door.req_access = list() diff --git a/code/modules/assembly/doorcontrol.dm b/code/modules/assembly/doorcontrol.dm index ad264876286..552b995aab4 100644 --- a/code/modules/assembly/doorcontrol.dm +++ b/code/modules/assembly/doorcontrol.dm @@ -27,7 +27,7 @@ if(cooldown) return cooldown = TRUE - for(var/obj/machinery/door/poddoor/M in GLOB.airlocks) + for(var/obj/machinery/door/poddoor/M as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door/poddoor)) if(M.id == src.id) if(openclose == null || !sync_doors) openclose = M.density @@ -75,7 +75,7 @@ cooldown = TRUE var/doors_need_closing = FALSE var/list/obj/machinery/door/airlock/open_or_close = list() - for(var/obj/machinery/door/airlock/D in GLOB.airlocks) + for(var/obj/machinery/door/airlock/D as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door/airlock)) if(D.id_tag == src.id) if(specialfunctions & OPEN) open_or_close += D @@ -112,21 +112,21 @@ if(cooldown) return cooldown = TRUE - for(var/obj/machinery/door/poddoor/M in GLOB.airlocks) + for(var/obj/machinery/door/poddoor/M as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door/poddoor)) if (M.id == src.id) INVOKE_ASYNC(M, TYPE_PROC_REF(/obj/machinery/door/poddoor, open)) addtimer(CALLBACK(src, PROC_REF(activate_stage2)), 1 SECONDS) /obj/item/assembly/control/massdriver/proc/activate_stage2() - for(var/obj/machinery/mass_driver/M in GLOB.machines) + for(var/obj/machinery/mass_driver/M as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/mass_driver)) if(M.id == src.id) M.drive() addtimer(CALLBACK(src, PROC_REF(activate_stage3)), 6 SECONDS) /obj/item/assembly/control/massdriver/proc/activate_stage3() - for(var/obj/machinery/door/poddoor/M in GLOB.airlocks) + for(var/obj/machinery/door/poddoor/M as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door/poddoor)) if (M.id == src.id) INVOKE_ASYNC(M, TYPE_PROC_REF(/obj/machinery/door/poddoor, close)) @@ -141,11 +141,11 @@ if(cooldown) return cooldown = TRUE - for(var/obj/machinery/sparker/M in GLOB.machines) + for(var/obj/machinery/sparker/M as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/sparker)) if (M.id == src.id) INVOKE_ASYNC(M, TYPE_PROC_REF(/obj/machinery/sparker, ignite)) - for(var/obj/machinery/igniter/M in GLOB.machines) + for(var/obj/machinery/igniter/M as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/igniter)) if(M.id == src.id) INVOKE_ASYNC(M, TYPE_PROC_REF(/obj/machinery/igniter, toggle)) @@ -159,7 +159,7 @@ if(cooldown) return cooldown = TRUE - for(var/obj/machinery/flasher/M in GLOB.machines) + for(var/obj/machinery/flasher/M as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/flasher)) if(M.id == src.id) INVOKE_ASYNC(M, TYPE_PROC_REF(/obj/machinery/flasher, flash)) diff --git a/code/modules/events/brand_intelligence.dm b/code/modules/events/brand_intelligence.dm index 292b1a4e254..9fbfa87390b 100644 --- a/code/modules/events/brand_intelligence.dm +++ b/code/modules/events/brand_intelligence.dm @@ -34,7 +34,7 @@ /datum/round_event/brand_intelligence/setup() //select our origin machine (which will also be the type of vending machine affected.) - for(var/obj/machinery/vending/vendor in GLOB.machines) + for(var/obj/machinery/vending/vendor as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/vending)) if(!vendor.onstation) continue if(!vendor.density) diff --git a/code/modules/events/electrical_storm.dm b/code/modules/events/electrical_storm.dm index 948a7a2def4..3dc4e5bf051 100644 --- a/code/modules/events/electrical_storm.dm +++ b/code/modules/events/electrical_storm.dm @@ -30,7 +30,6 @@ return for(var/centre in epicentreList) - for(var/a in GLOB.apcs_list) - var/obj/machinery/power/apc/A = a - if(get_dist(centre, A) <= lightsoutRange) - A.overload_lighting() + for(var/obj/machinery/power/apc/apc as anything in SSmachines.get_machines_by_type(/obj/machinery/power/apc)) + if(get_dist(centre, apc) <= lightsoutRange) + apc.overload_lighting() diff --git a/code/modules/events/ghost_role/alien_infestation.dm b/code/modules/events/ghost_role/alien_infestation.dm index afcb31fe5a8..8c3741ccef2 100644 --- a/code/modules/events/ghost_role/alien_infestation.dm +++ b/code/modules/events/ghost_role/alien_infestation.dm @@ -46,7 +46,7 @@ /datum/round_event/ghost_role/alien_infestation/spawn_role() var/list/vents = list() - for(var/obj/machinery/atmospherics/components/unary/vent_pump/temp_vent in GLOB.machines) + for(var/obj/machinery/atmospherics/components/unary/vent_pump/temp_vent as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/atmospherics/components/unary/vent_pump)) if(QDELETED(temp_vent)) continue if(is_station_level(temp_vent.loc.z) && !temp_vent.welded) diff --git a/code/modules/events/gravity_generator_blackout.dm b/code/modules/events/gravity_generator_blackout.dm index 89cc5a43367..84d67753dce 100644 --- a/code/modules/events/gravity_generator_blackout.dm +++ b/code/modules/events/gravity_generator_blackout.dm @@ -13,7 +13,7 @@ return . var/station_generator_exists = FALSE - for(var/obj/machinery/gravity_generator/main/the_generator in GLOB.machines) + for(var/obj/machinery/gravity_generator/main/the_generator as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/gravity_generator/main)) if(is_station_level(the_generator.z)) station_generator_exists = TRUE @@ -29,6 +29,6 @@ priority_announce("Gravnospheric anomalies detected near [station_name()]. Manual reset of generators is required.", "Anomaly Alert", ANNOUNCER_GRANOMALIES) /datum/round_event/gravity_generator_blackout/start() - for(var/obj/machinery/gravity_generator/main/the_generator in GLOB.machines) + for(var/obj/machinery/gravity_generator/main/the_generator as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/gravity_generator/main)) if(is_station_level(the_generator.z)) the_generator.blackout() diff --git a/code/modules/events/scrubber_overflow.dm b/code/modules/events/scrubber_overflow.dm index e9bf0c8b582..6aad17f00fa 100644 --- a/code/modules/events/scrubber_overflow.dm +++ b/code/modules/events/scrubber_overflow.dm @@ -70,7 +70,7 @@ priority_announce("The scrubbers network is experiencing a backpressure surge. Some ejection of contents may occur.", "Atmospherics alert") /datum/round_event/scrubber_overflow/setup() - for(var/obj/machinery/atmospherics/components/unary/vent_scrubber/temp_vent in GLOB.machines) + for(var/obj/machinery/atmospherics/components/unary/vent_scrubber/temp_vent as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/atmospherics/components/unary/vent_scrubber)) var/turf/scrubber_turf = get_turf(temp_vent) if(!scrubber_turf) continue @@ -89,7 +89,7 @@ . = ..() if(!.) return - for(var/obj/machinery/atmospherics/components/unary/vent_scrubber/temp_vent in GLOB.machines) + for(var/obj/machinery/atmospherics/components/unary/vent_scrubber/temp_vent as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/atmospherics/components/unary/vent_scrubber)) var/turf/scrubber_turf = get_turf(temp_vent) if(!scrubber_turf) continue diff --git a/code/modules/events/vent_clog.dm b/code/modules/events/vent_clog.dm index ef8a3c5946f..31832bdfa94 100644 --- a/code/modules/events/vent_clog.dm +++ b/code/modules/events/vent_clog.dm @@ -12,7 +12,7 @@ . = ..() if(!.) return - for(var/obj/machinery/atmospherics/components/unary/vent_pump/vent in GLOB.machines) + for(var/obj/machinery/atmospherics/components/unary/vent_pump/vent as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/atmospherics/components/unary/vent_pump)) var/turf/vent_turf = get_turf(vent) if(vent_turf && is_station_level(vent_turf.z) && !vent.welded) return TRUE //make sure we have a valid vent to spawn from. @@ -89,7 +89,7 @@ /datum/round_event/vent_clog/proc/get_vent() var/list/vent_list = list() - for(var/obj/machinery/atmospherics/components/unary/vent_pump/vent in GLOB.machines) + for(var/obj/machinery/atmospherics/components/unary/vent_pump/vent as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/atmospherics/components/unary/vent_pump)) var/turf/vent_turf = get_turf(vent) if(vent_turf && is_station_level(vent_turf.z) && !vent.welded && !vent_turf.is_blocked_turf_ignore_climbable()) vent_list += vent diff --git a/code/modules/holiday/holidays.dm b/code/modules/holiday/holidays.dm index ec07f89ea52..1565bf74ba4 100644 --- a/code/modules/holiday/holidays.dm +++ b/code/modules/holiday/holidays.dm @@ -797,7 +797,7 @@ ) /datum/holiday/xmas/proc/roundstart_celebrate() - for(var/obj/machinery/computer/security/telescreen/entertainment/Monitor in GLOB.machines) + for(var/obj/machinery/computer/security/telescreen/entertainment/Monitor as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/computer/security/telescreen/entertainment)) Monitor.icon_state_on = "entertainment_xmas" for(var/mob/living/basic/pet/dog/corgi/ian/Ian in GLOB.mob_living_list) diff --git a/code/modules/industrial_lift/tram/tram_lift_master.dm b/code/modules/industrial_lift/tram/tram_lift_master.dm index c21ed7b7af1..ed031d3dd24 100644 --- a/code/modules/industrial_lift/tram/tram_lift_master.dm +++ b/code/modules/industrial_lift/tram/tram_lift_master.dm @@ -204,7 +204,7 @@ * The tram doors are in a list of airlocks and we apply the proc on that list. */ /datum/lift_master/tram/proc/update_tram_doors(action) - for(var/obj/machinery/door/window/tram/tram_door in GLOB.airlocks) + for(var/obj/machinery/door/window/tram/tram_door as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door/window/tram)) if(tram_door.associated_lift != specific_lift_id) continue set_door_state(tram_door, action) diff --git a/code/modules/mafia/controller.dm b/code/modules/mafia/controller.dm index 629e9453d7d..a0e5b26b5d9 100644 --- a/code/modules/mafia/controller.dm +++ b/code/modules/mafia/controller.dm @@ -414,7 +414,7 @@ GLOBAL_LIST_INIT(mafia_role_by_alignment, setup_mafia_role_by_alignment()) * * close: boolean, the state you want the curtains in. */ /datum/mafia_controller/proc/toggle_night_curtains(close) - for(var/obj/machinery/door/poddoor/D in GLOB.airlocks) //I really dislike pathing of these + for(var/obj/machinery/door/poddoor/D as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door/poddoor)) if(D.id != "mafia") //so as to not trigger shutters on station, lol continue if(close) diff --git a/code/modules/mapfluff/ruins/spaceruin_code/TheDerelict.dm b/code/modules/mapfluff/ruins/spaceruin_code/TheDerelict.dm index 642877e480b..3507cb7d947 100644 --- a/code/modules/mapfluff/ruins/spaceruin_code/TheDerelict.dm +++ b/code/modules/mapfluff/ruins/spaceruin_code/TheDerelict.dm @@ -75,7 +75,7 @@ ///Initializes airlock links. /obj/machinery/computer/vaultcontroller/proc/find_airlocks() - for(var/obj/machinery/door/airlock/A in GLOB.airlocks) + for(var/obj/machinery/door/airlock/A as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door/airlock)) if(A.id_tag == "derelictvault") if(!door1) door1 = A diff --git a/code/modules/mining/aux_base.dm b/code/modules/mining/aux_base.dm index d875d6b73c4..010437d9712 100644 --- a/code/modules/mining/aux_base.dm +++ b/code/modules/mining/aux_base.dm @@ -280,7 +280,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/computer/auxiliary_base, 32) var/turf/T = get_turf(user) var/obj/machinery/computer/auxiliary_base/AB - for (var/obj/machinery/computer/auxiliary_base/A in GLOB.machines) + for (var/obj/machinery/computer/auxiliary_base/A as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/computer/auxiliary_base)) if(is_station_level(A.z)) AB = A break @@ -362,7 +362,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/computer/auxiliary_base, 32) to_chat(user, span_warning("This device is only to be used in a mining zone.")) return var/obj/machinery/computer/auxiliary_base/aux_base_console - for(var/obj/machinery/computer/auxiliary_base/ABC in GLOB.machines) + for(var/obj/machinery/computer/auxiliary_base/ABC as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/computer/auxiliary_base)) if(get_dist(landing_spot, ABC) <= console_range) aux_base_console = ABC break diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 1500b364de4..d7a4ea71efe 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -284,7 +284,7 @@ /// Apply an emote to all AI status displays on the station /mob/living/silicon/ai/proc/apply_emote_display(emote) - for(var/obj/machinery/status_display/ai/ai_display as anything in GLOB.ai_status_displays) + for(var/obj/machinery/status_display/ai/ai_display as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/status_display/ai)) ai_display.emotion = emote ai_display.update() @@ -490,14 +490,14 @@ src << browse(last_tablet_note_seen, "window=show_tablet") //Carn: holopad requests if(href_list["jump_to_holopad"]) - var/obj/machinery/holopad/Holopad = locate(href_list["jump_to_holopad"]) in GLOB.machines + var/obj/machinery/holopad/Holopad = locate(href_list["jump_to_holopad"]) in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/holopad) if(Holopad) cam_prev = get_turf(eyeobj) eyeobj.setLoc(Holopad) else to_chat(src, span_notice("Unable to locate the holopad.")) if(href_list["project_to_holopad"]) - var/obj/machinery/holopad/Holopad = locate(href_list["project_to_holopad"]) in GLOB.machines + var/obj/machinery/holopad/Holopad = locate(href_list["project_to_holopad"]) in SSmachines.get_machines_by_type(/obj/machinery/holopad) if(Holopad) lastloc = get_turf(eyeobj) Holopad.attack_ai_secondary(src) //may as well recycle diff --git a/code/modules/modular_computers/computers/item/computer.dm b/code/modules/modular_computers/computers/item/computer.dm index c6c1775a550..0876fc56227 100644 --- a/code/modules/modular_computers/computers/item/computer.dm +++ b/code/modules/modular_computers/computers/item/computer.dm @@ -119,7 +119,6 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar /obj/item/modular_computer/Initialize(mapload) . = ..() - START_PROCESSING(SSobj, src) if(!physical) physical = src diff --git a/code/modules/modular_computers/computers/machinery/console_presets.dm b/code/modules/modular_computers/computers/machinery/console_presets.dm index 69d4f445ed0..00af9975e24 100644 --- a/code/modules/modular_computers/computers/machinery/console_presets.dm +++ b/code/modules/modular_computers/computers/machinery/console_presets.dm @@ -123,7 +123,7 @@ chatprogram.username = "cargo_requests_operator" var/datum/ntnet_conversation/cargochat = chatprogram.create_new_channel("#cargobus", strong = TRUE) - for(var/obj/machinery/modular_computer/preset/cargochat/cargochat_console in GLOB.machines) + for(var/obj/machinery/modular_computer/preset/cargochat/cargochat_console as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/modular_computer/preset/cargochat)) if(cargochat_console == src) continue var/datum/computer_file/program/chatclient/other_chatprograms = cargochat_console.cpu.find_file_by_name("ntnrc_client") diff --git a/code/modules/modular_computers/file_system/programs/alarm.dm b/code/modules/modular_computers/file_system/programs/alarm.dm index e1205f92c6a..c1aedb9d5d9 100644 --- a/code/modules/modular_computers/file_system/programs/alarm.dm +++ b/code/modules/modular_computers/file_system/programs/alarm.dm @@ -46,11 +46,3 @@ program_icon_state = "alert-red" ui_header = "alarm_red.gif" update_computer_icon() // Always update the icon after we check our conditional because we might've changed it - -/datum/computer_file/program/alarm_monitor/on_start(mob/user) - . = ..(user) - GLOB.alarmdisplay += src - -/datum/computer_file/program/alarm_monitor/kill_program() - GLOB.alarmdisplay -= src - return ..() diff --git a/code/modules/modular_computers/file_system/programs/bounty_board.dm b/code/modules/modular_computers/file_system/programs/bounty_board.dm index e24de13947a..cb7f6c288bb 100644 --- a/code/modules/modular_computers/file_system/programs/bounty_board.dm +++ b/code/modules/modular_computers/file_system/programs/bounty_board.dm @@ -127,7 +127,3 @@ if("bountyText") bounty_text = (params["bountytext"]) return TRUE - -/datum/computer_file/program/bounty_board/Destroy() - GLOB.allbountyboards -= computer - . = ..() diff --git a/code/modules/modular_computers/file_system/programs/radar.dm b/code/modules/modular_computers/file_system/programs/radar.dm index 2298daa8d37..06aefba487f 100644 --- a/code/modules/modular_computers/file_system/programs/radar.dm +++ b/code/modules/modular_computers/file_system/programs/radar.dm @@ -335,7 +335,7 @@ objects = list() // All the nukes - for(var/obj/machinery/nuclearbomb/nuke as anything in GLOB.nuke_list) + for(var/obj/machinery/nuclearbomb/nuke as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/nuclearbomb)) var/list/nuke_info = list( ref = REF(nuke), name = nuke.name, @@ -362,7 +362,7 @@ /datum/computer_file/program/radar/fission360/on_examine(obj/item/modular_computer/source, mob/user) var/list/examine_list = list() - for(var/obj/machinery/nuclearbomb/bomb as anything in GLOB.nuke_list) + for(var/obj/machinery/nuclearbomb/bomb as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/nuclearbomb)) if(bomb.timing) examine_list += span_danger("Extreme danger. Arming signal detected. Time remaining: [bomb.get_time_left()].") return examine_list diff --git a/code/modules/modular_computers/file_system/programs/sm_monitor.dm b/code/modules/modular_computers/file_system/programs/sm_monitor.dm index 814ae748e12..b95927417cd 100644 --- a/code/modules/modular_computers/file_system/programs/sm_monitor.dm +++ b/code/modules/modular_computers/file_system/programs/sm_monitor.dm @@ -34,7 +34,7 @@ var/turf/user_turf = get_turf(computer.ui_host()) if(!user_turf) return - for(var/obj/machinery/power/supermatter_crystal/sm in GLOB.machines) + for(var/obj/machinery/power/supermatter_crystal/sm as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/power/supermatter_crystal)) //Exclude Syndicate owned, Delaminating, not within coverage, not on a tile. if (!sm.include_in_cims || !isturf(sm.loc) || !(is_station_level(sm.z) || is_mining_level(sm.z) || sm.z == user_turf.z)) continue diff --git a/code/modules/paperwork/fax.dm b/code/modules/paperwork/fax.dm index eb8db0fbd28..69fd667b9d2 100644 --- a/code/modules/paperwork/fax.dm +++ b/code/modules/paperwork/fax.dm @@ -221,7 +221,7 @@ GLOBAL_VAR_INIT(nt_fax_department, pick("NT HR Department", "NT Legal Department /obj/machinery/fax/ui_data(mob/user) var/list/data = list() //Record a list of all existing faxes. - 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)) if(FAX.fax_id == fax_id) //skip yourself continue var/list/fax_data = list() @@ -327,7 +327,7 @@ GLOBAL_VAR_INIT(nt_fax_department, pick("NT HR Department", "NT Legal Department * * id - The network ID of the fax machine you want to send the item to. */ /obj/machinery/fax/proc/send(obj/item/loaded, id) - 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)) if (FAX.fax_id != id) continue if (FAX.jammed) @@ -447,7 +447,7 @@ GLOBAL_VAR_INIT(nt_fax_department, pick("NT HR Department", "NT Legal Department * * new_fax_name - The text of the name to be checked for a match. */ /obj/machinery/fax/proc/fax_name_exist(new_fax_name) - 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)) if (FAX.fax_name == new_fax_name) return TRUE return FALSE diff --git a/code/modules/paperwork/ticketmachine.dm b/code/modules/paperwork/ticketmachine.dm index eaffabe187b..90df8d4dc07 100644 --- a/code/modules/paperwork/ticketmachine.dm +++ b/code/modules/paperwork/ticketmachine.dm @@ -137,7 +137,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/ticket_machine, 32) /// Locate the ticket machine to which we're linked by our ID /obj/item/assembly/control/ticket_machine/proc/find_machine() - for(var/obj/machinery/ticket_machine/ticketsplease in GLOB.machines) + for(var/obj/machinery/ticket_machine/ticketsplease as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/ticket_machine)) if(ticketsplease.id == id) ticket_machine_ref = WEAKREF(ticketsplease) if(ticket_machine_ref) diff --git a/code/modules/power/apc/apc_main.dm b/code/modules/power/apc/apc_main.dm index 5d734e7f1a3..caa1043e558 100644 --- a/code/modules/power/apc/apc_main.dm +++ b/code/modules/power/apc/apc_main.dm @@ -213,11 +213,7 @@ AddElement(/datum/element/contextual_screentip_bare_hands, rmb_text = "Toggle interface lock") AddElement(/datum/element/contextual_screentip_mob_typechecks, hovering_mob_typechecks) - GLOB.apcs_list += src - /obj/machinery/power/apc/Destroy() - GLOB.apcs_list -= src - if(malfai && operating) malfai.malf_picker.processing_time = clamp(malfai.malf_picker.processing_time - 10, 0, 1000) disconnect_from_area() diff --git a/code/modules/power/singularity/singularity.dm b/code/modules/power/singularity/singularity.dm index 828181143cf..33c4ffe982c 100644 --- a/code/modules/power/singularity/singularity.dm +++ b/code/modules/power/singularity/singularity.dm @@ -66,7 +66,7 @@ expand(current_size) - for (var/obj/machinery/power/singularity_beacon/singu_beacon in GLOB.machines) + for (var/obj/machinery/power/singularity_beacon/singu_beacon as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/power/singularity_beacon)) if (singu_beacon.active) new_component.target = singu_beacon break diff --git a/code/modules/power/supermatter/supermatter_delamination/delamination_effects.dm b/code/modules/power/supermatter/supermatter_delamination/delamination_effects.dm index 019f411c052..1c3a0402ebe 100644 --- a/code/modules/power/supermatter/supermatter_delamination/delamination_effects.dm +++ b/code/modules/power/supermatter/supermatter_delamination/delamination_effects.dm @@ -114,7 +114,7 @@ // set supermatter cascade to true, to prevent auto evacuation due to no way of calling the shuttle SSshuttle.supermatter_cascade = TRUE // set hijack completion timer to infinity, so that you cant prematurely end the round with a hijack - for(var/obj/machinery/computer/emergency_shuttle/console in GLOB.machines) + for(var/obj/machinery/computer/emergency_shuttle/console as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/computer/emergency_shuttle)) console.hijack_completion_flight_time_set = INFINITY /* This logic is to keep uncalled shuttles uncalled @@ -158,7 +158,7 @@ if(SSsecurity_level.get_current_level_as_number() != SEC_LEVEL_DELTA) SSsecurity_level.set_level(SEC_LEVEL_DELTA) // skip the announcement and shuttle timer adjustment in set_security_level() make_maint_all_access() - for(var/obj/machinery/light/light_to_break in GLOB.machines) + for(var/obj/machinery/light/light_to_break as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/light)) if(prob(35)) light_to_break.set_major_emergency_light() continue diff --git a/code/modules/power/turbine/turbine_computer.dm b/code/modules/power/turbine/turbine_computer.dm index 791bca97397..8e8ba8deb4c 100644 --- a/code/modules/power/turbine/turbine_computer.dm +++ b/code/modules/power/turbine/turbine_computer.dm @@ -20,7 +20,7 @@ /obj/machinery/computer/turbine_computer/locate_machinery(multitool_connection) if(!mapping_id) return - for(var/obj/machinery/power/turbine/core_rotor/main in GLOB.machines) + for(var/obj/machinery/power/turbine/core_rotor/main as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/power/turbine/core_rotor)) if(main.mapping_id != mapping_id) continue register_machine(main) diff --git a/code/modules/projectiles/projectile/energy/net_snare.dm b/code/modules/projectiles/projectile/energy/net_snare.dm index be1f4b7a303..440ab9438e2 100644 --- a/code/modules/projectiles/projectile/energy/net_snare.dm +++ b/code/modules/projectiles/projectile/energy/net_snare.dm @@ -32,7 +32,7 @@ /obj/effect/nettingportal/Initialize(mapload) . = ..() var/obj/item/beacon/teletarget = null - for(var/obj/machinery/computer/teleporter/com in GLOB.machines) + for(var/obj/machinery/computer/teleporter/com as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/computer/teleporter)) var/atom/target = com.target_ref?.resolve() if(target) if(com.power_station && com.power_station.teleporter_hub && com.power_station.engaged) diff --git a/code/modules/requests/request_manager.dm b/code/modules/requests/request_manager.dm index 19a94a61dad..771cb4262a0 100644 --- a/code/modules/requests/request_manager.dm +++ b/code/modules/requests/request_manager.dm @@ -223,7 +223,7 @@ GLOBAL_DATUM_INIT(requests, /datum/request_manager, new) to_chat(usr, "You cannot set the nuke code for a non-nuke-code-request request!", confidential = TRUE) return TRUE var/code = random_nukecode() - for(var/obj/machinery/nuclearbomb/selfdestruct/SD in GLOB.nuke_list) + for(var/obj/machinery/nuclearbomb/selfdestruct/SD 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]\".") return TRUE diff --git a/code/modules/shuttle/assault_pod.dm b/code/modules/shuttle/assault_pod.dm index a40ba379323..609ef685a3f 100644 --- a/code/modules/shuttle/assault_pod.dm +++ b/code/modules/shuttle/assault_pod.dm @@ -54,7 +54,7 @@ landing_zone.height = height landing_zone.setDir(lz_dir) - for(var/obj/machinery/computer/shuttle/S in GLOB.machines) + for(var/obj/machinery/computer/shuttle/S in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/computer/shuttle)) if(S.shuttleId == shuttle_id) S.possible_destinations = "[landing_zone.shuttle_id]" diff --git a/code/modules/shuttle/battlecruiser_starfury.dm b/code/modules/shuttle/battlecruiser_starfury.dm index ce520aa1fca..ab1f6802d43 100644 --- a/code/modules/shuttle/battlecruiser_starfury.dm +++ b/code/modules/shuttle/battlecruiser_starfury.dm @@ -154,7 +154,7 @@ if(!team) team = new() - var/obj/machinery/nuclearbomb/selfdestruct/nuke = locate() in GLOB.nuke_list + var/obj/machinery/nuclearbomb/selfdestruct/nuke = SSmachines.get_machines_by_type(/obj/machinery/nuclearbomb/selfdestruct)[1] if(nuke.r_code == NUKE_CODE_UNSET) nuke.r_code = random_nukecode() team.nuke = nuke diff --git a/code/modules/shuttle/navigation_computer.dm b/code/modules/shuttle/navigation_computer.dm index bc1164f56b2..03777cd2d5b 100644 --- a/code/modules/shuttle/navigation_computer.dm +++ b/code/modules/shuttle/navigation_computer.dm @@ -30,7 +30,6 @@ /obj/machinery/computer/camera_advanced/shuttle_docker/Initialize(mapload) . = ..() - GLOB.navigation_computers += src actions += new /datum/action/innate/shuttledocker_rotate(src) actions += new /datum/action/innate/shuttledocker_place(src) @@ -50,8 +49,6 @@ /obj/machinery/computer/camera_advanced/shuttle_docker/Destroy() . = ..() - GLOB.navigation_computers -= src - if(my_port?.get_docked()) my_port.delete_after = TRUE my_port.shuttle_id = null diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index da26466c807..bb39a5d2cff 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -831,7 +831,7 @@ return ripple_turfs /obj/docking_port/mobile/proc/check_poddoors() - for(var/obj/machinery/door/poddoor/shuttledock/pod in GLOB.airlocks) + for(var/obj/machinery/door/poddoor/shuttledock/pod as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door/poddoor/shuttledock)) pod.check() /obj/docking_port/mobile/proc/dock_id(id) diff --git a/code/modules/station_goals/dna_vault.dm b/code/modules/station_goals/dna_vault.dm index e8e9a2ed404..03f69c2664c 100644 --- a/code/modules/station_goals/dna_vault.dm +++ b/code/modules/station_goals/dna_vault.dm @@ -55,12 +55,11 @@ /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 as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/dna_vault)) if(V.animal_dna.len >= animal_count && V.plant_dna.len >= plant_count && V.human_dna.len >= human_count) return TRUE return FALSE - /obj/machinery/dna_vault name = "DNA Vault" desc = "Break glass in case of apocalypse." diff --git a/code/modules/station_goals/meteor_shield.dm b/code/modules/station_goals/meteor_shield.dm index e856a4e2748..7b16606013b 100644 --- a/code/modules/station_goals/meteor_shield.dm +++ b/code/modules/station_goals/meteor_shield.dm @@ -43,10 +43,10 @@ /datum/station_goal/proc/get_coverage() var/list/coverage = list() - for(var/obj/machinery/satellite/meteor_shield/A in GLOB.machines) - if(!A.active || !is_station_level(A.z)) + for(var/obj/machinery/satellite/meteor_shield/shield_satt as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/satellite/meteor_shield)) + if(!shield_satt.active || !is_station_level(shield_satt.z)) continue - coverage |= view(A.kill_range,A) + coverage |= view(shield_satt.kill_range, shield_satt) return coverage.len /obj/machinery/satellite/meteor_shield diff --git a/modular_skyrat/modules/ammo_workbench/code/ammo_workbench.dm b/modular_skyrat/modules/ammo_workbench/code/ammo_workbench.dm index c78210776d1..e4123c61821 100644 --- a/modular_skyrat/modules/ammo_workbench/code/ammo_workbench.dm +++ b/modular_skyrat/modules/ammo_workbench/code/ammo_workbench.dm @@ -476,7 +476,6 @@ loaded_magazine.forceMove(loc) loaded_magazine = null - . = ..() return ..() /obj/machinery/ammo_workbench/proc/shock(mob/user, prb) diff --git a/modular_skyrat/modules/apc_arcing/apc.dm b/modular_skyrat/modules/apc_arcing/apc.dm index 39430a0e1fb..0084f573ee8 100644 --- a/modular_skyrat/modules/apc_arcing/apc.dm +++ b/modular_skyrat/modules/apc_arcing/apc.dm @@ -57,5 +57,5 @@ /// Set all APCs to start (or stop) arcing /proc/force_apc_arcing(force_mode = FALSE) - for(var/obj/machinery/power/apc/controller as anything in GLOB.apcs_list) + for(var/obj/machinery/power/apc/controller as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/power/apc)) controller.force_arcing = force_mode diff --git a/modular_skyrat/modules/autotransfer/code/transfer_vote.dm b/modular_skyrat/modules/autotransfer/code/transfer_vote.dm index 22759e713be..709c6369dc4 100644 --- a/modular_skyrat/modules/autotransfer/code/transfer_vote.dm +++ b/modular_skyrat/modules/autotransfer/code/transfer_vote.dm @@ -42,7 +42,7 @@ if(winning_option == CHOICE_TRANSFER) SSshuttle.autoEnd() - var/obj/machinery/computer/communications/comms_console = locate() in GLOB.machines + var/obj/machinery/computer/communications/comms_console = locate() in GLOB.shuttle_caller_list if(comms_console) comms_console.post_status("shuttle") return diff --git a/modular_skyrat/modules/clock_cult/code/structures/technologists_lectern.dm b/modular_skyrat/modules/clock_cult/code/structures/technologists_lectern.dm index 78b5281cec1..01ce5c1a309 100644 --- a/modular_skyrat/modules/clock_cult/code/structures/technologists_lectern.dm +++ b/modular_skyrat/modules/clock_cult/code/structures/technologists_lectern.dm @@ -415,7 +415,7 @@ priority_announce("A fatal power outage has occurred. Please ensure that all on-board devices are connected to an appropriate power generator.") apc_loop: - for(var/obj/machinery/power/apc/controller as anything in GLOB.apcs_list) + for(var/obj/machinery/power/apc/controller as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/power/apc)) var/area/apc_area = get_area(controller) // make sure that no "critical" APCs lose their power (SM, namely) for(var/turf/turf as anything in apc_area.contained_turfs) for(var/obj/machinery/depowered_machinery in turf) @@ -424,7 +424,7 @@ controller.cell?.charge = 0 - for(var/obj/machinery/power/smes/battery_pack in GLOB.machines) + for(var/obj/machinery/power/smes/battery_pack as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/power/smes)) battery_pack.charge = 0 GLOB.max_clock_power += 1500 // Extra bonus diff --git a/modular_skyrat/modules/cortical_borer/code/cortical_borer_antag.dm b/modular_skyrat/modules/cortical_borer/code/cortical_borer_antag.dm index 0c07c049d2b..5de312eb22a 100644 --- a/modular_skyrat/modules/cortical_borer/code/cortical_borer_antag.dm +++ b/modular_skyrat/modules/cortical_borer/code/cortical_borer_antag.dm @@ -112,7 +112,7 @@ /datum/round_event/ghost_role/cortical_borer/start() var/list/vents = list() - for(var/obj/machinery/atmospherics/components/unary/vent_pump/temp_vent in GLOB.machines) + for(var/obj/machinery/atmospherics/components/unary/vent_pump/temp_vent as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/atmospherics/components/unary/vent_pump)) if(QDELETED(temp_vent)) continue if(is_station_level(temp_vent.loc.z) && !temp_vent.welded) @@ -162,7 +162,7 @@ var/list/vents = list() /datum/dynamic_ruleset/midround/from_ghosts/cortical_borer/execute() - for(var/obj/machinery/atmospherics/components/unary/vent_pump/temp_vent in GLOB.machines) + for(var/obj/machinery/atmospherics/components/unary/vent_pump/temp_vent as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/atmospherics/components/unary/vent_pump)) if(QDELETED(temp_vent)) continue if(is_station_level(temp_vent.loc.z) && !temp_vent.welded) diff --git a/modular_skyrat/modules/ices_events/code/events/ev_scrubbers.dm b/modular_skyrat/modules/ices_events/code/events/ev_scrubbers.dm index e18fa009c6d..9d3b25a6c97 100644 --- a/modular_skyrat/modules/ices_events/code/events/ev_scrubbers.dm +++ b/modular_skyrat/modules/ices_events/code/events/ev_scrubbers.dm @@ -56,7 +56,7 @@ ) /datum/round_event/scrubber_overflow/ices/setup() - for(var/obj/machinery/atmospherics/components/unary/vent_scrubber/temp_vent in GLOB.machines) + for(var/obj/machinery/atmospherics/components/unary/vent_scrubber/temp_vent as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/atmospherics/components/unary/vent_scrubber)) var/turf/scrubber_turf = get_turf(temp_vent) var/area/scrubber_area = get_area(temp_vent) if(!scrubber_turf)