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

@@ -173,96 +173,6 @@
else
alert("Invalid mob")
/*
/client/proc/cmd_admin_monkeyize(var/mob/M in world)
set category = "Fun"
set name = "Make Monkey"
if(!ticker)
alert("Wait until the game starts")
return
if(istype(M, /mob/living/carbon/human))
var/mob/living/carbon/human/target = M
log_admin("[key_name(src)] is attempting to monkeyize [M.key].")
spawn(10)
target.monkeyize()
else
alert("Invalid mob")
/client/proc/cmd_admin_changelinginize(var/mob/M in world)
set category = "Fun"
set name = "Make Changeling"
if(!ticker)
alert("Wait until the game starts")
return
if(istype(M, /mob/living/carbon/human))
log_admin("[key_name(src)] has made [M.key] a changeling.")
spawn(10)
M.absorbed_dna[M.real_name] = M.dna.Clone()
M.make_changeling()
if(M.mind)
M.mind.special_role = "Changeling"
else
alert("Invalid mob")
*/
/*
/client/proc/cmd_admin_abominize(var/mob/M in world)
set category = null
set name = "Make Abomination"
usr << "Ruby Mode disabled. Command aborted."
return
if(!ticker)
alert("Wait until the game starts.")
return
if(istype(M, /mob/living/carbon/human))
log_admin("[key_name(src)] has made [M.key] an abomination.")
// spawn(10)
// M.make_abomination()
*/
/*
/client/proc/make_cultist(var/mob/M in world) // -- TLE, modified by Urist
set category = "Fun"
set name = "Make Cultist"
set desc = "Makes target a cultist"
if(!cultwords["travel"])
runerandom()
if(M)
if(M.mind in ticker.mode.cult)
return
else
if(alert("Spawn that person a tome?",,"Yes","No")=="Yes")
M << "<font color='red'>You catch a glimpse of the Realm of Nar-Sie, The Geometer of Blood. You now see how flimsy the world is, you see that it should be open to the knowledge of Nar-Sie. A tome, a message from your new master, appears on the ground.</font>"
new /obj/item/weapon/book/tome(M.loc)
else
M << "<font color='red'>You catch a glimpse of the Realm of Nar-Sie, The Geometer of Blood. You now see how flimsy the world is, you see that it should be open to the knowledge of Nar-Sie.</font>"
var/glimpse=pick("1","2","3","4","5","6","7","8")
switch(glimpse)
if("1")
M << "<font color='red'>You remembered one thing from the glimpse... [cultwords["travel"]] is travel...</font>"
if("2")
M << "<font color='red'>You remembered one thing from the glimpse... [cultwords["blood"]] is blood...</font>"
if("3")
M << "<font color='red'>You remembered one thing from the glimpse... [cultwords["join"]] is join...</font>"
if("4")
M << "<font color='red'>You remembered one thing from the glimpse... [cultwords["hell"]] is Hell...</font>"
if("5")
M << "<font color='red'>You remembered one thing from the glimpse... [cultwords["destroy"]] is destroy...</font>"
if("6")
M << "<font color='red'>You remembered one thing from the glimpse... [cultwords["technology"]] is technology...</font>"
if("7")
M << "<font color='red'>You remembered one thing from the glimpse... [cultwords["self"]] is self...</font>"
if("8")
M << "<font color='red'>You remembered one thing from the glimpse... [cultwords["see"]] is see...</font>"
if(M.mind)
M.mind.special_role = "Cultist"
ticker.mode.cult += M.mind
src << "Made [M] a cultist."
*/
//TODO: merge the vievars version into this or something maybe mayhaps
/client/proc/cmd_debug_del_all()
@@ -273,7 +183,7 @@
var/blocked = list(/obj, /mob, /mob/living, /mob/living/carbon, /mob/living/carbon/human, /mob/observer/dead, /mob/living/silicon, /mob/living/silicon/robot, /mob/living/silicon/ai)
var/hsbitem = input(usr, "Choose an object to delete.", "Delete:") as null|anything in typesof(/obj) + typesof(/mob) - blocked
if(hsbitem)
for(var/atom/O in world)
for(var/atom/O in all_atoms)
if(istype(O, hsbitem))
qdel(O)
log_admin("[key_name(src)] has deleted all instances of [hsbitem].")
@@ -431,41 +341,41 @@
var/list/areas_with_intercom = list()
var/list/areas_with_camera = list()
for(var/area/A in world)
for(var/area/A in all_areas)
if(!(A.type in areas_all))
areas_all.Add(A.type)
for(var/obj/machinery/power/apc/APC in world)
for(var/obj/machinery/power/apc/APC in machines)
var/area/A = get_area(APC)
if(!(A.type in areas_with_APC))
areas_with_APC.Add(A.type)
for(var/obj/machinery/alarm/alarm in world)
for(var/obj/machinery/alarm/alarm in machines)
var/area/A = get_area(alarm)
if(!(A.type in areas_with_air_alarm))
areas_with_air_alarm.Add(A.type)
for(var/obj/machinery/requests_console/RC in world)
for(var/obj/machinery/requests_console/RC in machines)
var/area/A = get_area(RC)
if(!(A.type in areas_with_RC))
areas_with_RC.Add(A.type)
for(var/obj/machinery/light/L in world)
for(var/obj/machinery/light/L in machines)
var/area/A = get_area(L)
if(!(A.type in areas_with_light))
areas_with_light.Add(A.type)
for(var/obj/machinery/light_switch/LS in world)
for(var/obj/machinery/light_switch/LS in machines)
var/area/A = get_area(LS)
if(!(A.type in areas_with_LS))
areas_with_LS.Add(A.type)
for(var/obj/item/device/radio/intercom/I in world)
for(var/obj/item/device/radio/intercom/I in machines)
var/area/A = get_area(I)
if(!(A.type in areas_with_intercom))
areas_with_intercom.Add(A.type)
for(var/obj/machinery/camera/C in world)
for(var/obj/machinery/camera/C in machines)
var/area/A = get_area(C)
if(!(A.type in areas_with_camera))
areas_with_camera.Add(A.type)
@@ -546,31 +456,31 @@
if(alert("Are you sure? This will start up the engine. Should only be used during debug!",,"Yes","No") != "Yes")
return
for(var/obj/machinery/power/emitter/E in world)
for(var/obj/machinery/power/emitter/E in machines)
if(istype(get_area(E), /area/space))
E.anchored = TRUE
E.state = 2
E.connect_to_network()
E.active = TRUE
for(var/obj/machinery/field_generator/F in world)
for(var/obj/machinery/field_generator/F in machines)
if(istype(get_area(F), /area/space))
F.Varedit_start = 1
for(var/obj/machinery/power/grounding_rod/GR in world)
for(var/obj/machinery/power/grounding_rod/GR in machines)
GR.anchored = TRUE
GR.update_icon()
for(var/obj/machinery/power/tesla_coil/TC in world)
for(var/obj/machinery/power/tesla_coil/TC in machines)
TC.anchored = TRUE
TC.update_icon()
for(var/obj/structure/particle_accelerator/PA in world)
for(var/obj/structure/particle_accelerator/PA in machines)
PA.anchored = TRUE
PA.construction_state = 3
PA.update_icon()
for(var/obj/machinery/particle_accelerator/PA in world)
for(var/obj/machinery/particle_accelerator/PA in machines)
PA.anchored = TRUE
PA.construction_state = 3
PA.update_icon()
for(var/obj/machinery/power/rad_collector/Rad in world)
for(var/obj/machinery/power/rad_collector/Rad in machines)
if(Rad.anchored)
if(!Rad.P)
var/obj/item/weapon/tank/phoron/Phoron = new/obj/item/weapon/tank/phoron(Rad)
@@ -597,7 +507,7 @@
var/found_the_pump = 0
var/obj/machinery/power/supermatter/SM
for(var/obj/machinery/M in world)
for(var/obj/machinery/M in machines)
if(!M)
continue
if(!M.loc)