From 9bdddb619b3872285e6d335e62854de3360178b4 Mon Sep 17 00:00:00 2001 From: orwell96 Date: Tue, 22 Jan 2019 21:42:07 +0100 Subject: output step distance in train (debugging purposes) --- advtrains/trainlogic.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3