diff options
author | orwell96 <mono96.mml@gmail.com> | 2017-02-15 19:45:43 +0100 |
---|---|---|
committer | orwell96 <mono96.mml@gmail.com> | 2017-02-15 19:45:43 +0100 |
commit | 5b7a06fe0faba5f037a0b2e602284674fb0b3fb1 (patch) | |
tree | fb8180f84d0ed46a19effdb0fba7ab9de8245b76 | |
parent | 3f382974b85c99fdd9b985cba20b19dded42dd6b (diff) | |
download | advtrains-5b7a06fe0faba5f037a0b2e602284674fb0b3fb1.tar.gz advtrains-5b7a06fe0faba5f037a0b2e602284674fb0b3fb1.tar.bz2 advtrains-5b7a06fe0faba5f037a0b2e602284674fb0b3fb1.zip |
fix #34 - end_index not set when step_a returned in phase 2
-rw-r--r-- | advtrains.zip | bin | 5122882 -> 5122950 bytes | |||
-rw-r--r-- | advtrains/advtrains/trainlogic.lua | 10 |
2 files changed, 8 insertions, 2 deletions
diff --git a/advtrains.zip b/advtrains.zip Binary files differindex 6652233..cf335d3 100644 --- a/advtrains.zip +++ b/advtrains.zip 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) |