mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-21 07:32:02 +00:00
Removes a whole bunch of in world loops. Reworks SSmachinery to hold two lists: all_machines and processing_machines. all_machines contains all machines 5ever. All of them. Literally. Forever. And ever. processing_machines only contains machines that process with the SSmachinery controller. I checked most types at runtime on the live server to see whether they're in processing_machines or in all_machines, and did debug to ensure that most machinery ends up and stays in all_machines. Includes a basic UT to make sure all mapped in machinery types remain within the all_machines list post-init.
34 lines
1.0 KiB
Plaintext
34 lines
1.0 KiB
Plaintext
/**
|
|
* Tests whether or not all mapped in machinery appear in the SSmachinery.all_machines
|
|
* list after round start.
|
|
*
|
|
* It's not exactly the most robust, but it'll catch basic faults in new machinery
|
|
* design.
|
|
*/
|
|
/datum/unit_test/machinery_global_test
|
|
name = "OBJECTS: Machinery Global List Test"
|
|
|
|
/datum/unit_test/machinery_global_test/start_test()
|
|
var/list/all_types = list()
|
|
var/list/unfound_types = list()
|
|
|
|
for (var/obj/machinery/M in world)
|
|
if (!SSmachinery.all_machines[M] && !QDELETED(M))
|
|
if (!unfound_types[M.type])
|
|
unfound_types[M.type] = 1
|
|
else
|
|
unfound_types[M.type]++
|
|
|
|
if (!all_types[M.type])
|
|
all_types[M.type] = 1
|
|
|
|
if (unfound_types.len)
|
|
for (var/t in unfound_types)
|
|
log_unit_test("[ascii_red]--------------- [unfound_types[t]] instances of [t] not found in SSmachinery.all_machines.")
|
|
|
|
fail("\[[unfound_types.len] / [all_types.len]\] mapped in machinery types were not found in SSmachinery.all_machines.")
|
|
else
|
|
pass("All \[[all_types.len]\] mapped in machinery types were found in SSmachinery.all_machines.")
|
|
|
|
return 1
|