A healthy addition of debug verbs (#21843)

* A healthy addition of debug verbs

* Forgot some stuff

* SEANNNNNNNNNNN
This commit is contained in:
AffectedArc07
2023-07-29 08:58:22 +01:00
committed by GitHub
parent ed08e46fea
commit 7340fb0a65
4 changed files with 60 additions and 0 deletions

View File

@@ -835,6 +835,52 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
usr << browse(dat, "window=simpledellog")
/client/proc/show_gc_queues()
set name = "View GC Queue"
set category = "Debug"
set desc = "Shows the list of whats currently in a GC queue"
if(!check_rights(R_DEBUG|R_VIEWRUNTIMES))
return
// Get the amount of queues
var/queue_count = length(SSgarbage.queues)
var/list/selectable_queues = list()
// Setup choices
for(var/i in 1 to queue_count)
selectable_queues["Queue #[i] ([length(SSgarbage.queues[i])] item\s)"] = i
// Ask the user
var/choice = input(usr, "Select a GC queue. Note that the queue lookup may lag the server.", "GC Queue") as null|anything in selectable_queues
if(!choice)
return
// Get our target
var/list/target_queue = SSgarbage.queues[selectable_queues[choice]]
var/list/queue_counts = list()
// Iterate that target and see whats what
for(var/queue_entry in target_queue)
var/datum/D = locate(queue_entry[1])
if(!istype(D))
continue
if(!queue_counts[D.type])
queue_counts[D.type] = 0
queue_counts[D.type]++
// Sort it the right way
var/list/sorted = sortTim(queue_counts, GLOBAL_PROC_REF(cmp_numeric_dsc), TRUE)
// And make a nice little menu
var/list/text = list("<h1>Current status of [choice]</h1>", "<ul>")
for(var/key in sorted)
text += "<li>[key] - [sorted[key]]</li>"
text += "</ul>"
usr << browse(text.Join(), "window=gcqueuestatus")
/client/proc/cmd_admin_toggle_block(mob/M, block)
if(!check_rights(R_SPAWN))
return