From f54854bca88eee3e154071707fd31ebef61dcb65 Mon Sep 17 00:00:00 2001 From: ShizCalev Date: Mon, 8 Jan 2018 05:39:00 -0500 Subject: [PATCH 1/2] Updates test areas debug command (#34074) * Sanity check for test areas debug command * Shifted to popup window --- code/modules/admin/verbs/debug.dm | 64 +++++++++++++++++++++++-------- 1 file changed, 47 insertions(+), 17 deletions(-) diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 0fe79e10de..6b00081be0 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -507,6 +507,7 @@ GLOBAL_PROTECT(LastAdminCalledProc) 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() @@ -518,6 +519,9 @@ GLOBAL_PROTECT(LastAdminCalledProc) 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)) @@ -529,6 +533,9 @@ GLOBAL_PROTECT(LastAdminCalledProc) 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) @@ -536,31 +543,49 @@ GLOBAL_PROTECT(LastAdminCalledProc) 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) @@ -573,47 +598,52 @@ GLOBAL_PROTECT(LastAdminCalledProc) var/list/areas_without_camera = areas_all - areas_with_camera if(areas_without_APC.len) - to_chat(world, "AREAS WITHOUT AN APC:") + dat += "

AREAS WITHOUT AN APC:

" for(var/areatype in areas_without_APC) - to_chat(world, "* [areatype]") + dat += "[areatype]
" if(areas_with_multiple_APCs.len) - to_chat(world, "AREAS WITH MULTIPLE APCS:") + dat += "

AREAS WITH MULTIPLE APCS:

" for(var/areatype in areas_with_multiple_APCs) - to_chat(world,"* [areatype]") + dat += "[areatype]
" if(areas_without_air_alarm.len) - to_chat(world, "AREAS WITHOUT AN AIR ALARM:") + dat += "

AREAS WITHOUT AN AIR ALARM:

" for(var/areatype in areas_without_air_alarm) - to_chat(world, "* [areatype]") + dat += "[areatype]
" if(areas_without_RC.len) - to_chat(world, "AREAS WITHOUT A REQUEST CONSOLE:") + dat += "

AREAS WITHOUT A REQUEST CONSOLE:

" for(var/areatype in areas_without_RC) - to_chat(world, "* [areatype]") + dat += "[areatype]
" if(areas_without_light.len) - to_chat(world, "AREAS WITHOUT ANY LIGHTS:") + dat += "

AREAS WITHOUT ANY LIGHTS:

" for(var/areatype in areas_without_light) - to_chat(world, "* [areatype]") + dat += "[areatype]
" if(areas_without_LS.len) - to_chat(world, "AREAS WITHOUT A LIGHT SWITCH:") + dat += "

AREAS WITHOUT A LIGHT SWITCH:

" for(var/areatype in areas_without_LS) - to_chat(world, "* [areatype]") + dat += "[areatype]
" if(areas_without_intercom.len) - to_chat(world, "AREAS WITHOUT ANY INTERCOMS:") + dat += "

AREAS WITHOUT ANY INTERCOMS:

" for(var/areatype in areas_without_intercom) - to_chat(world, "* [areatype]") + dat += "[areatype]
" if(areas_without_camera.len) - to_chat(world, "AREAS WITHOUT ANY CAMERAS:") + dat += "

AREAS WITHOUT ANY CAMERAS:

" for(var/areatype in areas_without_camera) - to_chat(world, "* [areatype]") + dat += "[areatype]
" if(!(areas_with_APC.len || areas_with_multiple_APCs.len || areas_with_air_alarm.len || areas_with_RC.len || areas_with_light.len || areas_with_LS.len || areas_with_intercom.len || areas_with_camera.len)) - to_chat(world, "No problem areas!") + dat += "No problem areas!" + + var/datum/browser/popup = new(usr, "testareas", "Test Areas", 500, 750) + popup.set_content(dat.Join()) + popup.open() + /client/proc/cmd_admin_areatest_station() set category = "Mapping"