aboutsummaryrefslogtreecommitdiff
path: root/advtrains
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2021-02-15 19:41:13 +0100
committerorwell96 <orwell@bleipb.de>2021-02-15 19:41:13 +0100
commit0bffd6ca647e3a332e66555e1a5d9866442cf6ef (patch)
tree95f36f89478fe6fc0b40ed231d213ba534930c1f /advtrains
parent556984940124c671c617fce1e81433dae39184f3 (diff)
downloadadvtrains-0bffd6ca647e3a332e66555e1a5d9866442cf6ef.tar.gz
advtrains-0bffd6ca647e3a332e66555e1a5d9866442cf6ef.tar.bz2
advtrains-0bffd6ca647e3a332e66555e1a5d9866442cf6ef.zip
Make DTIME_LIMIT and SAVE_INTERVAL globally accessible
Diffstat (limited to 'advtrains')
-rw-r--r--advtrains/init.lua14
1 files changed, 7 insertions, 7 deletions
diff --git a/advtrains/init.lua b/advtrains/init.lua
index 2e10530..7cc0ccd 100644
--- a/advtrains/init.lua
+++ b/advtrains/init.lua
@@ -51,8 +51,8 @@ local NO_SAVE = false
-- ==========================================================================
-- 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
-local SAVE_INTERVAL = tonumber(minetest.settings:get("advtrains_save_interval")) or 60
+advtrains.DTIME_LIMIT = tonumber(minetest.settings:get("advtrains_dtime_limit")) or 0.2
+advtrains.SAVE_INTERVAL = tonumber(minetest.settings:get("advtrains_save_interval")) or 60
--Constant for maximum connection value/division of the circle
AT_CMAX = 16
@@ -564,7 +564,7 @@ end
--## MAIN LOOP ##--
--Calls all subsequent main tasks of both advtrains and atlatc
local init_load=false
-local save_timer = SAVE_INTERVAL
+local save_timer = advtrains.SAVE_INTERVAL
advtrains.mainloop_runcnt=0
advtrains.global_slowdown = 1
@@ -592,14 +592,14 @@ minetest.register_globalstep(function(dtime_mt)
t = os.clock()+HOW_MANY_LAG
end
-- if dtime is too high, decrease global slowdown
- if DTIME_LIMIT~=0 then
- if dtime > DTIME_LIMIT then
+ if advtrains.DTIME_LIMIT~=0 then
+ if dtime > advtrains.DTIME_LIMIT then
if advtrains.global_slowdown > 0.1 then
advtrains.global_slowdown = advtrains.global_slowdown - 0.05
else
advtrains.global_slowdown = advtrains.global_slowdown / 2
end
- dtime = DTIME_LIMIT
+ dtime = advtrains.DTIME_LIMIT
end
-- recover global slowdown slowly over time
advtrains.global_slowdown = math.min(advtrains.global_slowdown*1.02, 1)
@@ -623,7 +623,7 @@ minetest.register_globalstep(function(dtime_mt)
local t=os.clock()
--save
advtrains.save()
- save_timer = SAVE_INTERVAL
+ save_timer = advtrains.SAVE_INTERVAL
atprintbm("saving", t)
end
end)