Add off-track train flag, fixes wagon object property reset on reversing
This commit is contained in:
parent
820503ba81
commit
9586a4d709
|
@ -115,6 +115,8 @@ function advtrains.path_invalidate(train)
|
|||
train.path_trk_b=0
|
||||
train.path_req_f=0
|
||||
train.path_req_b=0
|
||||
|
||||
train.dirty = true
|
||||
end
|
||||
|
||||
-- Prints a path using the passed print function
|
||||
|
|
|
@ -283,7 +283,7 @@ function advtrains.train_step_b(id, train, dtime)
|
|||
--apply off-track handling:
|
||||
local front_off_track = train.index>train.path_trk_f
|
||||
local back_off_track=train.end_index<train.path_trk_b
|
||||
local pprint
|
||||
train.off_track = front_off_track or back_off_track
|
||||
|
||||
if front_off_track then
|
||||
tarvel_cap=0
|
||||
|
|
|
@ -305,7 +305,7 @@ function wagon:on_step(dtime)
|
|||
|
||||
local train=self:train()
|
||||
--show off-track information in outside text instead of notifying the whole server about this
|
||||
if not train.dirty and train.end_index < train.path_trk_b or train.index > train.path_trk_f then
|
||||
if train.off_track then
|
||||
outside = outside .."\n!!! Train off track !!!"
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue