Compare commits
5 Commits
0a51d57138
...
4cfd07e992
Author | SHA1 | Date |
---|---|---|
orwell | 4cfd07e992 | |
Maverick2797 | 216f28e51a | |
Blockhead | 7c4f1377e4 | |
1F616EMO | a820318ecf | |
1F616EMO | ae394a43b8 |
|
@ -159,10 +159,8 @@ function o.reverse_lookup(ppos)
|
|||
local r = {}
|
||||
local i = 1
|
||||
while t[i] do
|
||||
if t[i]~=train_id then
|
||||
if not r[t[i]] then r[t[i]] = {} end
|
||||
table.insert(r[t[i]], t[i+1])
|
||||
end
|
||||
if not r[t[i]] then r[t[i]] = {} end
|
||||
table.insert(r[t[i]], t[i+1])
|
||||
i = i + 2
|
||||
end
|
||||
return r
|
||||
|
|
Binary file not shown.
|
@ -425,7 +425,7 @@ function ildb.link_track_sections(merge_id, root_id)
|
|||
merge_ts(root_id, merge_id)
|
||||
end
|
||||
|
||||
function ildb.remove_from_interlocking(sigd)
|
||||
function ildb.remove_from_interlocking(sigd, no_tcb_marker)
|
||||
local tcbs = ildb.get_tcbs(sigd)
|
||||
if not ildb.may_modify_tcbs(tcbs) then return false end
|
||||
|
||||
|
@ -455,7 +455,9 @@ function ildb.remove_from_interlocking(sigd)
|
|||
track_sections[tsid] = nil
|
||||
end
|
||||
end
|
||||
advtrains.interlocking.show_tcb_marker(sigd.p)
|
||||
if not no_tcb_marker then
|
||||
advtrains.interlocking.show_tcb_marker(sigd.p)
|
||||
end
|
||||
if tcbs.signal then
|
||||
return false
|
||||
end
|
||||
|
@ -468,10 +470,11 @@ function ildb.remove_tcb(pos)
|
|||
return true --FIX: not an error, because tcb is already removed
|
||||
end
|
||||
for connid=1,2 do
|
||||
if not ildb.remove_from_interlocking({p=pos, s=connid}) then
|
||||
if not ildb.remove_from_interlocking({p=pos, s=connid}, true) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
advtrains.interlocking.remove_tcb_marker_pts(pts)
|
||||
track_circuit_breaks[pts] = nil
|
||||
return true
|
||||
end
|
||||
|
|
|
@ -550,6 +550,13 @@ minetest.register_entity("advtrains_interlocking:tcbmarker", {
|
|||
static_save = false,
|
||||
})
|
||||
|
||||
function advtrains.interlocking.remove_tcb_marker_pts(pts)
|
||||
if markerent[pts] then
|
||||
markerent[pts]:remove()
|
||||
markerent[pts] = nil
|
||||
end
|
||||
end
|
||||
|
||||
function advtrains.interlocking.show_tcb_marker(pos)
|
||||
--atdebug("showing tcb marker",pos)
|
||||
local tcb = ildb.get_tcb(pos)
|
||||
|
@ -573,9 +580,7 @@ function advtrains.interlocking.show_tcb_marker(pos)
|
|||
end
|
||||
|
||||
local pts = advtrains.roundfloorpts(pos)
|
||||
if markerent[pts] then
|
||||
markerent[pts]:remove()
|
||||
end
|
||||
advtrains.interlocking.remove_tcb_marker_pts(pts)
|
||||
|
||||
local obj = minetest.add_entity(pos, "advtrains_interlocking:tcbmarker")
|
||||
if not obj then return end
|
||||
|
|
|
@ -224,7 +224,7 @@ if advtrains.interlocking then
|
|||
end
|
||||
static_env.set_aspect = function(signal, asp)
|
||||
local pos = atlatc.pcnaming.resolve_pos(signal)
|
||||
return advtrains.interlocking.signal_set_aspect(pos)
|
||||
return advtrains.interlocking.signal_set_aspect(pos,asp)
|
||||
end
|
||||
|
||||
--section_occupancy()
|
||||
|
@ -233,7 +233,7 @@ if advtrains.interlocking then
|
|||
ts_id = tostring(ts_id)
|
||||
local response = advtrains.interlocking.db.get_ts(ts_id)
|
||||
if not response then return false end
|
||||
return table.copy(response.trains)
|
||||
return (response.trains and table.copy(response.trains)) or {}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue