Files
Paradise/code/controllers/subsystem/SSdebugview.dm
S34N 91660824fa Browser/TGUI Stat Panels (#24065)
* initial commit (broken)

* load the html

* fix this

* Fix various issues with browser statpanel

* Fix Alt Clicking opening up a window and Add back some object verbs to the browser stat panel

* Optimize stat panel and fix guardian verbs

* Restyles Stat Panel, Adds Subpanel Sub-Categories

* Use better layout for verbs in stat panel

* Updates statpanel verb widths to be more dynamic at higher screen resolutions.

* Adjust stat panel grid item widths and breakpoints

* refactors statpanel to use tgui API

* CI moment

* more CI

* this stupid thing

* Apply suggestions from code review

Co-authored-by: GDN <96800819+GDNgit@users.noreply.github.com>
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/modules/client/client_procs.dm

* ci fix

* emergency mc debug view

* temp revert some code change suggestions due to massive runtiming

* proper atom click topic implementation

* optimise

* mob clicking in stat panels work

* yeet spell tab thingy

* yeet simple stat panel pref

* allow insertion of html into MC tab content

* tidy up status tab

* Apply suggestions from code review

* fix this

* fix CI

* oops

* fix index runtime

* fixes MC tab showing up for mentors, fixes runtime

* safeties!

* Return of theme support

* more fixes

* fix view range pref, tidy prefs tab

* Remove old stat panel from themes

* fixes

* make sure verbs don't go missing

* fix ooc/looc breaking

* Revert "make sure verbs don't go missing"

This reverts commit 7d07ad45ed.

* fix this properly

* fix stat panel hitting rate limiters

* fix borg status tab

* Object Window Niceties

* Adds file cycling for icon2base64

* optimizes icon2html() for icon files known to be in the rsc at compile time

* CI moment

* remove dupe emergency shuttle timers

* more robust verb updates

* statpanel tweaks

* zip archived changelog to avoid search results

* optimise

* fix mentor chat wonkyness when disabled

* debug log moment

* i am very smart

* reintroduce this because it was needed

* better time listings

* less jank

* stops telling admins they arent mentors

* returns MC tab pref for admins

* Update code/controllers/subsystem/SSstatpanel.dm

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>

* lewcc

* OD typemaker prep

---------

Co-authored-by: GDN <96800819+GDNgit@users.noreply.github.com>
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Co-authored-by: Aylong <alexanderkitsa@gmail.com>
Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
2024-03-07 10:31:36 -05:00

94 lines
4.5 KiB
Plaintext

SUBSYSTEM_DEF(debugview)
name = "Debug View"
wait = 1 // SS_TICKER subsystem, so wait is in ticks
flags = SS_TICKER|SS_NO_INIT
offline_implications = "Shift+F3 will no longer show a debug view. No immediate action is needed."
cpu_display = SS_CPUDISPLAY_LOW
/// List of clients currently processing
var/list/client/processing = list()
/datum/controller/subsystem/debugview/fire(resumed)
// Dont generate text if no one is there to look at it
if(!length(processing))
return
// Generate debug text
var/list/entries = list()
entries += "CPU: [round(world.cpu, 1)] | MCPU: [round(world.map_cpu, 1)] | FPS/TPS: [world.fps] | Clients: [length(GLOB.clients)] | BYOND: [world.byond_version].[world.byond_build]"
entries += "\[Air] Cost: [round(SSair.cost, 1)]ms | AT: [length(SSair.active_turfs)]"
entries += "\[Debug] Cost: [round(SSdebugview.cost, 1)]ms | P: [length(SSdebugview.processing)]" // meta af (tbf we need to know how much were using)
entries += "\[FP] Cost: [round(SSfastprocess.cost, 1)]ms | P: [length(SSfastprocess.processing)]"
// Snowflakery for SSgarbage
var/list/counts = list()
for(var/list/L in SSgarbage.queues)
counts += length(L)
entries += "\[GC] Cost: [round(SSgarbage.cost, 1)]ms | Q: [counts.Join(",")] H: [SSgarbage.delslasttick] | S: [SSgarbage.gcedlasttick]"
entries += "\[Input] Cost: [round(SSinput.cost, 1)]ms"
entries += "\[Lighting] Cost: [round(SSlighting.cost, 1)]ms | SQ: [length(SSlighting.sources_queue)] | CQ: [length(SSlighting.corners_queue)] | OQ: [length(SSlighting.objects_queue)]"
entries += "\[Machines] Cost: [round(SSmachines.cost, 1)]ms | M: [length(SSmachines.processing)] | P: [length(SSmachines.powernets)]"
entries += "\[Mobs] Cost: [round(SSmobs.cost, 1)]ms | P: [length(GLOB.mob_living_list)]"
entries += "\[Objects] Cost: [round(SSobj.cost, 1)]ms | P: [length(SSobj.processing)]"
entries += "\[Processing] Cost: [round(SSprocessing.cost, 1)]ms | P: [length(SSprocessing.processing)]"
entries += "\[Projectiles] Cost: [round(SSprojectiles.cost, 1)]ms | P: [length(SSprojectiles.processing)]"
entries += "\[Runechat] Cost: [round(SSrunechat.cost, 1)]ms | AM: [SSrunechat.bucket_count] | SQ: [length(SSrunechat.second_queue)]"
entries += "\[TGUI] Cost: [round(SStgui.cost, 1)]ms | P: [length(SStgui.open_uis)]]"
entries += "\[Timer] Cost: [round(SStimer.cost, 1)]ms | B: [SStimer.bucket_count] | P: [length(SStimer.second_queue)] | RST: [SStimer.bucket_reset_count]"
// Do some parsing to format it properly
var/out_text = entries.Join("\n")
var/mty = 480 - 9 * length(entries)
// And update the clients
for(var/client/C as anything in processing)
C.debug_text_overlay.maptext_y = mty
C.debug_text_overlay.maptext = "<span class='maptext' style='background-color: #272727;'>[out_text]</span>"
/datum/controller/subsystem/debugview/proc/start_processing(client/C)
C.debug_text_overlay = new /atom/movable/screen/debugtextholder(null, C)
C.screen |= C.debug_text_overlay
processing |= C
/datum/controller/subsystem/debugview/proc/stop_processing(client/C)
processing -= C
C.screen -= C.debug_text_overlay
QDEL_NULL(C.debug_text_overlay)
/atom/movable/screen/debugtextholder
icon = 'icons/mob/screen_full.dmi'
icon_state = "empty"
screen_loc = "TOP,LEFT"
plane = HUD_PLANE_DEBUGVIEW
maptext_height = 480 // 15 * 32 (15 tiles, 32 pixels each)
maptext_width = 480 // changes with prefs
/atom/movable/screen/debugtextholder/Initialize(mapload, client/C)
. = ..()
update_view(C)
/atom/movable/screen/debugtextholder/proc/update_view(client/C)
var/list/viewsizes = getviewsize(C.view)
maptext_width = viewsizes[1] * world.icon_size
// Make a verb for dumping full SS stats
/client/proc/ss_breakdown()
set name = "SS Info Breakdown"
set category = "Debug"
if(!check_rights(R_DEBUG|R_VIEWRUNTIMES))
return
var/datum/browser/popup = new(usr, "ss_breakdown", "Subsystem Breakdown", 1100, 850)
var/list/html = list()
html += "CPU: [round(world.cpu, 1)] | MCPU: [round(world.map_cpu, 1)] | FPS/TPS: [world.fps] | Clients: [length(GLOB.clients)] | BYOND: [world.byond_version].[world.byond_build]"
html += "--- SS BREAKDOWN ---"
for(var/datum/controller/subsystem/SS as anything in Master.subsystems)
// We dont care about subsystems that arent firing (or are unable to)
if((SS.flags & SS_NO_FIRE) || !SS.can_fire)
continue
html += "[SS.state_colour()]\[[SS.state_letter()]][SS.ss_id]</font>\t[round(SS.cost, 1)]ms | [round(SS.tick_usage, 1)]% [SS.get_stat_details() ? "| [SS.get_stat_details()] " : ""]| <a href=?_src_=vars;Vars=[SS.UID()]>VV Edit</a>"
popup.set_content(html.Join("<br>"))
popup.open(FALSE)