mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-16 21:22:40 +00:00
Ports ping verb from /tg/ (#7837)
* Ports ping verb from /tg/ * Adds non-versioned files * Removes old flag
This commit is contained in:
@@ -57,6 +57,7 @@ var/global/list/runlevel_flags = list(RUNLEVEL_LOBBY, RUNLEVEL_SETUP, RUNLEVEL_G
|
|||||||
#define INIT_ORDER_SKYBOX 30
|
#define INIT_ORDER_SKYBOX 30
|
||||||
#define INIT_ORDER_MAPPING 25
|
#define INIT_ORDER_MAPPING 25
|
||||||
#define INIT_ORDER_DECALS 20
|
#define INIT_ORDER_DECALS 20
|
||||||
|
#define INIT_ORDER_PING 18
|
||||||
#define INIT_ORDER_JOB 17
|
#define INIT_ORDER_JOB 17
|
||||||
#define INIT_ORDER_ALARM 16 // Must initialize before atoms.
|
#define INIT_ORDER_ALARM 16 // Must initialize before atoms.
|
||||||
#define INIT_ORDER_ATOMS 15
|
#define INIT_ORDER_ATOMS 15
|
||||||
@@ -89,6 +90,7 @@ var/global/list/runlevel_flags = list(RUNLEVEL_LOBBY, RUNLEVEL_SETUP, RUNLEVEL_G
|
|||||||
#define FIRE_PRIORITY_NIGHTSHIFT 5
|
#define FIRE_PRIORITY_NIGHTSHIFT 5
|
||||||
#define FIRE_PRIORITY_ORBIT 8
|
#define FIRE_PRIORITY_ORBIT 8
|
||||||
#define FIRE_PRIORITY_VOTE 9
|
#define FIRE_PRIORITY_VOTE 9
|
||||||
|
#define FIRE_PRIORITY_PING 9
|
||||||
#define FIRE_PRIORITY_AI 10
|
#define FIRE_PRIORITY_AI 10
|
||||||
#define FIRE_PRIORITY_GARBAGE 15
|
#define FIRE_PRIORITY_GARBAGE 15
|
||||||
#define FIRE_PRIORITY_ALARM 20
|
#define FIRE_PRIORITY_ALARM 20
|
||||||
|
|||||||
30
code/controllers/subsystems/ping.dm
Normal file
30
code/controllers/subsystems/ping.dm
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
#define PING_BUFFER_TIME 25
|
||||||
|
|
||||||
|
SUBSYSTEM_DEF(ping)
|
||||||
|
name = "Ping"
|
||||||
|
wait = 6
|
||||||
|
flags = SS_NO_INIT|SS_POST_FIRE_TIMING
|
||||||
|
priority = FIRE_PRIORITY_PING
|
||||||
|
init_order = INIT_ORDER_PING
|
||||||
|
runlevels = RUNLEVEL_LOBBY|RUNLEVEL_SETUP|RUNLEVEL_GAME|RUNLEVEL_POSTGAME
|
||||||
|
var/list/currentrun
|
||||||
|
|
||||||
|
/datum/controller/subsystem/ping/fire(resumed = FALSE)
|
||||||
|
if (!resumed)
|
||||||
|
src.currentrun = GLOB.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)
|
||||||
|
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
|
||||||
@@ -73,3 +73,6 @@
|
|||||||
var/connection_realtime
|
var/connection_realtime
|
||||||
///world.timeofday they connected
|
///world.timeofday they connected
|
||||||
var/connection_timeofday
|
var/connection_timeofday
|
||||||
|
|
||||||
|
var/lastping = 0
|
||||||
|
var/avgping = 0
|
||||||
|
|||||||
@@ -66,6 +66,8 @@
|
|||||||
entry += "[round(seconds / 60)] minutes, "
|
entry += "[round(seconds / 60)] minutes, "
|
||||||
entry += "[seconds % 60] seconds)"
|
entry += "[seconds % 60] seconds)"
|
||||||
|
|
||||||
|
entry += "</td><td>"
|
||||||
|
entry += " ([round(C.avgping, 1)]ms)"
|
||||||
entry += "</td><td>"
|
entry += "</td><td>"
|
||||||
entry += " (<A HREF='?_src_=holder;adminmoreinfo=\ref[C.mob]'>?</A>)"
|
entry += " (<A HREF='?_src_=holder;adminmoreinfo=\ref[C.mob]'>?</A>)"
|
||||||
entry += "</td></tr>"
|
entry += "</td></tr>"
|
||||||
@@ -85,6 +87,8 @@
|
|||||||
entry += " - <span class='blue'>In Lobby</span><br>"
|
entry += " - <span class='blue'>In Lobby</span><br>"
|
||||||
else
|
else
|
||||||
entry += " - <span class='green'>Playing</span><br>"
|
entry += " - <span class='green'>Playing</span><br>"
|
||||||
|
|
||||||
|
entry += " ([round(C.avgping, 1)]ms)"
|
||||||
Lines += entry
|
Lines += entry
|
||||||
|
|
||||||
msg += "<table>"
|
msg += "<table>"
|
||||||
22
code/modules/client/verbs/ping.dm
Normal file
22
code/modules/client/verbs/ping.dm
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/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*world.tick_usage/100)-time)*100
|
||||||
|
|
||||||
|
/client/verb/display_ping(time as num)
|
||||||
|
set instant = TRUE
|
||||||
|
set name = ".display_ping"
|
||||||
|
to_chat(src, "<span class='notice'>Round trip ping took [round(pingfromtime(time),1)]ms</span>")
|
||||||
|
|
||||||
|
/client/verb/ping()
|
||||||
|
set name = "Ping"
|
||||||
|
set category = "OOC"
|
||||||
|
winset(src, null, "command=.display_ping+[world.time+world.tick_lag*world.tick_usage/100]")
|
||||||
@@ -49,13 +49,17 @@
|
|||||||
entry += "[seconds % 60] seconds)"
|
entry += "[seconds % 60] seconds)"
|
||||||
|
|
||||||
entry += " (<A HREF='?_src_=holder;adminmoreinfo=\ref[C.mob]'>?</A>)"
|
entry += " (<A HREF='?_src_=holder;adminmoreinfo=\ref[C.mob]'>?</A>)"
|
||||||
|
entry += " ([round(C.avgping, 1)]ms)"
|
||||||
Lines += entry
|
Lines += entry
|
||||||
else
|
else
|
||||||
for(var/client/C in GLOB.clients)
|
for(var/client/C in GLOB.clients)
|
||||||
|
var/entry
|
||||||
if(C.holder && C.holder.fakekey)
|
if(C.holder && C.holder.fakekey)
|
||||||
Lines += C.holder.fakekey
|
entry = C.holder.fakekey
|
||||||
else
|
else
|
||||||
Lines += C.key
|
entry = C.key
|
||||||
|
entry += " ([round(C.avgping, 1)]ms)"
|
||||||
|
Lines += entry
|
||||||
|
|
||||||
for(var/line in sortList(Lines))
|
for(var/line in sortList(Lines))
|
||||||
msg += "[line]\n"
|
msg += "[line]\n"
|
||||||
@@ -627,6 +627,8 @@
|
|||||||
|
|
||||||
if(.)
|
if(.)
|
||||||
if(statpanel("Status"))
|
if(statpanel("Status"))
|
||||||
|
if(client)
|
||||||
|
stat(null, "Ping: [round(client.lastping, 1)]ms (Average: [round(client.avgping, 1)]ms)")
|
||||||
stat(null, "Time Dilation: [round(SStime_track.time_dilation_current,1)]% AVG:([round(SStime_track.time_dilation_avg_fast,1)]%, [round(SStime_track.time_dilation_avg,1)]%, [round(SStime_track.time_dilation_avg_slow,1)]%)")
|
stat(null, "Time Dilation: [round(SStime_track.time_dilation_current,1)]% AVG:([round(SStime_track.time_dilation_avg_fast,1)]%, [round(SStime_track.time_dilation_avg,1)]%, [round(SStime_track.time_dilation_avg_slow,1)]%)")
|
||||||
if(ticker && ticker.current_state != GAME_STATE_PREGAME)
|
if(ticker && ticker.current_state != GAME_STATE_PREGAME)
|
||||||
stat("Station Time", stationtime2text())
|
stat("Station Time", stationtime2text())
|
||||||
|
|||||||
14
polaris.dme
14
polaris.dme
@@ -235,6 +235,7 @@
|
|||||||
#include "code\controllers\subsystems\orbits.dm"
|
#include "code\controllers\subsystems\orbits.dm"
|
||||||
#include "code\controllers\subsystems\overlays.dm"
|
#include "code\controllers\subsystems\overlays.dm"
|
||||||
#include "code\controllers\subsystems\persistence.dm"
|
#include "code\controllers\subsystems\persistence.dm"
|
||||||
|
#include "code\controllers\subsystems\ping.dm"
|
||||||
#include "code\controllers\subsystems\planets.dm"
|
#include "code\controllers\subsystems\planets.dm"
|
||||||
#include "code\controllers\subsystems\radiation.dm"
|
#include "code\controllers\subsystems\radiation.dm"
|
||||||
#include "code\controllers\subsystems\shuttles.dm"
|
#include "code\controllers\subsystems\shuttles.dm"
|
||||||
@@ -1335,11 +1336,7 @@
|
|||||||
#include "code\game\turfs\unsimulated\planetary.dm"
|
#include "code\game\turfs\unsimulated\planetary.dm"
|
||||||
#include "code\game\turfs\unsimulated\shuttle.dm"
|
#include "code\game\turfs\unsimulated\shuttle.dm"
|
||||||
#include "code\game\turfs\unsimulated\walls.dm"
|
#include "code\game\turfs\unsimulated\walls.dm"
|
||||||
#include "code\game\verbs\advanced_who.dm"
|
|
||||||
#include "code\game\verbs\ignore.dm"
|
|
||||||
#include "code\game\verbs\ooc.dm"
|
|
||||||
#include "code\game\verbs\suicide.dm"
|
#include "code\game\verbs\suicide.dm"
|
||||||
#include "code\game\verbs\who.dm"
|
|
||||||
#include "code\js\byjax.dm"
|
#include "code\js\byjax.dm"
|
||||||
#include "code\js\menus.dm"
|
#include "code\js\menus.dm"
|
||||||
#include "code\modules\admin\admin.dm"
|
#include "code\modules\admin\admin.dm"
|
||||||
@@ -1462,8 +1459,8 @@
|
|||||||
#include "code\modules\ai\ai_holder_targeting.dm"
|
#include "code\modules\ai\ai_holder_targeting.dm"
|
||||||
#include "code\modules\ai\interfaces.dm"
|
#include "code\modules\ai\interfaces.dm"
|
||||||
#include "code\modules\ai\say_list.dm"
|
#include "code\modules\ai\say_list.dm"
|
||||||
#include "code\modules\ai\aI_holder_subtypes\simple_mob_ai.dm"
|
#include "code\modules\ai\ai_holder_subtypes\simple_mob_ai.dm"
|
||||||
#include "code\modules\ai\aI_holder_subtypes\slime_xenobio_ai.dm"
|
#include "code\modules\ai\ai_holder_subtypes\slime_xenobio_ai.dm"
|
||||||
#include "code\modules\alarm\alarm.dm"
|
#include "code\modules\alarm\alarm.dm"
|
||||||
#include "code\modules\alarm\alarm_handler.dm"
|
#include "code\modules\alarm\alarm_handler.dm"
|
||||||
#include "code\modules\alarm\atmosphere_alarm.dm"
|
#include "code\modules\alarm\atmosphere_alarm.dm"
|
||||||
@@ -1581,6 +1578,11 @@
|
|||||||
#include "code\modules\client\preference_setup\traits\trait_defines.dm"
|
#include "code\modules\client\preference_setup\traits\trait_defines.dm"
|
||||||
#include "code\modules\client\preference_setup\traits\traits.dm"
|
#include "code\modules\client\preference_setup\traits\traits.dm"
|
||||||
#include "code\modules\client\preference_setup\volume_sliders\01_volume.dm"
|
#include "code\modules\client\preference_setup\volume_sliders\01_volume.dm"
|
||||||
|
#include "code\modules\client\verbs\advanced_who.dm"
|
||||||
|
#include "code\modules\client\verbs\ignore.dm"
|
||||||
|
#include "code\modules\client\verbs\ooc.dm"
|
||||||
|
#include "code\modules\client\verbs\ping.dm"
|
||||||
|
#include "code\modules\client\verbs\who.dm"
|
||||||
#include "code\modules\clothing\chameleon.dm"
|
#include "code\modules\clothing\chameleon.dm"
|
||||||
#include "code\modules\clothing\clothing.dm"
|
#include "code\modules\clothing\clothing.dm"
|
||||||
#include "code\modules\clothing\clothing_accessories.dm"
|
#include "code\modules\clothing\clothing_accessories.dm"
|
||||||
|
|||||||
Reference in New Issue
Block a user