From c6e0c95f4205054b446d2016c3d2e78fb5b095fd Mon Sep 17 00:00:00 2001 From: LetterJay Date: Tue, 2 May 2017 09:17:52 -0500 Subject: [PATCH] heh. --- code/controllers/subsystem/server_maint.dm | 32 ++++++++++++++++------ 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/code/controllers/subsystem/server_maint.dm b/code/controllers/subsystem/server_maint.dm index 3ef088b328..08f60d23e6 100644 --- a/code/controllers/subsystem/server_maint.dm +++ b/code/controllers/subsystem/server_maint.dm @@ -1,17 +1,28 @@ +#define PING_BUFFER_TIME 25 + SUBSYSTEM_DEF(server_maint) name = "Server Tasks" - wait = 6000 - flags = SS_NO_TICK_CHECK + wait = 6 + flags = SS_POST_FIRE_TIMING|SS_FIRE_IN_LOBBY + priority = 10 + var/list/currentrun /datum/controller/subsystem/server_maint/Initialize(timeofday) if (config.hub) world.visibility = 1 ..() -/datum/controller/subsystem/server_maint/fire() - //handle kicking inactive players - if(config.kick_inactive) - for(var/client/C in GLOB.clients) +/datum/controller/subsystem/server_maint/fire(resumed = FALSE) + if(!resumed) + src.currentrun = GLOB.clients.Copy() + + var/list/currentrun = src.currentrun + var/round_started = SSticker.HasRoundStarted() + + for(var/I in currentrun) + var/client/C = I + //handle kicking inactive players + if(round_started && config.kick_inactive) if(C.is_afk(config.afk_period)) var/cmob = C.mob if(!(istype(cmob, /mob/dead/observer) || (istype(cmob, /mob/dead) && C.holder))) @@ -19,5 +30,10 @@ SUBSYSTEM_DEF(server_maint) to_chat(C, "You have been inactive for more than [config.afk_period / 600] minutes and have been disconnected.") qdel(C) - if(config.sql_enabled) - sql_poll_population() + if (!(!C || world.time - C.connection_time < PING_BUFFER_TIME || C.inactivity >= (wait-1))) + winset(C, null, "command=.update_ping+[world.time+world.tick_lag*world.tick_usage/100]") + + if (MC_TICK_CHECK) //one day, when ss13 has 1000 people per server, you guys are gonna be glad I added this tick check + return + +#undef PING_BUFFER_TIME