From e3b70469687116437e90aedf0b0be61cf4a8dc3e Mon Sep 17 00:00:00 2001 From: orwell96 Date: Mon, 18 Dec 2017 23:44:01 +0100 Subject: Remove path invalidation statement. Caused problems on multiple detector rails in a row, because paths got cleared in-between a train step Also optimize some code --- advtrains/nodedb.lua | 3 --- advtrains/trainlogic.lua | 2 +- advtrains/wagons.lua | 7 +++---- 3 files changed, 4 insertions(+), 8 deletions(-) (limited to 'advtrains') diff --git a/advtrains/nodedb.lua b/advtrains/nodedb.lua index a4fbf0a..ab49192 100644 --- a/advtrains/nodedb.lua +++ b/advtrains/nodedb.lua @@ -135,9 +135,6 @@ end function ndb.swap_node(pos, node, no_inval) minetest.swap_node(pos, node) ndb.update(pos, node) - if not no_inval then - advtrains.invalidate_all_paths(pos) - end end function ndb.update(pos, pnode) diff --git a/advtrains/trainlogic.lua b/advtrains/trainlogic.lua index d98c9e8..a72d246 100644 --- a/advtrains/trainlogic.lua +++ b/advtrains/trainlogic.lua @@ -433,7 +433,7 @@ 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 + if not train.index or not train.end_index then return end diff --git a/advtrains/wagons.lua b/advtrains/wagons.lua index 415665e..b75ca50 100644 --- a/advtrains/wagons.lua +++ b/advtrains/wagons.lua @@ -301,10 +301,10 @@ function wagon:on_step(dtime) --check infotext local outside=self:train().text_outside or "" - local train = self:train() + local gp=self:train() --show off-track information in outside text instead of notifying the whole server about this - local front_off_track=train.max_index_on_track and train.index and train.index>train.max_index_on_track - local back_off_track=train.min_index_on_track and train.end_index and train.end_indexgp.max_index_on_track + local back_off_track=gp.min_index_on_track and gp.end_index and gp.end_index