mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-11 18:33:36 +00:00
Afk fixup (#412)
This commit is contained in:
committed by
TalkingCactus
parent
f510bf2a03
commit
2373e2e485
@@ -313,10 +313,10 @@
|
||||
|
||||
// Will return a list of active candidates. It increases the buffer 5 times until it finds a candidate which is active within the buffer.
|
||||
|
||||
/proc/get_candidates(be_special_type, afk_bracket=3000, var/jobbanType)
|
||||
/proc/get_candidates(be_special_type, afk_bracket = config.inactivity_period, jobbanType)
|
||||
var/list/candidates = list()
|
||||
// Keep looping until we find a non-afk candidate within the time bracket (we limit the bracket to 10 minutes (6000))
|
||||
while(!candidates.len && afk_bracket < 6000)
|
||||
while(!candidates.len && afk_bracket < config.afk_period)
|
||||
for(var/mob/dead/observer/G in GLOB.player_list)
|
||||
if(G.client != null)
|
||||
if(!(G.mind && G.mind.current && G.mind.current.stat != DEAD))
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
#define BACKGROUND_ENABLED 0 // The default value for all uses of set background. Set background can cause gradual lag and is recommended you only turn this on if necessary.
|
||||
// 1 will enable set background. 0 will disable set background.
|
||||
|
||||
#define INACTIVITY_KICK 6000 //10 minutes in ticks (approx.)
|
||||
|
||||
//ADMIN STUFF
|
||||
#define ROUNDSTART_LOGOUT_REPORT_TIME 6000 //Amount of time (in deciseconds) after the rounds starts, that the player disconnect report is issued.
|
||||
|
||||
|
||||
@@ -66,7 +66,9 @@
|
||||
var/respawn = 1
|
||||
var/guest_jobban = 1
|
||||
var/usewhitelist = 0
|
||||
var/kick_inactive = 0 //force disconnect for inactive players
|
||||
var/inactivity_period = 3000 //time in ds until a player is considered inactive
|
||||
var/afk_period = 6000 //time in ds until a player is considered afk and kickable
|
||||
var/kick_inactive = FALSE //force disconnect for inactive players
|
||||
var/load_jobs_from_txt = 0
|
||||
var/automute_on = 0 //enables automuting/spam prevention
|
||||
var/minimal_access_threshold = 0 //If the number of players is larger than this threshold, minimal access will be turned on.
|
||||
@@ -408,10 +410,12 @@
|
||||
usewhitelist = TRUE
|
||||
if("allow_metadata")
|
||||
allow_Metadata = 1
|
||||
if("inactivity_period")
|
||||
inactivity_period = text2num(value) * 10 //documented as seconds in config.txt
|
||||
if("afk_period")
|
||||
afk_period = text2num(value) * 10 // ^^^
|
||||
if("kick_inactive")
|
||||
if(value < 1)
|
||||
value = INACTIVITY_KICK
|
||||
kick_inactive = value
|
||||
kick_inactive = TRUE
|
||||
if("load_jobs_from_txt")
|
||||
load_jobs_from_txt = 1
|
||||
if("forbid_singulo_possession")
|
||||
|
||||
@@ -10,12 +10,13 @@ SUBSYSTEM_DEF(server_maint)
|
||||
|
||||
/datum/controller/subsystem/server_maint/fire()
|
||||
//handle kicking inactive players
|
||||
if(config.kick_inactive > 0)
|
||||
if(config.kick_inactive)
|
||||
for(var/client/C in GLOB.clients)
|
||||
if(C.is_afk(INACTIVITY_KICK))
|
||||
if(!istype(C.mob, /mob/dead))
|
||||
if(C.is_afk(config.afk_period))
|
||||
var/cmob = C.mob
|
||||
if(!(istype(cmob, /mob/dead/observer) || (istype(cmob, /mob/dead) && C.holder)))
|
||||
log_access("AFK: [key_name(C)]")
|
||||
to_chat(C, "<span class='danger'>You have been inactive for more than 10 minutes and have been disconnected.</span>")
|
||||
to_chat(C, "<span class='danger'>You have been inactive for more than [config.afk_period / 600] minutes and have been disconnected.</span>")
|
||||
qdel(C)
|
||||
|
||||
if(config.sql_enabled)
|
||||
|
||||
@@ -549,10 +549,10 @@ GLOBAL_LIST(external_rsc_urls)
|
||||
|
||||
//checks if a client is afk
|
||||
//3000 frames = 5 minutes
|
||||
/client/proc/is_afk(duration=3000)
|
||||
/client/proc/is_afk(duration = config.inactivity_period)
|
||||
if(inactivity > duration)
|
||||
return inactivity
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
// Byond seemingly calls stat, each tick.
|
||||
// Calling things each tick can get expensive real quick.
|
||||
|
||||
@@ -90,7 +90,13 @@ LOG_LAW
|
||||
## As an example of how this could be """useful""" look towards Poly (https://twitter.com/Poly_the_Parrot)
|
||||
# LOG_TWITTER
|
||||
|
||||
## disconnect players who did nothing during 10 minutes
|
||||
## period of time in seconds for players to be considered inactive
|
||||
# INACTIVITY_PERIOD 300
|
||||
|
||||
## period of time in seconds for players to be considered afk and kickable
|
||||
# AFK_PERIOD 600
|
||||
|
||||
## disconnect players who are considered afk
|
||||
# KICK_INACTIVE
|
||||
|
||||
## Comment this out to stop admins being able to choose their personal ooccolor
|
||||
|
||||
Reference in New Issue
Block a user