Prioritize LZB callback (possible bugfix for H#100)
parent
84f1c3d8a5
commit
391a57f90c
|
@ -573,10 +573,14 @@ end
|
||||||
|
|
||||||
local function mknodecallback(name)
|
local function mknodecallback(name)
|
||||||
local callt = {}
|
local callt = {}
|
||||||
advtrains["tnc_register_on_"..name] = function(func)
|
advtrains["tnc_register_on_"..name] = function(func, prio)
|
||||||
assertt(func, "function")
|
assertt(func, "function")
|
||||||
|
if prio then
|
||||||
|
table.insert(callt, 1, func)
|
||||||
|
else
|
||||||
table.insert(callt, func)
|
table.insert(callt, func)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
return callt, function(pos, id, train, index)
|
return callt, function(pos, id, train, index)
|
||||||
for _,f in ipairs(callt) do
|
for _,f in ipairs(callt) do
|
||||||
f(pos, id, train, index)
|
f(pos, id, train, index)
|
||||||
|
|
|
@ -288,4 +288,4 @@ advtrains.te_register_on_update(function(id, train)
|
||||||
end
|
end
|
||||||
look_ahead(id, train)
|
look_ahead(id, train)
|
||||||
apply_control(id, train)
|
apply_control(id, train)
|
||||||
end)
|
end, true)
|
||||||
|
|
Loading…
Reference in New Issue