diff options
author | orwell <orwell@bleipb.de> | 2025-01-28 22:24:03 +0100 |
---|---|---|
committer | orwell <orwell@bleipb.de> | 2025-01-28 22:24:03 +0100 |
commit | a212310913c33fb855ca0f262beda6d857382ff8 (patch) | |
tree | 9e94937aa2e1d4c3b1be12accc4455e8bf22b866 /advtrains/trainlogic.lua | |
parent | e3e711e04cf6036eb6f3e4c05007bb7258b01449 (diff) | |
download | advtrains-a212310913c33fb855ca0f262beda6d857382ff8.tar.gz advtrains-a212310913c33fb855ca0f262beda6d857382ff8.tar.bz2 advtrains-a212310913c33fb855ca0f262beda6d857382ff8.zip |
ATC: add "G" command to wait for green signal, improve ATC hud, potentially fix LZB issue
Diffstat (limited to 'advtrains/trainlogic.lua')
-rw-r--r-- | advtrains/trainlogic.lua | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/advtrains/trainlogic.lua b/advtrains/trainlogic.lua index 0e588c7..c49d7e3 100644 --- a/advtrains/trainlogic.lua +++ b/advtrains/trainlogic.lua @@ -427,7 +427,8 @@ function advtrains.train_step_b(id, train, dtime) if train.atc_command then if (not train.atc_delay or train.atc_delay<=0) and not train.atc_wait_finish - and not train.atc_wait_autocouple then + and not train.atc_wait_autocouple + and not train.atc_wait_signal then advtrains.atc.execute_atc_command(id, train) elseif train.atc_delay and train.atc_delay > 0 then train.atc_delay=train.atc_delay-dtime @@ -456,6 +457,15 @@ function advtrains.train_step_b(id, train, dtime) train.atc_wait_finish=nil end end + -- clear atc_wait_signal immediately when the next LZB checkpoint is not a "stop" + -- (but make sure lzb is initialized, otherwise wait for it) + if train.atc_wait_signal and train.lzb then + local first_ckp = train.lzb.checkpoints and train.lzb.checkpoints[1] + -- no checkpoint exists, or it has a speed of either nil or >0 + if not first_ckp or first_ckp.speed ~= 0 then + train.atc_wait_signal = nil + end + end if train.tarvelocity and train.tarvelocity>v0 then --atprint("in train_step_b: applying ATC ACCEL", train.tarvelocity) |