diff options
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 |