Machine list is now stored in SSmachines | Remove excessive use of global lists for specific machine types (#76822)

## About The Pull Request

Removes all of the duplicate global lists for specific machine types
where the only thing they do is store all machines of that type.
Adds machine tracking to SSmachines in the form of a list for all
machines, and then an associative list for machines by their type.
Previously we have machines in multiple global lists, such as airlocks
being in GLOB.doors, GLOB.airlocks, GLOB.machines.
This makes that not a thing, and also means that iterating through
GLOB.machines looking for a specific type is no longer as expensive.
This commit is contained in:
Zephyr
2023-07-15 16:17:46 -04:00
committed by GitHub
parent c1c41a0b22
commit f71ea26f72
82 changed files with 259 additions and 246 deletions
@@ -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 ..()
@@ -127,7 +127,3 @@
if("bountyText")
bounty_text = (params["bountytext"])
return TRUE
/datum/computer_file/program/bounty_board/Destroy()
GLOB.allbountyboards -= computer
. = ..()
@@ -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
@@ -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