aboutsummaryrefslogtreecommitdiff
path: root/advtrains
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2019-01-22 21:42:07 +0100
committerorwell96 <orwell@bleipb.de>2019-01-22 21:42:07 +0100
commit9bdddb619b3872285e6d335e62854de3360178b4 (patch)
tree09e19ee71b10b8b0b230eeb8e775b028a6b83fef /advtrains
parent7537d2026f71ee7dd43f62812d3e8f8e7454f4d2 (diff)
downloadadvtrains-9bdddb619b3872285e6d335e62854de3360178b4.tar.gz
advtrains-9bdddb619b3872285e6d335e62854de3360178b4.tar.bz2
advtrains-9bdddb619b3872285e6d335e62854de3360178b4.zip
output step distance in train (debugging purposes)
Diffstat (limited to 'advtrains')
-rw-r--r--advtrains/trainlogic.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/advtrains/trainlogic.lua b/advtrains/trainlogic.lua
index 7b2e79a..205f4d8 100644
--- a/advtrains/trainlogic.lua
+++ b/advtrains/trainlogic.lua
@@ -463,7 +463,14 @@ function advtrains.train_step_b(id, train, dtime)
--- 4. move train ---
- train.index=train.index and train.index+((train.velocity/(train.path_dist[math.floor(train.index)] or 1))*dtime) or 0
+ local pdist = train.path_dist[math.floor(train.index)] or 1
+ local distance = (train.velocity*dtime) / pdist
+
+ --TODO debugging code
+ train.debug = "step_dist: "..math.floor(distance*1000)
+
+ train.index=train.index+distance
+
recalc_end_index(train)
end