mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
Inactivity process tweaks.
Partially by request: The inactive check process now respects client holder status and can be configured how long clients may remain inactive before being kicked.
This commit is contained in:
@@ -632,8 +632,8 @@
|
||||
#include "code\game\objects\items\weapons\tape.dm"
|
||||
#include "code\game\objects\items\weapons\teleportation.dm"
|
||||
#include "code\game\objects\items\weapons\tools.dm"
|
||||
#include "code\game\objects\items\weapons\trays.dm"
|
||||
#include "code\game\objects\items\weapons\traps.dm"
|
||||
#include "code\game\objects\items\weapons\trays.dm"
|
||||
#include "code\game\objects\items\weapons\weaponry.dm"
|
||||
#include "code\game\objects\items\weapons\weldbackpack.dm"
|
||||
#include "code\game\objects\items\weapons\wires.dm"
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
/datum/controller/process/inactivity/setup()
|
||||
name = "inactivity"
|
||||
schedule_interval = INACTIVITY_KICK
|
||||
schedule_interval = 600 // Once every minute (approx.)
|
||||
|
||||
/datum/controller/process/inactivity/doWork()
|
||||
if(config.kick_inactive)
|
||||
for(var/client/C in clients)
|
||||
if(C.is_afk(INACTIVITY_KICK))
|
||||
if(!C.holder && C.is_afk(config.kick_inactive MINUTES))
|
||||
if(!istype(C.mob, /mob/dead))
|
||||
log_access("AFK: [key_name(C)]")
|
||||
C << "<SPAN CLASS='warning'>You have been inactive for more than 10 minutes and have been disconnected.</SPAN>"
|
||||
C << "<SPAN CLASS='warning'>You have been inactive for more than [config.kick_inactive] minute\s and have been disconnected.</SPAN>"
|
||||
del(C) // Don't qdel, cannot override finalize_qdel behaviour for clients.
|
||||
|
||||
scheck()
|
||||
|
||||
#undef INACTIVITY_KICK
|
||||
|
||||
@@ -63,7 +63,7 @@ var/list/gamemode_cache = list()
|
||||
var/guest_jobban = 1
|
||||
var/usewhitelist = 0
|
||||
var/mods_are_mentors = 0
|
||||
var/kick_inactive = 0 //force disconnect for inactive players
|
||||
var/kick_inactive = 0 //force disconnect for inactive players after this many minutes, if non-0
|
||||
var/load_jobs_from_txt = 0
|
||||
var/ToRban = 0
|
||||
var/automute_on = 0 //enables automuting/spam prevention
|
||||
@@ -460,7 +460,7 @@ var/list/gamemode_cache = list()
|
||||
config.allow_random_events = 1
|
||||
|
||||
if("kick_inactive")
|
||||
config.kick_inactive = 1
|
||||
config.kick_inactive = text2num(value)
|
||||
|
||||
if("load_jobs_from_txt")
|
||||
load_jobs_from_txt = 1
|
||||
|
||||
@@ -78,8 +78,6 @@ var/global/datum/global_init/init = new ()
|
||||
spawn(3000) //so we aren't adding to the round-start lag
|
||||
if(config.ToRban)
|
||||
ToRban_autoupdate()
|
||||
/* if(config.kick_inactive) // handled in scheduler
|
||||
KickInactiveClients()*/
|
||||
|
||||
#undef RECOMMENDED_VERSION
|
||||
|
||||
@@ -218,22 +216,6 @@ var/world_topic_spam_protect_time = world.timeofday
|
||||
|
||||
..(reason)
|
||||
|
||||
|
||||
#define INACTIVITY_KICK 6000 //10 minutes in ticks (approx.)
|
||||
/world/proc/KickInactiveClients()
|
||||
spawn(-1)
|
||||
set background = 1
|
||||
while(1)
|
||||
sleep(INACTIVITY_KICK)
|
||||
for(var/client/C in clients)
|
||||
if(C.is_afk(INACTIVITY_KICK))
|
||||
if(!istype(C.mob, /mob/dead))
|
||||
log_access("AFK: [key_name(C)]")
|
||||
C << "\red You have been inactive for more than 10 minutes and have been disconnected."
|
||||
del(C)
|
||||
//#undef INACTIVITY_KICK
|
||||
|
||||
|
||||
/hook/startup/proc/loadMode()
|
||||
world.load_mode()
|
||||
return 1
|
||||
|
||||
@@ -70,8 +70,8 @@ LOG_PDA
|
||||
## sql switching
|
||||
# SQL_ENABLED
|
||||
|
||||
## disconnect players who did nothing during 10 minutes
|
||||
# KICK_INACTIVE
|
||||
## disconnect players who did nothing during the set amount of minutes
|
||||
# KICK_INACTIVE 10
|
||||
|
||||
## Use Mentors instead of Moderators. Mentors are designed with the idea that
|
||||
###they help in pushing new people to be better at roleplay. If you uncomment
|
||||
|
||||
Reference in New Issue
Block a user