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
master
orwell96 2017-12-18 23:44:01 +01:00
parent 8a51a10a61
commit e3b7046968
3 changed files with 4 additions and 8 deletions

View File

@ -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)

View File

@ -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

View File

@ -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