Merge pull request #195 from Be1aya/runtime-viewer

Runtime viewer for non admins
This commit is contained in:
evilew
2025-08-14 00:03:38 -05:00
committed by GitHub
2 changed files with 25 additions and 2 deletions
+8
View File
@@ -322,6 +322,14 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
pct += delta
winset(src, "mainwindow.split", "splitter=[pct]")
//GS13: Runtime viewer for users
/client/verb/view_runtimes_minimal()
set name = "View Minimal Runtimes"
set category = "OOC"
set desc = "Open the runtime error viewer, with reduced information"
GLOB.error_cache.show_to_minimal(src)
/client/verb/fix_stat_panel()
set name = "Fix Stat Panel"
set hidden = TRUE
+17 -2
View File
@@ -23,6 +23,7 @@ GLOBAL_DATUM(error_cache, /datum/error_viewer/error_cache)
// Common vars and procs are kept at the error_viewer level
/datum/error_viewer
var/name = ""
var/min_name = "" //GS13: Runtime viewer for users
/datum/error_viewer/proc/browse_to(client/user, html)
var/datum/browser/browser = new(user.mob, "error_viewer", null, 600, 400)
@@ -78,6 +79,16 @@ GLOBAL_DATUM(error_cache, /datum/error_viewer/error_cache)
var/list/error_sources = list()
var/list/errors_silenced = list()
//GS13: Runtime viewer for users
/datum/error_viewer/error_cache/proc/show_to_minimal(user, datum/error_viewer/back_to, linear)
var/html = "<b>[GLOB.total_runtimes]</b> runtimes, <b>[GLOB.total_runtimes_skipped]</b> skipped<br><br>"
var/datum/error_viewer/error_source/error_source
for (var/erroruid in error_sources)
error_source = error_sources[erroruid]
html += "[error_source.min_name]<br>"
browse_to(user, html)
/datum/error_viewer/error_cache/show_to(user, datum/error_viewer/back_to, linear)
var/html = build_header()
html += "<b>[GLOB.total_runtimes]</b> runtimes, <b>[GLOB.total_runtimes_skipped]</b> skipped<br><br>"
@@ -134,7 +145,9 @@ GLOBAL_DATUM(error_cache, /datum/error_viewer/error_cache)
name = "\[[TIME_STAMP("hh:mm:ss", FALSE)]] Uncaught exceptions"
return
name = "<b>\[[TIME_STAMP("hh:mm:ss", FALSE)]]</b> Runtime in <b>[e.file]</b>, line <b>[e.line]</b>: <b>[html_encode(e.name)]</b>"
//GS13: Runtime viewer for users
min_name = "<b>\[[TIME_STAMP("hh:mm:ss", FALSE)]]</b> Runtime in <b>[e.file]</b>, line <b>[e.line]</b>"
name = min_name + ": <b>[html_encode(e.name)]</b>"
/datum/error_viewer/error_source/show_to(user, datum/error_viewer/back_to, linear)
if (!istype(back_to))
@@ -164,7 +177,9 @@ GLOBAL_DATUM(error_cache, /datum/error_viewer/error_cache)
is_skip_count = TRUE
return
name = "<b>\[[TIME_STAMP("hh:mm:ss", FALSE)]]</b> Runtime in <b>[e.file]</b>, line <b>[e.line]</b>: <b>[html_encode(e.name)]</b>"
//GS13: Runtime viewer for users
min_name = "<b>\[[TIME_STAMP("hh:mm:ss", FALSE)]]</b> Runtime in <b>[e.file]</b>, line <b>[e.line]</b>"
name = min_name + ": <b>[html_encode(e.name)]</b>"
exc = e
if (istype(desclines))
for (var/line in desclines)