Skip to content

Commit

Permalink
Use inactivity SS to clear nulls
Browse files Browse the repository at this point in the history
  • Loading branch information
Drulikar committed Oct 17, 2023
1 parent 27b88ba commit bbbc02c
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions code/controllers/subsystem/inactivity.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit bbbc02c

Please sign in to comment.