diff options
author | orwell96 <orwell@bleipb.de> | 2017-12-18 23:44:01 +0100 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2017-12-18 23:44:01 +0100 |
commit | e3b70469687116437e90aedf0b0be61cf4a8dc3e (patch) | |
tree | bf631aff79a4c3710ef20a13ac11abec7c2ab756 /advtrains/wagons.lua | |
parent | 8a51a10a61626c2190b32f06a52dbe20cdf1d04c (diff) | |
download | advtrains-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
Diffstat (limited to 'advtrains/wagons.lua')
-rw-r--r-- | advtrains/wagons.lua | 7 |
1 files changed, 3 insertions, 4 deletions
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
|