Force LZB Halt setting
parent
8b8c5a2c1f
commit
e7dcee1127
|
@ -861,14 +861,24 @@ function wagon:handle_bordcom_fields(pname, formname, fields)
|
||||||
end
|
end
|
||||||
if fields.line then
|
if fields.line then
|
||||||
if fields.line~="" then
|
if fields.line~="" then
|
||||||
train.line=fields.line
|
if fields.line ~= train.line then
|
||||||
|
train.line=fields.line
|
||||||
|
if advtrains.interlocking then
|
||||||
|
advtrains.interlocking.lzb_invalidate(train)
|
||||||
|
end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
train.line=nil
|
train.line=nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if fields.routingcode then
|
if fields.routingcode then
|
||||||
if fields.routingcode~="" then
|
if fields.routingcode~="" then
|
||||||
train.routingcode=fields.routingcode
|
if fields.routingcode ~= train.routingcode then
|
||||||
|
train.routingcode=fields.routingcode
|
||||||
|
if advtrains.interlocking then
|
||||||
|
advtrains.interlocking.lzb_invalidate(train)
|
||||||
|
end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
train.routingcode=nil
|
train.routingcode=nil
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
-- lzb.lua
|
-- lzb.lua
|
||||||
-- Enforced and/or automatic train override control, obeying signals
|
-- Enforced and/or automatic train override control, obeying signals
|
||||||
|
|
||||||
|
|
||||||
local function approach_callback(parpos, train_id, train, index)
|
local function approach_callback(parpos, train_id, train, index)
|
||||||
local pos = advtrains.round_vector_floor_y(parpos)
|
local pos = advtrains.round_vector_floor_y(parpos)
|
||||||
|
|
||||||
|
@ -185,11 +184,24 @@ local function apply_control(id, train)
|
||||||
local i = 1
|
local i = 1
|
||||||
while i<=#lzb.oncoming do
|
while i<=#lzb.oncoming do
|
||||||
if lzb.oncoming[i].idx < train.index-0.5 then
|
if lzb.oncoming[i].idx < train.index-0.5 then
|
||||||
if not lzb.oncoming[i].npr then
|
local ent = lzb.oncoming[i]
|
||||||
train.speed_restriction = lzb.oncoming[i].spd
|
local nodelete
|
||||||
train.is_shunt = lzb.oncoming[i].sht
|
if not ent.npr then
|
||||||
|
if ent.spd == 0 and minetest.settings:get_bool("at_il_force_lzb_halt") then
|
||||||
|
atwarn(train.id,"overrun LZB 0 restriction (red signal) ",ent.pos)
|
||||||
|
-- Set train 1 index backward. Hope this does not lead to bugs...
|
||||||
|
train.index = ent.idx - 0.5
|
||||||
|
train.velocity = 0
|
||||||
|
train.ctrl.lzb = 0
|
||||||
|
nodelete = true
|
||||||
|
else
|
||||||
|
train.speed_restriction = ent.spd
|
||||||
|
train.is_shunt = ent.sht
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not nodelete then
|
||||||
|
table.remove(lzb.oncoming, i)
|
||||||
end
|
end
|
||||||
table.remove(lzb.oncoming, i)
|
|
||||||
else
|
else
|
||||||
i = i + 1
|
i = i + 1
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
# Stop trains forcibly in front of signal when about to run over an LZB 0 restriction, instead of setting emergency halt for manual resolving
|
||||||
|
# This prevents the need to manually restart trains that overran red signals, but is unrealistic.
|
||||||
|
# This is a workaround to circumvent system breakages due to bugs in LZB braking curves
|
||||||
|
at_il_force_lzb_halt (Force LZB Halt) bool true
|
|
@ -58,6 +58,9 @@ function r.fire_event(pos, evtdata)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
train.line = line .. ""
|
train.line = line .. ""
|
||||||
|
if advtrains.interlocking then
|
||||||
|
advtrains.interlocking.lzb_invalidate(train)
|
||||||
|
end
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
get_line = function()
|
get_line = function()
|
||||||
|
@ -68,6 +71,9 @@ function r.fire_event(pos, evtdata)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
train.routingcode = rc
|
train.routingcode = rc
|
||||||
|
if advtrains.interlocking then
|
||||||
|
advtrains.interlocking.lzb_invalidate(train)
|
||||||
|
end
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
get_rc = function()
|
get_rc = function()
|
||||||
|
|
Loading…
Reference in New Issue