aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2017-12-18 23:44:01 +0100
committerorwell96 <orwell@bleipb.de>2017-12-18 23:44:01 +0100
commite3b70469687116437e90aedf0b0be61cf4a8dc3e (patch)
treebf631aff79a4c3710ef20a13ac11abec7c2ab756
parent8a51a10a61626c2190b32f06a52dbe20cdf1d04c (diff)
downloadadvtrains-e3b70469687116437e90aedf0b0be61cf4a8dc3e.tar.gz
advtrains-e3b70469687116437e90aedf0b0be61cf4a8dc3e.tar.bz2
advtrains-e3b70469687116437e90aedf0b0be61cf4a8dc3e.zip
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
-rw-r--r--advtrains/nodedb.lua3
-rw-r--r--advtrains/trainlogic.lua2
-rw-r--r--advtrains/wagons.lua7
3 files changed, 4 insertions, 8 deletions
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_index<train.min_index_on_track
+ local front_off_track=gp.max_index_on_track and gp.index and gp.index>gp.max_index_on_track
+ local back_off_track=gp.min_index_on_track and gp.end_index and gp.end_index<gp.min_index_on_track
if front_off_track or back_off_track then
outside = outside .."\n!!! Train off track !!!"
end
@@ -314,7 +314,6 @@ function wagon:on_step(dtime)
self.infotext_cache=outside
end
- local gp=self:train()
local fct=self.wagon_flipped and -1 or 1
--set line number
if self.name == "advtrains:subway_wagon" and gp.line and gp.line~=self.line_cache then