Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bandaid the null clients in GLOB.clients #4700

Merged
merged 6 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions code/controllers/subsystem/inactivity.dm
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
#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
Drulikar marked this conversation as resolved.
Show resolved Hide resolved
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)
// Maybe we should just get a SS to bandaid all important global lists like this?
Drulikar marked this conversation as resolved.
Show resolved Hide resolved
if(list_clear_nulls(GLOB.clients))
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)
3 changes: 3 additions & 0 deletions code/controllers/subsystem/statpanel.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down