diff options
author | orwell96 <orwell@bleipb.de> | 2021-02-12 11:55:57 +0100 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2021-02-12 11:55:57 +0100 |
commit | 737eb4987f30a48bebf0ac4a78b0c62e73a813e4 (patch) | |
tree | 4cd5d846be8af13814a6c7021d3464fdf4f7bcfb /advtrains/lzb.lua | |
parent | b65d99aa2c816b6dea3ecb6dd824ce02f7519fe2 (diff) | |
download | advtrains-737eb4987f30a48bebf0ac4a78b0c62e73a813e4.tar.gz advtrains-737eb4987f30a48bebf0ac4a78b0c62e73a813e4.tar.bz2 advtrains-737eb4987f30a48bebf0ac4a78b0c62e73a813e4.zip |
LZB: Look ahead before movement, not after
Diffstat (limited to 'advtrains/lzb.lua')
-rw-r--r-- | advtrains/lzb.lua | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/advtrains/lzb.lua b/advtrains/lzb.lua index 6a899d6..cbdc422 100644 --- a/advtrains/lzb.lua +++ b/advtrains/lzb.lua @@ -123,6 +123,8 @@ local function look_ahead(id, train) lzb.trav_index = trav end +advtrains.lzb_look_ahead = look_ahead + local function call_runover_callbacks(id, train) if not train.lzb then return end @@ -254,7 +256,8 @@ end advtrains.te_register_on_new_path(function(id, train) advtrains.lzb_invalidate(train) - look_ahead(id, train) + -- Taken care of in pre-move hook (see train_step_b) + --look_ahead(id, train) end) advtrains.te_register_on_invalidate_ahead(function(id, train, start_idx) @@ -266,6 +269,8 @@ advtrains.te_register_on_update(function(id, train) atprint("LZB run: no path on train, skip step") return end - look_ahead(id, train) + -- Note: look_ahead called from train_step_b before applying movement + -- TODO: if more pre-move hooks are added, make a separate callback hook + --look_ahead(id, train) call_runover_callbacks(id, train) end, true) |