mirror of
https://github.com/fulpstation/fulpstation.git
synced 2025-12-09 16:09:15 +00:00
* tgu * updated paths * updating more paths * master server * more repaths * tgu * oh these were defined * y * tgu * fixes fulp shuttles i think * revert * tgu * fix checks and stuff * Update sound.dm * Update tg_edits.md * tgu
24 lines
832 B
Plaintext
24 lines
832 B
Plaintext
//Key thing that stops lag. Cornerstone of performance in ss13, Just sitting here, in unsorted.dm. Now with dedicated file!
|
|
|
|
///Increases delay as the server gets more overloaded, as sleeps aren't cheap and sleeping only to wake up and sleep again is wasteful
|
|
#define DELTA_CALC max(((max(TICK_USAGE, world.cpu) / 100) * max(Master.sleep_delta-1,1)), 1)
|
|
|
|
///returns the number of ticks slept
|
|
/proc/stoplag(initial_delay)
|
|
if (!Master || !(Master.current_runlevel & RUNLEVELS_DEFAULT))
|
|
sleep(world.tick_lag)
|
|
return 1
|
|
if (!initial_delay)
|
|
initial_delay = world.tick_lag
|
|
. = 0
|
|
var/i = DS2TICKS(initial_delay)
|
|
do
|
|
. += CEILING(i * DELTA_CALC, 1)
|
|
sleep(i * world.tick_lag * DELTA_CALC)
|
|
i *= 2
|
|
while (TICK_USAGE > min(TICK_LIMIT_TO_RUN, Master.current_ticklimit))
|
|
|
|
#undef DELTA_CALC
|
|
|
|
#define UNTIL(X) while(!(X)) stoplag()
|