forked from mtcontrib/pipeworks
Make sorting tubes not drop elements if all outputs filtering for a specific element are filled.
Send them to some other open (empty) port instead.
This commit is contained in:
parent
50b417ce13
commit
8e9affc841
@ -52,22 +52,29 @@ if pipeworks.enable_mese_tube then
|
|||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
local name = stack:get_name()
|
local name = stack:get_name()
|
||||||
for i, vect in ipairs(pipeworks.meseadjlist) do
|
for i, vect in ipairs(pipeworks.meseadjlist) do
|
||||||
if meta:get_int("l"..i.."s") == 1 then
|
local npos = vector.add(pos, vect)
|
||||||
local invname = "line"..i
|
local node = minetest.get_node(npos)
|
||||||
local is_empty = true
|
local reg_node = minetest.registered_nodes[node.name]
|
||||||
for _, st in ipairs(inv:get_list(invname)) do
|
if meta:get_int("l"..i.."s") == 1 and reg_node then
|
||||||
if not st:is_empty() then
|
local tube_def = reg_node.tube
|
||||||
is_empty = false
|
if not tube_def or not tube_def.can_insert or
|
||||||
if st:get_name() == name then
|
tube_def.can_insert(npos, node, stack, vect) then
|
||||||
foundn = foundn + 1
|
local invname = "line"..i
|
||||||
found[foundn] = vect
|
local is_empty = true
|
||||||
end
|
for _, st in ipairs(inv:get_list(invname)) do
|
||||||
end
|
if not st:is_empty() then
|
||||||
end
|
is_empty = false
|
||||||
if is_empty then
|
if st:get_name() == name then
|
||||||
tbln = tbln + 1
|
foundn = foundn + 1
|
||||||
tbl[tbln] = vect
|
found[foundn] = vect
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if is_empty then
|
||||||
|
tbln = tbln + 1
|
||||||
|
tbl[tbln] = vect
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return (foundn > 0) and found or tbl
|
return (foundn > 0) and found or tbl
|
||||||
|
Loading…
Reference in New Issue
Block a user