[MIRROR] Port tg statpanel (#9242)

Co-authored-by: ShadowLarkens <shadowlarkens@gmail.com>
Co-authored-by: Kashargul <KashL@t-online.de>
This commit is contained in:
CHOMPStation2
2024-10-17 23:29:59 +02:00
committed by GitHub
co-authored by ShadowLarkens Kashargul
parent e68994c99d
commit 4d9879937f
207 changed files with 709 additions and 956 deletions
+1 -1
View File
@@ -16,4 +16,4 @@
/datum/controller/proc/Recover()
/datum/controller/proc/stat_entry(msg) //CHOMPEdit
/datum/controller/proc/stat_entry(msg)
+3 -3
View File
@@ -96,9 +96,9 @@ GLOBAL_REAL(Failsafe, /datum/controller/failsafe) // CHOMPEdit - Managed Globals
/datum/controller/failsafe/proc/defcon_pretty()
return defcon
/datum/controller/failsafe/stat_entry(msg) //CHOMPEdit
/datum/controller/failsafe/stat_entry(msg)
if(!statclick)
statclick = new/obj/effect/statclick/debug(null, "Initializing...", src)
msg = "Failsafe Controller: [statclick.update("Defcon: [defcon_pretty()] (Interval: [Failsafe.processing_interval] | Iteration: [Failsafe.master_iteration])")]" //CHOMPEdit
return msg //CHOMPEdit
msg = "Failsafe Controller: [statclick.update("Defcon: [defcon_pretty()] (Interval: [Failsafe.processing_interval] | Iteration: [Failsafe.master_iteration])")]"
return msg
+3 -3
View File
@@ -32,12 +32,12 @@ GLOBAL_REAL(GLOB, /datum/controller/global_vars)
return ..()
/datum/controller/global_vars/stat_entry(msg) //CHOMPEdit
/datum/controller/global_vars/stat_entry(msg)
if(!statclick)
statclick = new/obj/effect/statclick/debug(null, "Initializing...", src)
msg = "GLOB: [statclick.update("Edit")]" //CHOMPEdit
return msg //CHOMPEdit
msg = "GLOB: [statclick.update("Edit")]"
return msg
/datum/controller/global_vars/vv_edit_var(var_name, var_value)
if(gvars_datum_protected_varlist[var_name])
+3 -3
View File
@@ -695,12 +695,12 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
/datum/controller/master/stat_entry(msg) //CHOMPEdit
/datum/controller/master/stat_entry(msg)
if(!statclick)
statclick = new/obj/effect/statclick/debug(null, "Initializing...", src)
msg = "Byond: (FPS:[world.fps]) (TickCount:[world.time/world.tick_lag]) (TickDrift:[round(Master.tickdrift,1)]([round((Master.tickdrift/(world.time/world.tick_lag))*100,0.1)]%))" //CHOMPedit
msg += "Master Controller: [statclick.update("(TickRate:[Master.processing]) (Iteration:[Master.iteration])")]" //CHOMPEdit
msg = "Byond: (FPS:[world.fps]) (TickCount:[world.time/world.tick_lag]) (TickDrift:[round(Master.tickdrift,1)]([round((Master.tickdrift/(world.time/world.tick_lag))*100,0.1)]%))"
msg += "Master Controller: [statclick.update("(TickRate:[Master.processing]) (Iteration:[Master.iteration])")]"
return msg
-2
View File
@@ -236,14 +236,12 @@
// CHOMPEdit End
//hook for printing stats to the "MC" statuspanel for admins to see performance and related stats etc.
//CHOMPEdit Begin
/datum/controller/subsystem/stat_entry(msg)
if(can_fire && !(SS_NO_FIRE & flags))
msg = "[round(cost,1)]ms|[round(tick_usage,1)]%([round(tick_overrun,1)]%)|[round(ticks,0.1)]\t[msg]"
else
msg = "OFFLINE\t[msg]"
return msg
//CHOMPEdit End
/datum/controller/subsystem/proc/state_letter()
switch (state)
-2
View File
@@ -12,11 +12,9 @@ SUBSYSTEM_DEF(ai)
var/slept_mobs = 0
var/list/process_z = list()
//CHOMPEdit Begin
/datum/controller/subsystem/ai/stat_entry(msg)
msg = "P: [processing.len] | S: [slept_mobs]"
return ..()
//CHOMPEdit End
/datum/controller/subsystem/ai/fire(resumed = 0)
if (!resumed)
-2
View File
@@ -9,11 +9,9 @@ SUBSYSTEM_DEF(aifast)
var/list/processing = list()
var/list/currentrun = list()
//CHOMPEdit Begin
/datum/controller/subsystem/aifast/stat_entry(msg)
msg = "P:[processing.len]"
return ..()
// CHOMPEdit End
/datum/controller/subsystem/aifast/fire(resumed = 0)
if (!resumed)
-2
View File
@@ -246,7 +246,6 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun
if(MC_TICK_CHECK)
return
//CHOMPEdit Begin
/datum/controller/subsystem/air/stat_entry(msg)
msg = "S:[current_step ? part_names[current_step] : ""] "
msg += "C:{"
@@ -266,7 +265,6 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun
msg += "Z [zones_to_update.len] "
msg += "}"
return ..()
// CHOMPEdit End
// ZAS might displace objects as the map loads if an air tick is processed mid-load.
/datum/controller/subsystem/air/StartLoadingMap(var/quiet = TRUE)
-2
View File
@@ -41,8 +41,6 @@ SUBSYSTEM_DEF(alarm)
/datum/controller/subsystem/alarm/proc/number_of_active_alarms()
return active_alarm_cache.len
//CHOMPEdit Begin
/datum/controller/subsystem/alarm/stat_entry(msg)
msg = "[number_of_active_alarms()] alarm\s"
return ..()
//CHOMPEdit End
-2
View File
@@ -20,11 +20,9 @@ SUBSYSTEM_DEF(chemistry)
initialize_chemical_reactions()
return SS_INIT_SUCCESS // CHOMPEdit
//CHOMPEdit Begin
/datum/controller/subsystem/chemistry/stat_entry(msg)
msg = "C: [chemical_reagents.len] | R: [chemical_reactions.len]"
return ..()
//CHOMPEdit End
//Chemical Reactions - Initialises all /decl/chemical_reaction into a list
// It is filtered into multiple lists within a list.
-2
View File
@@ -41,11 +41,9 @@ SUBSYSTEM_DEF(events)
var/datum/event_container/EC = event_containers[i]
EC.process()
//CHOMPEdit Begin
/datum/controller/subsystem/events/stat_entry(msg)
msg = "E:[active_events.len]"
return ..()
//CHOMPEdit End
/datum/controller/subsystem/events/Recover()
if(SSevents.active_events)
@@ -56,11 +56,9 @@ SUBSYSTEM_DEF(inactivity)
if (MC_TICK_CHECK)
return
//CHOMPEdit Begin
/datum/controller/subsystem/inactivity/stat_entry(msg)
msg = "Kicked: [number_kicked]"
return ..()
//CHOMPEdit End
/datum/controller/subsystem/inactivity/proc/can_kick(var/client/C)
if(C.holder) return FALSE //VOREStation Add - Don't kick admins.
-2
View File
@@ -82,7 +82,6 @@ SUBSYSTEM_DEF(machines)
T.broadcast_status()
CHECK_TICK
//CHOMPEdit Begin
/datum/controller/subsystem/machines/stat_entry(msg)
msg = "C:{"
msg += "PI:[round(cost_pipenets,1)]|"
@@ -96,7 +95,6 @@ SUBSYSTEM_DEF(machines)
msg += "PO:[SSmachines.powerobjs.len]|"
msg += "MC/MS:[round((cost ? SSmachines.processing_machines.len/cost_machinery : 0),0.1)]"
return ..()
// CHOMPEdit End
/datum/controller/subsystem/machines/proc/process_pipenets(resumed = 0)
if (!resumed)
-2
View File
@@ -19,11 +19,9 @@ SUBSYSTEM_DEF(mobs)
var/slept_mobs = 0
var/list/process_z = list()
//CHOMPEdit Begin
/datum/controller/subsystem/mobs/stat_entry(msg)
msg = "P: [global.mob_list.len] | S: [slept_mobs]"
return ..()
//CHOMPEdit End
/datum/controller/subsystem/mobs/fire(resumed = 0)
if (!resumed)
+1 -2
View File
@@ -7,11 +7,10 @@ SUBSYSTEM_DEF(orbit)
var/list/currentrun = list()
var/list/processing = list()
//CHOMPEdit Begin
/datum/controller/subsystem/orbit/stat_entry(msg)
msg = "P:[processing.len]"
return ..()
//CHOMPEdit End
/datum/controller/subsystem/orbit/fire(resumed = 0)
if (!resumed)
-2
View File
@@ -12,11 +12,9 @@ SUBSYSTEM_DEF(ping)
runlevels = RUNLEVEL_LOBBY | RUNLEVELS_DEFAULT
var/list/currentrun = list()
//CHOMPEdit Begin
/datum/controller/subsystem/ping/stat_entry(msg)
msg = "P:[GLOB.clients.len]"
return ..()
// CHOMPEdit End
/datum/controller/subsystem/ping/fire(resumed = FALSE)
// Prepare the new batch of clients
+1 -1
View File
@@ -22,11 +22,11 @@ SUBSYSTEM_DEF(plants)
var/list/processing = list()
var/list/currentrun = list()
//CHOMPEdit Begin
/datum/controller/subsystem/plants/stat_entry(msg)
msg = "P:[processing.len]|S:[seeds.len]"
return ..()
//CHOMPEdit Begin
/datum/controller/subsystem/plants/Initialize()
setup()
return SS_INIT_SUCCESS
@@ -23,11 +23,11 @@ SUBSYSTEM_DEF(processing)
for(var/datum/D in old_processing)
if(CHECK_BITFIELD(D.datum_flags, DF_ISPROCESSING))
processing |= D
//CHOMPEdit Begin
/datum/controller/subsystem/processing/stat_entry(msg)
msg = "[stat_tag]:[processing.len]"
return ..()
//CHOMPEdit End
/datum/controller/subsystem/processing/fire(resumed = 0)
if (!resumed)
currentrun = processing.Copy()
+2 -2
View File
@@ -53,11 +53,11 @@ SUBSYSTEM_DEF(radiation)
A.rad_act(rads)
if (MC_TICK_CHECK)
return
//CHOMPEdit Begin
/datum/controller/subsystem/radiation/stat_entry(msg)
msg = "S:[sources.len], RC:[resistance_cache.len]"
return ..()
//CHOMPEdit End
// Ray trace from all active radiation sources to T and return the strongest effect.
/datum/controller/subsystem/radiation/proc/get_rads_at_turf(var/turf/T)
. = 0
+1 -2
View File
@@ -171,8 +171,7 @@ SUBSYSTEM_DEF(shuttles)
overmap_halted = !overmap_halted
for(var/obj/effect/overmap/visitable/ship/ship_effect as anything in ships)
overmap_halted ? ship_effect.halt() : ship_effect.unhalt()
//CHOMPEdit Begin
/datum/controller/subsystem/shuttles/stat_entry(msg)
msg = "Shuttles:[process_shuttles.len]/[shuttles.len], Ships:[ships.len], L:[registered_shuttle_landmarks.len][overmap_halted ? ", HALT" : ""]"
return ..()
//CHOMPEdit End
@@ -31,10 +31,10 @@ SUBSYSTEM_DEF(statpanels)
"Map: [using_map.name]",
//cached ? "Next Map: [cached.map_name]" : null,
//"Next Map: -- Not Available --",
"Round ID: [GLOB.round_id ? GLOB.round_id : "NULL"]",
"Round ID: [GLOB.round_id ? GLOB.round_id : "NULL"]", // CHOMPEdit
"Server Time: [time2text(world.timeofday, "YYYY-MM-DD hh:mm:ss")]",
"Round Time: [ROUND_TIME()]",
"Station Date: [stationdate2text()], [capitalize(GLOB.world_time_season)]",
"Station Date: [stationdate2text()], [capitalize(GLOB.world_time_season)]", // CHOMPEdit
"Station Time: [stationtime2text()]",
"Time Dilation: [round(SStime_track.time_dilation_current,1)]% AVG:([round(SStime_track.time_dilation_avg_fast,1)]%, [round(SStime_track.time_dilation_avg,1)]%, [round(SStime_track.time_dilation_avg_slow,1)]%)"
)
@@ -136,7 +136,7 @@ SUBSYSTEM_DEF(statpanels)
target.stat_panel.send_message("update_stat", list(
global_data = global_data,
ping_str = "Ping: [round(target.lastping, 1)]ms (Average: [round(target.avgping, 1)]ms)",
ping_str = "Ping: [round(target.lastping, 1)]ms (Average: [round(target.avgping, 1)]ms)", // CHOMPEdit
other_str = target.mob?.get_status_tab_items(),
))
@@ -173,7 +173,7 @@ SUBSYSTEM_DEF(statpanels)
target.stat_panel.send_message("update_examine", examine_update)
/datum/controller/subsystem/statpanels/proc/set_tickets_tab(client/target)
var/list/tickets = GLOB.tickets.stat_entry(target)
var/list/tickets = GLOB.tickets.stat_entry(target) // CHOMPEdit
target.stat_panel.send_message("update_tickets", tickets)
/datum/controller/subsystem/statpanels/proc/set_SDQL2_tab(client/target)
@@ -278,7 +278,7 @@ SUBSYSTEM_DEF(statpanels)
list("Instances:", "[num2text(world.contents.len, 10)]"),
list("World Time:", "[world.time]"),
list("Globals:", GLOB.stat_entry(), "\ref[GLOB]"),
list("[config]:", config.stat_entry(), "\ref[config]"),
list("[config]:", config.stat_entry(), "\ref[config]"), // CHOMPEdit
list("Byond:", "(FPS:[world.fps]) (TickCount:[world.time/world.tick_lag]) (TickDrift:[round(Master.tickdrift,1)]([round((Master.tickdrift/(world.time/world.tick_lag))*100,0.1)]%)) (Internal Tick Usage: [round(MAPTICK_LAST_INTERNAL_TICK_USAGE,0.1)]%)"),
list("Master Controller:", Master.stat_entry(), "\ref[Master]"),
list("Failsafe Controller:", Failsafe.stat_entry(), "\ref[Failsafe]"),
+2 -2
View File
@@ -38,11 +38,11 @@ SUBSYSTEM_DEF(supply)
// Supply shuttle ticker - handles supply point regeneration. Just add points over time.
/datum/controller/subsystem/supply/fire()
points += points_per_process
//CHOMPEdit Begin
/datum/controller/subsystem/supply/stat_entry(msg)
msg = "Points: [points]"
return ..()
//CHOMPEdit End
//To stop things being sent to CentCom which should not be sent to centcomm. Recursively checks for these types.
/datum/controller/subsystem/supply/proc/forbidden_atoms_check(atom/A)
if(isliving(A))
+2 -2
View File
@@ -34,11 +34,11 @@ SUBSYSTEM_DEF(tgui)
/datum/controller/subsystem/tgui/Shutdown()
close_all_uis()
//CHOMPEdit Begin
/datum/controller/subsystem/tgui/stat_entry(msg)
msg = "P:[all_uis.len]"
return ..()
//CHOMPEdit End
/datum/controller/subsystem/tgui/fire(resumed = FALSE)
if(!resumed)
src.current_run = all_uis.Copy()
+3 -3
View File
@@ -8,11 +8,11 @@ SUBSYSTEM_DEF(throwing)
var/list/currentrun
var/list/processing = list()
//CHOMPEdit Begin
/datum/controller/subsystem/throwing/stat_entry(msg)
msg = "P:[length(processing)]"
msg = "P:[processing.len]"
return ..()
//CHOMPEdit End
/datum/controller/subsystem/throwing/fire(resumed = 0)
if (!resumed)
src.currentrun = processing.Copy()
+4 -2
View File
@@ -41,7 +41,9 @@ SUBSYSTEM_DEF(ticker)
//Now we have a general cinematic centrally held within the gameticker....far more efficient!
var/obj/screen/cinematic = null
var/round_start_time = 0 //CHOMPEdit
var/round_start_time = 0
// This global variable exists for legacy support so we don't have to rename every 'ticker' to 'SSticker' yet.
var/global/datum/controller/subsystem/ticker/ticker
@@ -103,7 +105,7 @@ var/global/datum/controller/subsystem/ticker/ticker
// Called during GAME_STATE_SETTING_UP (RUNLEVEL_SETUP)
/datum/controller/subsystem/ticker/proc/setup_tick(resumed = FALSE)
round_start_time = world.time //otherwise round_start_time would be 0 for the signals
round_start_time = world.time // otherwise round_start_time would be 0 for the signals
if(!setup_choose_gamemode())
// It failed, go back to lobby state and re-send the welcome message
pregame_timeleft = CONFIG_GET(number/pregame_time) // CHOMPEdit
+1 -3
View File
@@ -54,11 +54,9 @@ SUBSYSTEM_DEF(timer)
head_offset = world.time
bucket_resolution = world.tick_lag
//CHOMPEdit Begin
/datum/controller/subsystem/timer/stat_entry(msg)
msg = "B:[bucket_count] P:[length(second_queue)] H:[length(hashes)] C:[length(clienttime_timers)] S:[length(timer_id_dict)] RST:[bucket_reset_count]"
msg = "B:[bucket_count] P:[length(second_queue)] H:[length(hashes)] C:[length(clienttime_timers)] S:[length(timer_id_dict)] RST:[bucket_reset_count]" // CHOMPEdit
return ..()
// CHOMPEdit End
/datum/controller/subsystem/timer/proc/dump_timer_buckets(full = TRUE)
var/list/to_log = list("Timer bucket reset. world.time: [world.time], head_offset: [head_offset], practical_offset: [practical_offset]")
@@ -126,7 +126,6 @@ SUBSYSTEM_DEF(transcore)
if(MC_TICK_CHECK)
return
//CHOMPEdit Begin
/datum/controller/subsystem/transcore/stat_entry(msg)
msg = "$:{"
msg += "IM:[round(cost_implants,1)]|"
@@ -142,7 +141,6 @@ SUBSYSTEM_DEF(transcore)
msg += "DFI:[default_db.implants.len]"
msg += "} "
return ..()
// CHOMPEdit End
/datum/controller/subsystem/transcore/Recover()
for(var/key in SStranscore.databases)