From 27b88ba13064c56e094393bed52731e8706ba22f Mon Sep 17 00:00:00 2001 From: Drulikar Date: Mon, 16 Oct 2023 17:46:40 -0700 Subject: [PATCH 1/6] Null clients can exist in GLOB.clients --- code/controllers/subsystem/statpanel.dm | 3 +++ 1 file changed, 3 insertions(+) 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 From bbbc02c85cfc9ab0ad0d7b22047c19aa2b0294a4 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Mon, 16 Oct 2023 18:16:00 -0700 Subject: [PATCH 2/6] 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) From 16bf09099af980c6516d37a5a99c000da2de76c8 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Mon, 16 Oct 2023 18:37:31 -0700 Subject: [PATCH 3/6] 5 minute delay for inactivity sub system (still requires 10 minutes afk) --- code/controllers/subsystem/inactivity.dm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/code/controllers/subsystem/inactivity.dm b/code/controllers/subsystem/inactivity.dm index 44afa3f04c37..d488edf28451 100644 --- a/code/controllers/subsystem/inactivity.dm +++ b/code/controllers/subsystem/inactivity.dm @@ -1,16 +1,15 @@ -#define INACTIVITY_KICK 6000 //10 minutes in ticks (approx.) +#define INACTIVITY_KICK 10 MINUTES SUBSYSTEM_DEF(inactivity) name = "Inactivity" - wait = INACTIVITY_KICK + wait = INACTIVITY_KICK * 0.5 flags = SS_NO_INIT | SS_BACKGROUND priority = SS_PRIORITY_INACTIVITY runlevels = RUNLEVELS_DEFAULT|RUNLEVEL_LOBBY /datum/controller/subsystem/inactivity/fire(resumed = FALSE) // 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) + if(list_clear_nulls(GLOB.clients)) debug_log("Removed nulls from GLOB.clients!") if (!CONFIG_GET(flag/kick_inactive)) From 87369b7ce281e35432ce42066a7e1b181c8387cd Mon Sep 17 00:00:00 2001 From: Drulikar Date: Tue, 17 Oct 2023 21:12:54 -0700 Subject: [PATCH 4/6] Faster --- code/controllers/subsystem/inactivity.dm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/controllers/subsystem/inactivity.dm b/code/controllers/subsystem/inactivity.dm index d488edf28451..f65fa98d1c8f 100644 --- a/code/controllers/subsystem/inactivity.dm +++ b/code/controllers/subsystem/inactivity.dm @@ -2,7 +2,7 @@ SUBSYSTEM_DEF(inactivity) name = "Inactivity" - wait = INACTIVITY_KICK * 0.5 + wait = 1 MINUTES flags = SS_NO_INIT | SS_BACKGROUND priority = SS_PRIORITY_INACTIVITY runlevels = RUNLEVELS_DEFAULT|RUNLEVEL_LOBBY @@ -18,8 +18,8 @@ SUBSYSTEM_DEF(inactivity) 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)) + 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) From 0673aa89400dfaf91f9fae94da0b866d3ad85c92 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Wed, 18 Oct 2023 13:13:42 -0700 Subject: [PATCH 5/6] Accurate kick message --- code/controllers/subsystem/inactivity.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/inactivity.dm b/code/controllers/subsystem/inactivity.dm index f65fa98d1c8f..7e861bd15bce 100644 --- a/code/controllers/subsystem/inactivity.dm +++ b/code/controllers/subsystem/inactivity.dm @@ -21,5 +21,5 @@ SUBSYSTEM_DEF(inactivity) 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.")) + to_chat(current, SPAN_WARNING("You have been inactive for more than [INACTIVITY_KICK / 600] minutes and have been disconnected.")) qdel(current) From ec5cc00de5999fba5e17760f658d610aa6636b9e Mon Sep 17 00:00:00 2001 From: Drulikar Date: Wed, 18 Oct 2023 13:13:55 -0700 Subject: [PATCH 6/6] Check player_list as well --- code/controllers/subsystem/inactivity.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/controllers/subsystem/inactivity.dm b/code/controllers/subsystem/inactivity.dm index 7e861bd15bce..5edd4e8c5294 100644 --- a/code/controllers/subsystem/inactivity.dm +++ b/code/controllers/subsystem/inactivity.dm @@ -8,9 +8,10 @@ SUBSYSTEM_DEF(inactivity) runlevels = RUNLEVELS_DEFAULT|RUNLEVEL_LOBBY /datum/controller/subsystem/inactivity/fire(resumed = FALSE) - // Maybe we should just get a SS to bandaid all important global lists like this? 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