aboutsummaryrefslogtreecommitdiff
path: root/advtrains/init.lua
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2020-04-28 16:01:35 +0200
committerorwell96 <orwell@bleipb.de>2021-02-10 16:36:24 +0100
commit8660794ef8392f08fa5be46715abb5dcbd96ca5d (patch)
treef077c3f12f901ed41061ee2672c62d53d5d2c27e /advtrains/init.lua
parent5c2534cc35bc0fc47b53c8a992e3e71b15a60ec4 (diff)
downloadadvtrains-8660794ef8392f08fa5be46715abb5dcbd96ca5d.tar.gz
advtrains-8660794ef8392f08fa5be46715abb5dcbd96ca5d.tar.bz2
advtrains-8660794ef8392f08fa5be46715abb5dcbd96ca5d.zip
Fix lots of things around new LZB
Diffstat (limited to 'advtrains/init.lua')
-rw-r--r--advtrains/init.lua17
1 files changed, 6 insertions, 11 deletions
diff --git a/advtrains/init.lua b/advtrains/init.lua
index 06ac66b..fead01e 100644
--- a/advtrains/init.lua
+++ b/advtrains/init.lua
@@ -27,8 +27,10 @@ attrans = minetest.get_translator ("advtrains")
--advtrains
-DUMP_DEBUG_SAVE = false
-GENERATE_ATRICIFIAL_LAG = false
+local DUMP_DEBUG_SAVE = false
+local GENERATE_ATRICIFIAL_LAG = false
+local HOW_MANY_LAG = 1.0
+
--Constant for maximum connection value/division of the circle
AT_CMAX = 16
@@ -563,19 +565,12 @@ minetest.register_globalstep(function(dtime_mt)
local dtime
if GENERATE_ATRICIFIAL_LAG then
- dtime = 0.2
+ dtime = HOW_MANY_LAG
if os.clock()<t then
return
end
- t = os.clock()+0.2
- else
- --limit dtime: if trains move too far in one step, automation may cause stuck and wrongly braking trains
- dtime=dtime_mt
- if dtime>0.2 then
- atprint("Limiting dtime to 0.2!")
- dtime=0.2
- end
+ t = os.clock()+HOW_MANY_LAG
end
advtrains.mainloop_trainlogic(dtime)