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