From b6d25b0fac3b3fdbbf2e0883ffdbe78013d98f01 Mon Sep 17 00:00:00 2001 From: Drathek <76988376+Drulikar@users.noreply.github.com> Date: Thu, 19 Oct 2023 00:00:13 -0700 Subject: [PATCH] Bandaid the null clients in GLOB.clients (#4700) # About the pull request Apparently we are somehow getting nulls into GLOB.clients now, and I don't know why. Stat panel is the most egregious spammer about this fact, but a rather slow subsystem will also periodically check too. # Explain why it's good for the game We don't need tens of thousands of runtimes. # Testing Photographs and Procedure
Screenshots & Videos Put screenshots and videos here with an empty line between the screenshots and the `
` tags.
# Changelog :cl: Drathek fix: Bandaided a problem with nulls in GLOB.clients /:cl: --- code/controllers/subsystem/inactivity.dm | 30 ++++++++++++++---------- code/controllers/subsystem/statpanel.dm | 3 +++ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/code/controllers/subsystem/inactivity.dm b/code/controllers/subsystem/inactivity.dm index dd547e1f406b..5edd4e8c5294 100644 --- a/code/controllers/subsystem/inactivity.dm +++ b/code/controllers/subsystem/inactivity.dm @@ -1,20 +1,26 @@ -#define INACTIVITY_KICK 6000 //10 minutes in ticks (approx.) +#define INACTIVITY_KICK 10 MINUTES SUBSYSTEM_DEF(inactivity) name = "Inactivity" - wait = INACTIVITY_KICK + wait = 1 MINUTES flags = SS_NO_INIT | SS_BACKGROUND priority = SS_PRIORITY_INACTIVITY runlevels = RUNLEVELS_DEFAULT|RUNLEVEL_LOBBY /datum/controller/subsystem/inactivity/fire(resumed = FALSE) - if (CONFIG_GET(flag/kick_inactive)) - for(var/i in GLOB.clients) - var/client/C = i - if(C.admin_holder && C.admin_holder.rights & R_ADMIN) //Skip admins. - continue - if (C.is_afk(INACTIVITY_KICK)) - if (!istype(C.mob, /mob/dead)) - log_access("AFK: [key_name(C)]") - to_chat(C, SPAN_WARNING("You have been inactive for more than 10 minutes and have been disconnected.")) - qdel(C) + if(list_clear_nulls(GLOB.clients)) + debug_log("Removed nulls from GLOB.clients!") + if(list_clear_nulls(GLOB.player_list)) + debug_log("Removed nulls from GLOB.player_list!") + + if (!CONFIG_GET(flag/kick_inactive)) + return + + for(var/client/current as anything in GLOB.clients) + if(current.admin_holder && current.admin_holder.rights & R_ADMIN) //Skip admins. + continue + if(current.is_afk(INACTIVITY_KICK)) + if(!istype(current.mob, /mob/dead)) + log_access("AFK: [key_name(current)]") + to_chat(current, SPAN_WARNING("You have been inactive for more than [INACTIVITY_KICK / 600] minutes and have been disconnected.")) + qdel(current) diff --git a/code/controllers/subsystem/statpanel.dm b/code/controllers/subsystem/statpanel.dm index 1f94e67a8c33..7dbb9cd8181d 100644 --- a/code/controllers/subsystem/statpanel.dm +++ b/code/controllers/subsystem/statpanel.dm @@ -44,6 +44,9 @@ SUBSYSTEM_DEF(statpanels) var/client/target = currentrun[length(currentrun)] currentrun.len-- + if(!target) + continue + if(!target.stat_panel.is_ready()) continue