diff options
author | orwell96 <orwell@bleipb.de> | 2018-10-17 18:58:57 +0200 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2018-10-17 18:58:57 +0200 |
commit | b4534c6f1268c48107b6aa0ec6e8b7960c11075a (patch) | |
tree | f26648305e4457dad480239b3131a1a366c6d925 /advtrains_interlocking | |
parent | cd38b17eabb8cdc37bd7e11a89fd0fd049910ffc (diff) | |
download | advtrains-b4534c6f1268c48107b6aa0ec6e8b7960c11075a.tar.gz advtrains-b4534c6f1268c48107b6aa0ec6e8b7960c11075a.tar.bz2 advtrains-b4534c6f1268c48107b6aa0ec6e8b7960c11075a.zip |
Improve ATC-LZB-User control interaction, smoothen LZB control operations
(prevent flickering view when atc battles against lzb)
Diffstat (limited to 'advtrains_interlocking')
-rw-r--r-- | advtrains_interlocking/lzb.lua | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/advtrains_interlocking/lzb.lua b/advtrains_interlocking/lzb.lua index db745ef..54b1a7a 100644 --- a/advtrains_interlocking/lzb.lua +++ b/advtrains_interlocking/lzb.lua @@ -30,7 +30,9 @@ local AWARE_ZONE = 50 local ADD_STAND = 2 local ADD_SLOW = 1 -local ADD_FAST = 10 +local ADD_FAST = 7 +local ZONE_ROLL = 2 +local ZONE_HOLD = 5 -- added on top of ZONE_ROLL local SHUNT_SPEED_MAX = 4 @@ -49,7 +51,7 @@ local function look_ahead(id, train) local travwspd = lzb.travwspd local lspd - train.debug = lspd + --train.debug = lspd while trav <= brake_i and (not lspd or lspd>0) do trav = trav + 1 @@ -172,6 +174,18 @@ 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 + end end end train.ctrl.lzb = nil |