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
@@ -12,7 +12,7 @@
/datum/event/brand_intelligence/start()
for(var/obj/machinery/vending/V in machines)
for(var/obj/machinery/vending/V in SSmachinery.processing_machines)
if(isNotStationLevel(V.z)) continue
vendingMachines.Add(V)
+2 -2
View File
@@ -12,7 +12,7 @@
continue
players += player.real_name
for (var/mob/living/silicon/ai/target in world)
for (var/mob/living/silicon/ai/target in silicon_mob_list)
var/random_player = "The Captain"
if(players.len)
random_player = pick(players) //Random player's name, to be used in laws.
@@ -88,7 +88,7 @@
/datum/event/ionstorm/tick()
if(botEmagChance)
for(var/obj/machinery/bot/bot in world)
for(var/obj/machinery/bot/bot in SSmachinery.all_machines)
if(prob(botEmagChance))
bot.emag_act(1)
+4 -4
View File
@@ -19,11 +19,11 @@
without intervention this attack will succeed in approximately 10 minutes. Required intervention: temporary suspension of affected accounts until the attack has ceased. \
Notifications will be sent as updates occur.<br>"
var/my_department = "[station_name()] firewall subroutines"
for(var/obj/machinery/message_server/MS in world)
for(var/obj/machinery/message_server/MS in SSmachinery.processing_machines)
if(!MS.active) continue
MS.send_rc_message("Head of Personnel's Desk", my_department, message, "", "", 2)
/datum/event/money_hacker/tick()
if(world.time >= end_time)
@@ -62,6 +62,6 @@
var/my_department = "[station_name()] firewall subroutines"
for(var/obj/machinery/message_server/MS in world)
for(var/obj/machinery/message_server/MS in SSmachinery.processing_machines)
if(!MS.active) continue
MS.send_rc_message("Head of Personnel's Desk", my_department, message, "", "", 2)
+3 -3
View File
@@ -6,7 +6,7 @@
var/list/area/areas = list() //List of areas to affect. Filled by start()
ic_name = "an imprisonment system virus"
no_fake = 1
var/eventDept = "Security" //Department name in announcement
var/list/areaName = list("Brig") //Names of areas mentioned in AI and Engineering announcements
var/list/areaType = list(/area/security/prison, /area/security/brig) //Area types to include.
@@ -43,14 +43,14 @@
/datum/event/prison_break/start()
for(var/area/A in world)
for(var/area/A in the_station_areas)
if(is_type_in_list(A,areaType) && !is_type_in_list(A,areaNotType))
areas += A
if(areas && areas.len > 0)
var/my_department = "[station_name()] firewall subroutines"
var/rc_message = "An unknown malicious program has been detected in the [english_list(areaName)] lighting and airlock control systems at [worldtime2text()]. Systems will be fully compromised within approximately three minutes. Direct intervention is required immediately.<br>"
for(var/obj/machinery/message_server/MS in machines)
for(var/obj/machinery/message_server/MS in SSmachinery.processing_machines)
MS.send_rc_message("Engineering", my_department, rc_message, "", "", 2)
for(var/mob/living/silicon/ai/A in player_list)
A << "<span class='danger'>Malicious program detected in the [english_list(areaName)] lighting and airlock control systems by [my_department].</span>"
+1 -1
View File
@@ -17,7 +17,7 @@
/datum/event/spider_infestation/start()
var/list/vents = list()
for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in world)
for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in SSmachinery.processing_machines)
if(!temp_vent.welded && temp_vent.network && temp_vent.loc.z in config.station_levels)
if(temp_vent.network.normal_members.len > 50)
vents += temp_vent
+1 -1
View File
@@ -13,7 +13,7 @@
/datum/event/vent_clog/setup()
endWhen = rand(25, 100)
for(var/obj/machinery/atmospherics/unary/vent_scrubber/temp_vent in machines)
for(var/obj/machinery/atmospherics/unary/vent_scrubber/temp_vent in SSmachinery.processing_machines)
if(!temp_vent)
continue
if(temp_vent.z in config.station_levels)//STATION ZLEVEL