diff options
author | orwell96 <mono96.mml@gmail.com> | 2017-01-29 21:29:48 +0100 |
---|---|---|
committer | orwell96 <mono96.mml@gmail.com> | 2017-01-29 21:50:11 +0100 |
commit | 1648de41145c829ff6626c5157268f74367b257e (patch) | |
tree | 805c66447a558c54eb1860b5ca80226d88b59972 /advtrains | |
parent | 90390dfc98ccc348dd572af101133c7c7a0ff14d (diff) | |
download | advtrains-1648de41145c829ff6626c5157268f74367b257e.tar.gz advtrains-1648de41145c829ff6626c5157268f74367b257e.tar.bz2 advtrains-1648de41145c829ff6626c5157268f74367b257e.zip |
Limit dtime to prevent trains moving too far in a single step
and update zip
Diffstat (limited to 'advtrains')
-rw-r--r-- | advtrains/advtrains/trainlogic.lua | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/advtrains/advtrains/trainlogic.lua b/advtrains/advtrains/trainlogic.lua index 7238d92..1bc732d 100644 --- a/advtrains/advtrains/trainlogic.lua +++ b/advtrains/advtrains/trainlogic.lua @@ -40,7 +40,14 @@ advtrains.audit_interval=10 advtrains.save_and_audit_timer=advtrains.audit_interval -minetest.register_globalstep(function(dtime) +minetest.register_globalstep(function(dtime_mt) + --limit dtime: if trains move too far in one step, automation may cause stuck and wrongly braking trains + local dtime=dtime_mt + if dtime>0.2 then + atprint("Limiting dtime to 0.2!") + dtime=0.2 + end + advtrains.save_and_audit_timer=advtrains.save_and_audit_timer-dtime if advtrains.save_and_audit_timer<=0 then local t=os.clock() |