Port tg statpanel (#16463)

* Port tg statpanel

* Add verb descriptions using the title attribute

* Fix a dreamchecker error

* Remove chomp edits

* Add mentor tickets to ticket panel

---------

Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
ShadowLarkens
2024-10-16 10:39:06 -07:00
committed by GitHub
parent ed5fc193f7
commit c07027136e
211 changed files with 3233 additions and 1170 deletions
+19
View File
@@ -36,6 +36,8 @@
////////////////
//ADMIN THINGS//
////////////////
/// hides the byond verb panel as we use our own custom version
show_verb_panel = FALSE
///Contains admin info. Null if client is not an admin.
var/datum/admins/holder = null
var/datum/admins/deadmin_holder = null
@@ -113,6 +115,23 @@
// Runechat messages
var/list/seen_messages
/// our current tab
var/stat_tab
/// list of all tabs
var/list/panel_tabs = list()
/// list of tabs containing spells and abilities
var/list/spell_tabs = list()
/// list of misc tabs from mob
var/list/misc_tabs = list()
///A lazy list of atoms we've examined in the last RECENT_EXAMINE_MAX_WINDOW (default 2) seconds, so that we will call [/atom/proc/examine_more] instead of [/atom/proc/examine] on them when examining
var/list/recent_examines
///Our object window datum. It stores info about and handles behavior for the object tab
var/datum/object_window_info/obj_window
var/list/misc_cache = list()
var/atom/examine_icon //Holder for examine icon, useful for statpanel
//Hide top bars
var/fullscreen = FALSE
+54
View File
@@ -113,6 +113,8 @@
log_and_message_admins("[ckey] failed to register their Discord ID. Their Discord snowflake ID is: [their_id]. Is the database connected?")
return
//VOREStation Add End
if(href_list["reload_statbrowser"])
stat_panel.reinitialize()
//Logs all hrefs
if(config && config.log_hrefs && href_logfile)
@@ -181,6 +183,10 @@
GLOB.clients += src
GLOB.directory[ckey] = src
// Instantiate stat panel
stat_panel = new(src, "statbrowser")
stat_panel.subscribe(src, .proc/on_stat_panel_message)
// Instantiate tgui panel
tgui_say = new(src, "tgui_say")
initialize_commandbar_spy()
@@ -218,6 +224,14 @@
if(prefs)
prefs.selecting_slots = FALSE
// Initialize stat panel
stat_panel.initialize(
inline_html = file2text('html/statbrowser.html'),
inline_js = file2text('html/statbrowser.js'),
inline_css = file2text('html/statbrowser.css'),
)
addtimer(CALLBACK(src, PROC_REF(check_panel_loaded)), 30 SECONDS)
// Initialize tgui panel
tgui_say.initialize()
tgui_panel.initialize()
@@ -652,3 +666,43 @@
to_chat(src, span_warning("No recorded playtime found!"))
return
to_chat(src, span_info("Your department hours:" + department_hours))
/// compiles a full list of verbs and sends it to the browser
/client/proc/init_verbs()
if(IsAdminAdvancedProcCall())
return
var/list/verblist = list()
panel_tabs.Cut()
for(var/thing in (verbs + mob?.verbs))
var/procpath/verb_to_init = thing
if(!verb_to_init)
continue
if(verb_to_init.hidden)
continue
if(!istext(verb_to_init.category))
continue
panel_tabs |= verb_to_init.category
verblist[++verblist.len] = list(verb_to_init.category, verb_to_init.name, verb_to_init.desc)
src.stat_panel.send_message("init_verbs", list(panel_tabs = panel_tabs, verblist = verblist))
/client/proc/check_panel_loaded()
if(stat_panel && stat_panel.is_ready())
return
to_chat(src, "<span class='danger'>Statpanel failed to load, click <a href='?src=[REF(src)];reload_statbrowser=1'>here</a> to reload the panel. If this does not work, reconnecting will reassign a new panel.</span>")
/**
* Handles incoming messages from the stat-panel TGUI.
*/
/client/proc/on_stat_panel_message(type, payload)
switch(type)
if("Update-Verbs")
init_verbs()
if("Remove-Tabs")
panel_tabs -= payload["tab"]
if("Send-Tabs")
panel_tabs |= payload["tab"]
if("Reset-Tabs")
panel_tabs = list()
if("Set-Tab")
stat_tab = payload["tab"]
SSstatpanels.immediate_send_stat_data(src)
+6
View File
@@ -275,3 +275,9 @@
INVOKE_ASYNC(src, VERB_REF(fit_viewport))
else //Delayed to avoid wingets from Login calls.
addtimer(CALLBACK(src, VERB_REF(fit_viewport), 1 SECONDS))
/client/verb/fix_stat_panel()
set name = "Fix Stat Panel"
set hidden = TRUE
init_verbs()