Files
CHOMPStation2/code/modules/client/verbs/ping.dm
CHOMPStation2StaffMirrorBot f72f2f8c89 [MIRROR] Server maint subsystem (#9408)
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
2024-11-04 22:00:41 +01:00

24 lines
646 B
Plaintext

/client/verb/update_ping(time as num)
set instant = TRUE
set name = ".update_ping"
var/ping = pingfromtime(time)
lastping = ping
if (!avgping)
avgping = ping
else
avgping = MC_AVERAGE_SLOW(avgping, ping)
/client/proc/pingfromtime(time)
return ((world.time+world.tick_lag*TICK_USAGE_REAL/100)-time)*100
/client/verb/display_ping(time as num)
set instant = TRUE
set name = ".display_ping"
to_chat(src, span_notice("Round trip ping took [round(pingfromtime(time),1)]ms"))
/client/verb/ping()
set name = "Ping"
set category = "OOC.Debug"
winset(src, null, "command=.display_ping+[world.time+world.tick_lag*TICK_USAGE_REAL/100]")