Files
GS13NG/code/controllers/subsystem/ping.dm
Poojawa f67e9f6d87 Bleeding edgy refresh (#303)
* not code stuff

* other things

* global vars, defines, helpers

* onclick hud stuff, orphans, world.dm

* controllers and datums

* game folder

* everything not client/mobs in modules

* client folder

* stage 1 mob stuff

* simple animal things

* silicons

* carbon things

* ayylmaos and monkeys

* hyoomahn

* icons n shit

* sprite fixes

* compile fixes

* some fixes I cherrypicked.

* qdel fixes

* forgot brain refractors
2017-03-21 11:44:10 -05:00

34 lines
925 B
Plaintext

#define PING_BUFFER_TIME 25
var/datum/controller/subsystem/ping/SSping
/datum/controller/subsystem/ping
name = "Ping"
wait = 6
flags = SS_NO_INIT|SS_POST_FIRE_TIMING|SS_FIRE_IN_LOBBY
priority = 10
var/list/currentrun
/datum/controller/subsystem/ping/New()
NEW_SS_GLOBAL(SSping)
/datum/controller/subsystem/ping/fire(resumed = FALSE)
if (!resumed)
src.currentrun = clients.Copy()
var/list/currentrun = src.currentrun
while (length(currentrun))
var/client/C = currentrun[currentrun.len]
currentrun.len--
if (!C || world.time - C.connection_time < PING_BUFFER_TIME || C.inactivity >= (wait-1))
if (MC_TICK_CHECK)
return
continue
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
currentrun = null
#undef PING_BUFFER_TIME