diff options
author | orwell96 <orwell@bleipb.de> | 2019-01-22 21:42:07 +0100 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2019-01-22 21:42:07 +0100 |
commit | 9bdddb619b3872285e6d335e62854de3360178b4 (patch) | |
tree | 09e19ee71b10b8b0b230eeb8e775b028a6b83fef /advtrains/trainlogic.lua | |
parent | 7537d2026f71ee7dd43f62812d3e8f8e7454f4d2 (diff) | |
download | advtrains-9bdddb619b3872285e6d335e62854de3360178b4.tar.gz advtrains-9bdddb619b3872285e6d335e62854de3360178b4.tar.bz2 advtrains-9bdddb619b3872285e6d335e62854de3360178b4.zip |
output step distance in train (debugging purposes)
Diffstat (limited to 'advtrains/trainlogic.lua')
-rw-r--r-- | advtrains/trainlogic.lua | 9 |
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 |