diff options
author | orwell96 <orwell@bleipb.de> | 2018-10-29 20:49:31 +0100 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2018-10-29 20:49:31 +0100 |
commit | 6298f8b081fd0fa05552f2b658281b0e6e950d38 (patch) | |
tree | 73435f7e90e7fcbbf5cb54c799a137fdced214ba /advtrains_interlocking/lzb.lua | |
parent | ef50505e9505812e79ccbd21f18fd1c0d7f3e25d (diff) | |
download | advtrains-6298f8b081fd0fa05552f2b658281b0e6e950d38.tar.gz advtrains-6298f8b081fd0fa05552f2b658281b0e6e950d38.tar.bz2 advtrains-6298f8b081fd0fa05552f2b658281b0e6e950d38.zip |
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.
Diffstat (limited to 'advtrains_interlocking/lzb.lua')
-rw-r--r-- | advtrains_interlocking/lzb.lua | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/advtrains_interlocking/lzb.lua b/advtrains_interlocking/lzb.lua index 77b115d..0a5051a 100644 --- a/advtrains_interlocking/lzb.lua +++ b/advtrains_interlocking/lzb.lua @@ -33,6 +33,7 @@ local ADD_SLOW = 1 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 SHUNT_SPEED_MAX = 4 @@ -175,17 +176,26 @@ local function apply_control(id, train) --train.debug = train.debug .. "BRAKE!!!" return end - 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 + 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 end end end |