Fix atc command evaluation BB command

master
orwell96 2019-01-22 23:24:05 +01:00
parent 2b87106961
commit f2a62c2d77
2 changed files with 10 additions and 6 deletions

View File

@ -179,11 +179,8 @@ local matchptn={
train.tarvelocity=tonumber(match) train.tarvelocity=tonumber(match)
return #match+1 return #match+1
end, end,
["B([0-9B]+)"]=function(id, train, match) ["B([0-9]+)"]=function(id, train, match)
if match=="B" then if train.velocity>tonumber(match) then
train.atc_brake_target = -1
train.tarvelocity = 0
elseif train.velocity>tonumber(match) then
train.atc_brake_target=tonumber(match) train.atc_brake_target=tonumber(match)
if not train.tarvelocity or train.tarvelocity>train.atc_brake_target then if not train.tarvelocity or train.tarvelocity>train.atc_brake_target then
train.tarvelocity=train.atc_brake_target train.tarvelocity=train.atc_brake_target
@ -191,6 +188,13 @@ local matchptn={
end end
return #match+1 return #match+1
end, end,
["BB"]=function(id, train)
if match=="B" then
train.atc_brake_target = -1
train.tarvelocity = 0
else
return 2
end,
["W"]=function(id, train) ["W"]=function(id, train)
train.atc_wait_finish=true train.atc_wait_finish=true
return 1 return 1

View File

@ -19,7 +19,7 @@ train.lzb = {
trav = Current index that the traverser has advanced so far trav = Current index that the traverser has advanced so far
travsht = boolean indicating whether the train will be a shunt move at "trav" travsht = boolean indicating whether the train will be a shunt move at "trav"
travspd = speed restriction at end of traverser travspd = speed restriction at end of traverser
travwspd = warning speed res. travwspd = warning speed res.t
oncoming = table containing oncoming signals, in order of appearance on the path oncoming = table containing oncoming signals, in order of appearance on the path
{ {
pos = position of the signal (not the IP!). Can be nil pos = position of the signal (not the IP!). Can be nil