diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 723b6a01d11..7b99254eb19 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -167,7 +167,8 @@ GLOBAL_LIST_INIT(admin_verbs_debug, list( /client/proc/admin_serialize, /client/proc/jump_to_ruin, /client/proc/toggle_medal_disable, - /client/proc/uid_log + /client/proc/uid_log, + /client/proc/visualise_active_turfs )) GLOBAL_LIST_INIT(admin_verbs_possess, list( /proc/possess, diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 6880b9b4c2e..a772428f6af 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -929,3 +929,57 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention) message_admins("[key_name_admin(src)] [SSmedals.hub_enabled ? "disabled" : "enabled"] the medal hub lockout.") feedback_add_details("admin_verb","TMH") // If... log_admin("[key_name(src)] [SSmedals.hub_enabled ? "disabled" : "enabled"] the medal hub lockout.") + + +/client/proc/visualise_active_turfs() + set category = "Debug" + set name = "Visualise Active Turfs" + + if(!check_rights(R_DEBUG)) + return + + // This can potentially iterate through a list thats 20k things long. Give ample warning to the user + var/confirm = alert(usr, "WARNING: This process is lag intensive and should only be used if the atmos controller is screaming bloody murder. Are you sure you with to continue", "WARNING", "Im sure", "Nope") + if(confirm != "Im sure") + return + + message_admins("[key_name_admin(usr)] is visualising active atmos turfs. Server may lag.") + + var/list/zlevel_turf_indexes = list() + + for(var/i in SSair.active_turfs) + var/turf/T = i + // ENSURE YOU USE STRING NUMBERS HERE, THIS IS A DICTIONARY KEY NOT AN INDEX!!! + if(!zlevel_turf_indexes["[T.z]"]) + zlevel_turf_indexes["[T.z]"] = list() + zlevel_turf_indexes["[T.z]"] |= T + CHECK_TICK + + // Sort the keys + zlevel_turf_indexes = sortAssoc(zlevel_turf_indexes) + + for(var/key in zlevel_turf_indexes) + to_chat(usr, "Z[key]: [length(zlevel_turf_indexes["[key]"])] ATs") + + var/z_to_view = input(usr, "A list of z-levels their ATs has appeared in chat. Please enter a Z to visualise. Enter 0 to cancel.", "Selection", 0) as num + + if(!z_to_view) + return + + // Do not combine these + var/list/ui_dat = list() + var/list/turf_markers = list() + + var/datum/browser/vis = new(usr, "atvis", "Active Turfs (Z[z_to_view])", 300, 315) + ui_dat += "