Files
Paradise/code/controllers/subsystem/SStime_track.dm
warriorstar-orion 157276d6cb Port /tg/ move manager, drift and jetpack components. (#27698)
* Port /tg/ move manager, drift and jetpack components.

* don't add go through newtonian movement if not moved to a turf

* various cleans for blood drifts and mob speed

* fix slow meteors

* why on fuck's earth aren't speedbikes vehicles

* style lint

* also wtf

* okay i'm an idiot

* fix meaty ore speed and blood decal double stepping

* fix not unbuckling pulled object occupants

* don't bother dealing with immovable rods just yet

* exclude bubblegum and vetus from move manager for now

* fix issues related to null weightless blood icons

* reset blood icon state properly

* fuck it, we'll deal with mobs when basic mobs happen

* break infinite loop in decal splat
2025-01-22 22:49:58 +00:00

48 lines
1.6 KiB
Plaintext

SUBSYSTEM_DEF(time_track)
name = "Time Tracking"
wait = 10 SECONDS
runlevels = RUNLEVEL_LOBBY | RUNLEVELS_DEFAULT
flags = SS_NO_INIT
var/time_dilation_current = 0
var/time_dilation_avg_fast = 0
var/time_dilation_avg = 0
var/time_dilation_avg_slow = 0
var/first_run = TRUE
var/last_tick_realtime = 0
var/last_tick_byond_time = 0
var/last_tick_tickcount = 0
cpu_display = SS_CPUDISPLAY_LOW
/datum/controller/subsystem/time_track/fire()
var/current_realtime = REALTIMEOFDAY
var/current_byondtime = world.time
var/current_tickcount = world.time / world.tick_lag
if(!first_run)
var/tick_drift = max(0, (((current_realtime - last_tick_realtime) - (current_byondtime - last_tick_byond_time)) / world.tick_lag))
time_dilation_current = tick_drift / (current_tickcount - last_tick_tickcount) * 100
time_dilation_avg_fast = MC_AVERAGE_FAST(time_dilation_avg_fast, time_dilation_current)
time_dilation_avg = MC_AVERAGE(time_dilation_avg, time_dilation_avg_fast)
time_dilation_avg_slow = MC_AVERAGE_SLOW(time_dilation_avg_slow, time_dilation_avg)
GLOB.glide_size_multiplier = (current_byondtime - last_tick_byond_time) / (current_realtime - last_tick_realtime)
else
first_run = FALSE
last_tick_realtime = current_realtime
last_tick_byond_time = current_byondtime
last_tick_tickcount = current_tickcount
/datum/controller/subsystem/time_track/get_metrics()
. = ..()
.["custom"] = list(
"time_dilation_current" = time_dilation_current,
"time_dilation_avg_fast" = time_dilation_avg_fast,
"time_dilation_avg" = time_dilation_avg,
"time_dilation_avg_slow" = time_dilation_avg_slow,
)