Allow to accelerate trains slowly towards red signals from stand.

Previously, it was impossible to accelerate a standing train once it was ~10m in front of a red signal.
This commit is contained in:
orwell96 2018-10-29 20:49:31 +01:00
parent ef50505e95
commit 6298f8b081
1 changed files with 21 additions and 11 deletions

View File

@ -33,6 +33,7 @@ local ADD_SLOW = 1
local ADD_FAST = 7 local ADD_FAST = 7
local ZONE_ROLL = 2 local ZONE_ROLL = 2
local ZONE_HOLD = 5 -- added on top of ZONE_ROLL local ZONE_HOLD = 5 -- added on top of ZONE_ROLL
local ZONE_VSLOW = 2 -- When speed is <2, still allow accelerating
local SHUNT_SPEED_MAX = 4 local SHUNT_SPEED_MAX = 4
@ -175,6 +176,14 @@ local function apply_control(id, train)
--train.debug = train.debug .. "BRAKE!!!" --train.debug = train.debug .. "BRAKE!!!"
return return
end 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) i = advtrains.path_get_index_by_offset(train, i, -ZONE_ROLL)
if i <= train.index then if i <= train.index then
-- roll control -- roll control
@ -189,6 +198,7 @@ local function apply_control(id, train)
end end
end end
end end
end
train.ctrl.lzb = nil train.ctrl.lzb = nil
end end