Updates the AFK logout report to utilize configs for it's timers (#92662)

## About The Pull Request

Rather than use hardcoded timers for the logout report, the report
instead utilizes a timer based on config values. The default value is
the current live value.

This timer can also be configurated to utilize randomization. Currently,
it defaults to randomizing between -3 minutes to +3 minutes for when the
report is sent.

The logout report timer is also added to the admin log.

## Why It's Good For The Game

This shouldn't be dictated by the codebase, as it is an admin tool.
This commit is contained in:
necromanceranne
2025-08-26 12:29:56 -05:00
committed by GitHub
parent 53a034c5b0
commit cb7e44e7ee
5 changed files with 24 additions and 8 deletions
@@ -638,6 +638,13 @@
/datum/config_entry/flag/picture_logging_camera
/datum/config_entry/number/roundstart_logout_report_time_average
default = 10 MINUTES
min_val = 0
/datum/config_entry/number/roundstart_logout_report_time_variance
default = 3 MINUTES
min_val = 0
/datum/config_entry/flag/reopen_roundstart_suicide_roles
+9 -2
View File
@@ -313,7 +313,11 @@ SUBSYSTEM_DEF(ticker)
if(!CONFIG_GET(flag/no_intercept_report))
GLOB.communications_controller.queue_roundstart_report()
// Queue admin logout report
addtimer(CALLBACK(src, PROC_REF(display_roundstart_logout_report)), ROUNDSTART_LOGOUT_REPORT_TIME)
var/roundstart_logout_timer = CONFIG_GET(number/roundstart_logout_report_time_average)
var/roundstart_report_variance = CONFIG_GET(number/roundstart_logout_report_time_variance)
var/randomized_callback_timer = rand((roundstart_logout_timer - roundstart_report_variance), (roundstart_logout_timer + roundstart_report_variance))
addtimer(CALLBACK(src, PROC_REF(display_roundstart_logout_report)), randomized_callback_timer)
GLOB.logout_timer_set = randomized_callback_timer
// Queue suicide slot handling
if(CONFIG_GET(flag/reopen_roundstart_suicide_roles))
var/delay = (CONFIG_GET(number/reopen_roundstart_suicide_roles_delay) * 1 SECONDS) || 4 MINUTES
@@ -367,6 +371,7 @@ SUBSYSTEM_DEF(ticker)
/datum/controller/subsystem/ticker/proc/display_roundstart_logout_report()
var/list/msg = list("[span_boldnotice("Roundstart logout report")]\n\n")
for(var/i in GLOB.mob_living_list)
var/mob/living/L = i
var/mob/living/carbon/C = L
@@ -379,7 +384,7 @@ SUBSYSTEM_DEF(ticker)
if(L.ckey && L.client)
var/failed = FALSE
if(L.client.inactivity >= ROUNDSTART_LOGOUT_AFK_THRESHOLD) //Connected, but inactive (alt+tabbed or something)
if(L.client.inactivity >= GLOB.logout_timer_set) //Connected, but inactive (alt+tabbed or something)
msg += "<b>[L.name]</b> ([L.key]), the [L.job] (<font color='#ffcc00'><b>Connected, Inactive</b></font>)\n"
failed = TRUE //AFK client
if(!failed && L.stat)
@@ -410,6 +415,8 @@ SUBSYSTEM_DEF(ticker)
msg += "<b>[L.name]</b> ([ckey(D.mind.key)]), the [L.job] ([span_bolddanger("Ghosted")])\n"
continue //Ghosted while alive
msg += "[span_boldnotice("Roundstart logout reported at: [DisplayTimeText(GLOB.logout_timer_set)]")]\n"
var/concatenated_message = msg.Join()
log_admin(concatenated_message)
to_chat(GLOB.admins, concatenated_message)