Remove a whole bunch of in world loops and rework machinery global lists (#3053)

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.
This commit is contained in:
skull132
2017-07-16 20:32:33 +03:00
committed by GitHub
parent 4645af8dcb
commit 0fc67f2cb9
70 changed files with 237 additions and 176 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ proc/cardinalrange(var/center)
controllerscan()
return
link_control(AMC)
remove_machine(src)
remove_machine(src, FALSE)
if (mapload)
. = INITIALIZE_HINT_LATELOAD
else
+1 -1
View File
@@ -124,7 +124,7 @@
for(var/area/A in gravity_generator:localareas)
var/obj/machinery/gravity_generator/G
for(G in machines)
for(G in SSmachinery.processing_machines)
if((A in G.localareas) && (G.on))
break
if(!G)
@@ -312,7 +312,7 @@ field_generator power level display
//I want to avoid using global variables.
spawn(1)
var/temp = 1 //stops spam
for(var/obj/singularity/O in machines)
for(var/obj/singularity/O in SSmachinery.processing_machines)
if(O.last_warning && temp)
if((world.time - O.last_warning) > 50) //to stop message-spam
temp = 0
@@ -39,7 +39,7 @@
..()
START_PROCESSING(SScalamity, src)
for(var/obj/machinery/power/singularity_beacon/singubeacon in machines)
for(var/obj/machinery/power/singularity_beacon/singubeacon in SSmachinery.processing_machines)
if(singubeacon.active)
target = singubeacon
break
@@ -516,4 +516,4 @@
/obj/singularity/proc/zMove(direction)
var/turf/destination = (direction == UP) ? GetAbove(src) : GetBelow(src)
if(destination)
forceMove(destination)
forceMove(destination)
+2 -2
View File
@@ -219,11 +219,11 @@
/obj/machinery/computer/turbine_computer/New()
..()
spawn(5)
for(var/obj/machinery/compressor/C in machines)
for(var/obj/machinery/compressor/C in SSmachinery.all_machines)
if(id == C.comp_id)
compressor = C
doors = new /list()
for(var/obj/machinery/door/blast/P in machines)
for(var/obj/machinery/door/blast/P in SSmachinery.all_machines)
if(P.id == id)
doors += P