diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm
index 43454f3bd4..97e3669dc0 100644
--- a/code/modules/admin/verbs/debug.dm
+++ b/code/modules/admin/verbs/debug.dm
@@ -514,6 +514,7 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
set category = "Mapping"
set name = "Test Areas"
+ var/list/dat = list()
var/list/areas_all = list()
var/list/areas_with_APC = list()
var/list/areas_with_multiple_APCs = list()
@@ -525,6 +526,9 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
var/list/areas_with_camera = list()
var/list/station_areas_blacklist = typecacheof(list(/area/holodeck/rec_center, /area/shuttle, /area/engine/supermatter, /area/science/test_area, /area/space, /area/solar, /area/mine, /area/ruin))
+ if(on_station)
+ dat += "Only checking areas on station z-levels.
"
+
for(var/area/A in world)
if(on_station)
var/turf/picked = safepick(get_area_turfs(A.type))
@@ -536,6 +540,9 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
for(var/obj/machinery/power/apc/APC in GLOB.apcs_list)
var/area/A = APC.area
+ if(!A) //This is usually an indicator that the machines subsystem hasn't finished initializing.
+ dat += "Skipped over [APC] in invalid location, [APC.loc]. Game likely hasn't finished setting up yet.
"
+ continue
if(!(A.type in areas_with_APC))
areas_with_APC.Add(A.type)
else if(A.type in areas_all)
@@ -543,31 +550,49 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
for(var/obj/machinery/airalarm/AA in GLOB.machines)
var/area/A = get_area(AA)
+ if(!A) //Make sure the target isn't inside an object, which results in runtimes.
+ dat += "Skipped over [AA] in invalid location, [AA.loc].
"
+ continue
if(!(A.type in areas_with_air_alarm))
areas_with_air_alarm.Add(A.type)
for(var/obj/machinery/requests_console/RC in GLOB.machines)
var/area/A = get_area(RC)
+ if(!A)
+ dat += "Skipped over [RC] in invalid location, [RC.loc].
"
+ continue
if(!(A.type in areas_with_RC))
areas_with_RC.Add(A.type)
for(var/obj/machinery/light/L in GLOB.machines)
var/area/A = get_area(L)
+ if(!A)
+ dat += "Skipped over [L] in invalid location, [L.loc].
"
+ continue
if(!(A.type in areas_with_light))
areas_with_light.Add(A.type)
for(var/obj/machinery/light_switch/LS in GLOB.machines)
var/area/A = get_area(LS)
+ if(!A)
+ dat += "Skipped over [LS] in invalid location, [LS.loc].
"
+ continue
if(!(A.type in areas_with_LS))
areas_with_LS.Add(A.type)
for(var/obj/item/device/radio/intercom/I in GLOB.machines)
var/area/A = get_area(I)
+ if(!A)
+ dat += "Skipped over [I] in invalid location, [I.loc].
"
+ continue
if(!(A.type in areas_with_intercom))
areas_with_intercom.Add(A.type)
for(var/obj/machinery/camera/C in GLOB.machines)
var/area/A = get_area(C)
+ if(!A)
+ dat += "Skipped over [C] in invalid location, [C.loc].
"
+ continue
if(!(A.type in areas_with_camera))
areas_with_camera.Add(A.type)
@@ -580,47 +605,52 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
var/list/areas_without_camera = areas_all - areas_with_camera
if(areas_without_APC.len)
- to_chat(world, "AREAS WITHOUT AN APC:")
+ dat += "