for(var/bad_code in world)

Removes a very large amount of world loops.
Adds a macro to painlessly generate a global list, and the needed code to modify the list when an object is made or deleted automatically.
Cleans up some commented out code.
This commit is contained in:
Neerti
2018-04-29 17:55:04 -04:00
parent 81c19c62a3
commit be73b8c36a
103 changed files with 274 additions and 403 deletions

View File

@@ -32,7 +32,7 @@
/datum/event/escaped_slimes/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 machines)
if(temp_vent.network && temp_vent.loc.z in using_map.station_levels) //borrowed from spiders event, but it works. Distribute the slimes only in rooms with vents
vents += temp_vent

View File

@@ -16,7 +16,7 @@
/datum/event/gravity/start()
gravity_is_on = 0
for(var/area/A in world)
for(var/area/A in all_areas)
if(A.z in zLevels)
A.gravitychange(gravity_is_on, A)
@@ -24,7 +24,7 @@
if(!gravity_is_on)
gravity_is_on = 1
for(var/area/A in world)
for(var/area/A in all_areas)
if(A.z in zLevels)
A.gravitychange(gravity_is_on, A)

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/law = target.generate_ion_law()
target << "<font color='red'><b>You have detected a change in your laws information:</b></font>"
target << law
@@ -30,7 +30,7 @@
/datum/event/ionstorm/tick()
if(botEmagChance)
for(var/mob/living/bot/bot in world)
for(var/mob/living/bot/bot in mob_list)
if(prob(botEmagChance))
bot.emag_act(1)
@@ -146,7 +146,7 @@ Would like to add a law like "Law x is _______" where x = a number, and _____ is
M.add_ion_law("THE STATION IS [who2pref] [who2]")
if(botEmagChance)
for(var/obj/machinery/bot/bot in world)
for(var/obj/machinery/bot/bot in mob_list)
if(prob(botEmagChance))
bot.Emag()
*/
@@ -162,21 +162,21 @@ Would like to add a law like "Law x is _______" where x = a number, and _____ is
spawn(0)
world << "Started processing APCs"
for (var/obj/machinery/power/apc/APC in world)
for (var/obj/machinery/power/apc/APC in machines)
if(APC.z in station_levels)
APC.ion_act()
apcnum++
world << "Finished processing APCs. Processed: [apcnum]"
spawn(0)
world << "Started processing SMES"
for (var/obj/machinery/power/smes/SMES in world)
for (var/obj/machinery/power/smes/SMES in machines)
if(SMES.z in station_levels)
SMES.ion_act()
smesnum++
world << "Finished processing SMES. Processed: [smesnum]"
spawn(0)
world << "Started processing AIRLOCKS"
for (var/obj/machinery/door/airlock/D in world)
for (var/obj/machinery/door/airlock/D in machines)
if(D.z in station_levels)
//if(length(D.req_access) > 0 && !(12 in D.req_access)) //not counting general access and maintenance airlocks
airlocknum++
@@ -185,7 +185,7 @@ Would like to add a law like "Law x is _______" where x = a number, and _____ is
world << "Finished processing AIRLOCKS. Processed: [airlocknum]"
spawn(0)
world << "Started processing FIREDOORS"
for (var/obj/machinery/door/firedoor/D in world)
for (var/obj/machinery/door/firedoor/D in machines)
if(D.z in station_levels)
firedoornum++;
spawn(0)

View File

@@ -20,7 +20,7 @@
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 machines)
if(!MS.active) continue
MS.send_rc_message("Head of Personnel's Desk", my_department, message, "", "", 2)
@@ -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 machines)
if(!MS.active) continue
MS.send_rc_message("Head of Personnel's Desk", my_department, message, "", "", 2)

View File

@@ -41,14 +41,14 @@
/datum/event/prison_break/start()
for(var/area/A in world)
for(var/area/A in all_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 [stationtime2text()]. Systems will be fully compromised within approximately three minutes. Direct intervention is required immediately.<br>"
for(var/obj/machinery/message_server/MS in world)
for(var/obj/machinery/message_server/MS in 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>"

View File

@@ -16,7 +16,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 machines)
if(!temp_vent.welded && temp_vent.network && temp_vent.loc.z in using_map.station_levels)
if(temp_vent.network.normal_members.len > 50)
vents += temp_vent