aboutsummaryrefslogtreecommitdiff
path: root/advtrains
diff options
context:
space:
mode:
Diffstat (limited to 'advtrains')
-rw-r--r--advtrains/advtrains/trainlogic.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/advtrains/advtrains/trainlogic.lua b/advtrains/advtrains/trainlogic.lua
index 0b28129..f0295d1 100644
--- a/advtrains/advtrains/trainlogic.lua
+++ b/advtrains/advtrains/trainlogic.lua
@@ -165,7 +165,7 @@ function advtrains.train_step_a(id, train, dtime)
if node_ok==nil then
--block not loaded, do nothing
- atprint("last_pos not available")
+ atprint("last_pos", advtrains.round_vector_floor_y(train.last_pos), "not loaded and not in ndb, waiting")
return nil
elseif node_ok==false then
atprint("no track here, (fail) removing train.")
@@ -184,7 +184,7 @@ function advtrains.train_step_a(id, train, dtime)
if prevnode_ok==nil then
--block not loaded, do nothing
- atprint("prev not available")
+ atprint("last_pos_prev", advtrains.round_vector_floor_y(train.last_pos_prev), "not loaded and not in ndb, waiting")
return nil
elseif prevnode_ok==false then
atprint("no track at prev, (fail) removing train.")
@@ -483,6 +483,12 @@ end
function advtrains.train_step_b(id, train, dtime)
+ --hacky fix: if train_step_a returned in phase 2, end_index may not be set.
+ --just return
+ if not train.end_index then
+ return
+ end
+
--- 8. check for collisions with other trains and damage players ---
local train_moves=(train.velocity~=0)