From bbbc02c85cfc9ab0ad0d7b22047c19aa2b0294a4 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Mon, 16 Oct 2023 18:16:00 -0700 Subject: [PATCH] Use inactivity SS to clear nulls --- code/controllers/subsystem/inactivity.dm | 26 +++++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/code/controllers/subsystem/inactivity.dm b/code/controllers/subsystem/inactivity.dm index dd547e1f406b..44afa3f04c37 100644 --- a/code/controllers/subsystem/inactivity.dm +++ b/code/controllers/subsystem/inactivity.dm @@ -8,13 +8,19 @@ SUBSYSTEM_DEF(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) + // Maybe we should just get a SS to bandaid all important global lists like this? + var/cleared_any = list_clear_nulls(GLOB.clients) + if(cleared_any) + debug_log("Removed nulls from GLOB.clients!") + + 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 10 minutes and have been disconnected.")) + qdel(current)