mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-29 15:08:02 +01:00
Merge branch 'master' of https://github.com/ParadiseSS13/Paradise into turfs
# Conflicts: # icons/obj/vending.dmi # paradise.dme
This commit is contained in:
+21
-11
@@ -1904,17 +1904,27 @@ var/mob/dview/dview_mob = new
|
||||
return matches
|
||||
|
||||
//Key thing that stops lag. Cornerstone of performance in ss13, Just sitting here, in unsorted.dm.
|
||||
/proc/stoplag()
|
||||
. = 1
|
||||
sleep(world.tick_lag)
|
||||
if(world.tick_usage > TICK_LIMIT_TO_RUN) //woke up, still not enough tick, sleep for more.
|
||||
. += 2
|
||||
sleep(world.tick_lag*2)
|
||||
if(world.tick_usage > TICK_LIMIT_TO_RUN) //woke up, STILL not enough tick, sleep for more.
|
||||
. += 4
|
||||
sleep(world.tick_lag*4)
|
||||
//you might be thinking of adding more steps to this, or making it use a loop and a counter var
|
||||
// not worth it.
|
||||
|
||||
//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
|
||||
|
||||
// This proc gets a list of all "points of interest" (poi's) that can be used by admins to track valuable mobs or atoms (such as the nuke disk).
|
||||
/proc/getpois(mobs_only=0,skip_mindless=0)
|
||||
|
||||
Reference in New Issue
Block a user