Make dtime limiting a setting
parent
672b4a422c
commit
080fbcf2fc
|
@ -48,11 +48,11 @@ advtrains.IGNORE_WORLD = false
|
|||
local NO_SAVE = false
|
||||
-- Do not save any data to advtrains save files
|
||||
|
||||
-- Use a global slowdown factor to slow down train movements.
|
||||
local USE_SLOWDOWN = false
|
||||
local DTIME_LIMIT = 0.3
|
||||
-- ==========================================================================
|
||||
|
||||
-- Use a global slowdown factor to slow down train movements. Now a setting
|
||||
local DTIME_LIMIT = tonumber(minetest.settings:get("advtrains_dtime_limit")) or 0.2
|
||||
|
||||
|
||||
--Constant for maximum connection value/division of the circle
|
||||
AT_CMAX = 16
|
||||
|
@ -593,7 +593,7 @@ minetest.register_globalstep(function(dtime_mt)
|
|||
t = os.clock()+HOW_MANY_LAG
|
||||
end
|
||||
-- if dtime is too high, decrease global slowdown
|
||||
if USE_SLOWDOWN then
|
||||
if DTIME_LIMIT~=0 then
|
||||
if dtime > DTIME_LIMIT then
|
||||
if advtrains.global_slowdown > 0.1 then
|
||||
advtrains.global_slowdown = advtrains.global_slowdown - 0.05
|
||||
|
@ -602,9 +602,9 @@ minetest.register_globalstep(function(dtime_mt)
|
|||
end
|
||||
dtime = DTIME_LIMIT
|
||||
end
|
||||
-- recover global slowdown slowly over time
|
||||
advtrains.global_slowdown = math.min(advtrains.global_slowdown*1.02, 1)
|
||||
end
|
||||
-- recover global slowdown slowly over time
|
||||
advtrains.global_slowdown = math.min(advtrains.global_slowdown*1.02, 1)
|
||||
|
||||
advtrains.mainloop_trainlogic(dtime,advtrains.mainloop_runcnt)
|
||||
if advtrains_itm_mainloop then
|
||||
|
|
|
@ -45,3 +45,10 @@ advtrains_overrun_mode (Overrun mode) enum drop none,drop,normal
|
|||
# When a wagon leaves this range + 32 nodes, it is unloaded
|
||||
# If unset, defaults to active_block_range*16
|
||||
advtrains_wagon_load_range (Wagon Entity Load/Unload Range) int 96 32 512
|
||||
|
||||
# Simulation DTime Limit after which slow-down becomes effective
|
||||
# When the dtime value (time since last server step) is higher than this value,
|
||||
# advtrains applies a global slow-down factor to the dtime and to the velocity and
|
||||
# acceleration of wagons to decrease server load.
|
||||
# A value of 0 (default) disables this behavior.
|
||||
advtrains_dtime_limit (DTime Limit for slow-down) float 0.2 0 5
|
||||
|
|
Loading…
Reference in New Issue