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
@@ -505,7 +505,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
//If we hit the limit without finding a valid one, then the best one we found is selected
var/list/found_vents = list()
for(var/obj/machinery/atmospherics/unary/vent_pump/v in machines)
for(var/obj/machinery/atmospherics/unary/vent_pump/v in SSmachinery.processing_machines)
if(!v.welded && v.z == ZLevel)
found_vents.Add(v)
+13 -6
View File
@@ -938,8 +938,11 @@
src.verbs -= /mob/living/carbon/human/proc/remotesay
return
var/list/creatures = list()
for(var/mob/living/carbon/h in world)
creatures += h
for(var/hh in human_mob_list)
var/mob/living/carbon/human/H = hh
if (H.client)
creatures += hh
var/mob/target = input("Who do you want to project your mind to ?") as null|anything in creatures
if (isnull(target))
return
@@ -951,7 +954,7 @@
target.show_message("<span class='notice'>You hear a voice that seems to echo around the room: [say]</span>")
usr.show_message("<span class='notice'>You project your mind into [target.real_name]: [say]</span>")
log_say("[key_name(usr)] sent a telepathic message to [key_name(target)]: [say]",ckey=key_name(usr))
for(var/mob/dead/observer/G in world)
for(var/mob/dead/observer/G in dead_mob_list)
G.show_message("<i>Telepathic message from <b>[src]</b> to <b>[target]</b>: [say]</i>")
/mob/living/carbon/human/proc/remoteobserve()
@@ -976,9 +979,13 @@
var/list/mob/creatures = list()
for(var/mob/living/carbon/h in world)
var/turf/temp_turf = get_turf(h)
if((temp_turf.z != 1 && temp_turf.z != 5) || h.stat!=CONSCIOUS) //Not on mining or the station. Or dead
for(var/h in human_mob_list)
var/mob/living/carbon/human/H = h
if (!H.client)
continue
var/turf/temp_turf = get_turf(H)
if((temp_turf.z != 1 && temp_turf.z != 5) || H.stat!=CONSCIOUS) //Not on mining or the station. Or dead
continue
creatures += h
+1 -1
View File
@@ -393,7 +393,7 @@ var/list/ai_verbs_default = list(
// hack to display shuttle timer
if(emergency_shuttle.online())
var/obj/machinery/computer/communications/C = locate() in machines
var/obj/machinery/computer/communications/C = locate() in SSmachinery.processing_machines
if(C)
C.post_status("shuttle")
+2 -2
View File
@@ -17,8 +17,8 @@
client.screen.Add( blind, flash )
if(stat != DEAD)
for(var/obj/machinery/ai_status_display/O in machines) //change status
for(var/obj/machinery/ai_status_display/O in SSmachinery.all_status_displays) //change status
O.mode = 1
O.emotion = "Neutral"
src.view_core()
return
return
@@ -28,7 +28,7 @@
var/dat
dat += "<B>Maintenance Units</B><BR>"
for(var/mob/living/silicon/robot/drone/D in world)
for(var/mob/living/silicon/robot/drone/D in silicon_mob_list)
if(D.z != src.z)
continue
dat += "<BR>[D.real_name] ([D.stat == 2 ? "<font color='red'>INACTIVE</FONT>" : "<font color='green'>ACTIVE</FONT>"])"
@@ -70,7 +70,7 @@
else if (href_list["ping"])
usr << "<span class='notice'>You issue a maintenance request for all active drones, highlighting [drone_call_area].</span>"
for(var/mob/living/silicon/robot/drone/D in world)
for(var/mob/living/silicon/robot/drone/D in silicon_mob_list)
if(D.client && D.stat == 0)
D << "-- Maintenance drone presence requested in: [drone_call_area]."
@@ -1,6 +1,6 @@
/proc/count_drones()
var/drones = 0
for(var/mob/living/silicon/robot/drone/D in world)
for(var/mob/living/silicon/robot/drone/D in silicon_mob_list)
if(D.key && D.client)
drones++
return drones
@@ -75,9 +75,9 @@
flick("h_lathe_leave",src)
time_last_drone = world.time
if(player.mob && player.mob.mind)
if(player.mob && player.mob.mind)
player.mob.mind.reset()
var/mob/living/silicon/robot/drone/new_drone = new drone_type(get_turf(src))
new_drone.transfer_personality(player)
new_drone.master_fabricator = src
@@ -110,7 +110,7 @@
if(!fabricator)
var/list/all_fabricators = list()
for(var/obj/machinery/drone_fabricator/DF in machines)
for(var/obj/machinery/drone_fabricator/DF in SSmachinery.all_machines)
if((DF.stat & NOPOWER) || !DF.produce_drones || DF.drone_progress < 100)
continue
all_fabricators[DF.fabricator_tag] = DF
@@ -54,7 +54,7 @@
user << "The [src] is empty. Put something inside it first."
if(response == "Sync")
var/success = 0
for(var/obj/machinery/r_n_d/server/S in machines)
for(var/obj/machinery/r_n_d/server/S in SSmachinery.all_machines)
for(var/datum/tech/T in files.known_tech) //Uploading
S.files.AddTech2Known(T)
for(var/datum/tech/T in S.files.known_tech) //Downloading