Replace "Allow accelereting train towards signal"
This is a better implementation of the same goal. The last commit caused trains to overrun the IP sometimes. Haven't noticed so far with this approachmaster
parent
06216b0ca1
commit
7bbe0c2468
|
@ -28,12 +28,12 @@ local il = advtrains.interlocking
|
|||
local BRAKE_SPACE = 10
|
||||
local AWARE_ZONE = 50
|
||||
|
||||
local ADD_STAND = 2
|
||||
local ADD_SLOW = 1
|
||||
local ADD_STAND = 2.5
|
||||
local ADD_SLOW = 1.5
|
||||
local ADD_FAST = 7
|
||||
local ZONE_ROLL = 2
|
||||
local ZONE_HOLD = 5 -- added on top of ZONE_ROLL
|
||||
local ZONE_VSLOW = 2 -- When speed is <2, still allow accelerating
|
||||
local ZONE_VSLOW = 3 -- When speed is <2, still allow accelerating
|
||||
|
||||
local SHUNT_SPEED_MAX = 4
|
||||
|
||||
|
@ -176,26 +176,18 @@ local function apply_control(id, train)
|
|||
--train.debug = train.debug .. "BRAKE!!!"
|
||||
return
|
||||
end
|
||||
if v1==0 and v0<2 then
|
||||
i = advtrains.path_get_index_by_offset(train, i, -ZONE_VSLOW)
|
||||
if i <= train.index then
|
||||
-- roll control
|
||||
train.ctrl.lzb = 2
|
||||
return
|
||||
end
|
||||
else
|
||||
i = advtrains.path_get_index_by_offset(train, i, -ZONE_ROLL)
|
||||
if i <= train.index then
|
||||
-- roll control
|
||||
train.ctrl.lzb = 2
|
||||
return
|
||||
end
|
||||
i = advtrains.path_get_index_by_offset(train, i, -ZONE_HOLD)
|
||||
if i <= train.index then
|
||||
-- hold speed
|
||||
train.ctrl.lzb = 3
|
||||
return
|
||||
end
|
||||
|
||||
i = advtrains.path_get_index_by_offset(train, i, -ZONE_ROLL)
|
||||
if i <= train.index and v0>1 then
|
||||
-- roll control
|
||||
train.ctrl.lzb = 2
|
||||
return
|
||||
end
|
||||
i = advtrains.path_get_index_by_offset(train, i, -ZONE_HOLD)
|
||||
if i <= train.index and v0>1 then
|
||||
-- hold speed
|
||||
train.ctrl.lzb = 3
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -282,6 +282,9 @@ function ilrs.update_route(sigd, tcbs, newrte, cancel)
|
|||
tcbs.route_rsn = nil
|
||||
end
|
||||
if newrte or tcbs.routeset then
|
||||
if tcbs.route_committed then
|
||||
return
|
||||
end
|
||||
if newrte then tcbs.routeset = newrte end
|
||||
--atdebug("Setting:",tcbs.routeset)
|
||||
local succ, rsn, cbts, cblk = ilrs.set_route(sigd, tcbs.routes[tcbs.routeset])
|
||||
|
|
Loading…
Reference in New Issue