From 391a57f90ce5fccc0f5e587e880bf9770e2ecfb5 Mon Sep 17 00:00:00 2001 From: orwell96 Date: Tue, 19 Feb 2019 15:49:01 +0100 Subject: Prioritize LZB callback (possible bugfix for H#100) --- advtrains/trainlogic.lua | 8 ++++++-- advtrains_interlocking/lzb.lua | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/advtrains/trainlogic.lua b/advtrains/trainlogic.lua index ad51c42..2371490 100644 --- a/advtrains/trainlogic.lua +++ b/advtrains/trainlogic.lua @@ -573,9 +573,13 @@ end local function mknodecallback(name) local callt = {} - advtrains["tnc_register_on_"..name] = function(func) + advtrains["tnc_register_on_"..name] = function(func, prio) assertt(func, "function") - table.insert(callt, func) + if prio then + table.insert(callt, 1, func) + else + table.insert(callt, func) + end end return callt, function(pos, id, train, index) for _,f in ipairs(callt) do diff --git a/advtrains_interlocking/lzb.lua b/advtrains_interlocking/lzb.lua index eaa9808..eeddc77 100644 --- a/advtrains_interlocking/lzb.lua +++ b/advtrains_interlocking/lzb.lua @@ -288,4 +288,4 @@ advtrains.te_register_on_update(function(id, train) end look_ahead(id, train) apply_control(id, train) -end) +end, true) -- cgit v1.2.3