aboutsummaryrefslogtreecommitdiff
path: root/advtrains_interlocking/lzb.lua
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2018-10-10 22:41:59 +0200
committerorwell96 <orwell@bleipb.de>2018-10-10 22:41:59 +0200
commit842a85606e4495dd631c2916d09a760d74a0ce13 (patch)
treef28bb815ecd01681f98166578c659aef48082b2a /advtrains_interlocking/lzb.lua
parent33c839b40d48e154f5b03619a9bdce1bed1fc602 (diff)
downloadadvtrains-842a85606e4495dd631c2916d09a760d74a0ce13.tar.gz
advtrains-842a85606e4495dd631c2916d09a760d74a0ce13.tar.bz2
advtrains-842a85606e4495dd631c2916d09a760d74a0ce13.zip
Properly implement invalidate_all_paths, recheck lzb on aspect change
Diffstat (limited to 'advtrains_interlocking/lzb.lua')
-rw-r--r--advtrains_interlocking/lzb.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/advtrains_interlocking/lzb.lua b/advtrains_interlocking/lzb.lua
index c9e40ab..8781d40 100644
--- a/advtrains_interlocking/lzb.lua
+++ b/advtrains_interlocking/lzb.lua
@@ -177,14 +177,22 @@ local function apply_control(id, train)
train.ctrl.lzb = nil
end
-
-advtrains.te_register_on_new_path(function(id, train)
+local function invalidate(train)
train.lzb = {
trav = atfloor(train.index),
travsht = train.is_shunt,
oncoming = {}
}
train.ctrl.lzb = nil
+end
+
+function advtrains.interlocking.lzb_invalidate(train)
+ invalidate(train)
+end
+
+
+advtrains.te_register_on_new_path(function(id, train)
+ invalidate(train)
look_ahead(id, train)
end)