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:
est31 2015-02-03 23:12:10 +01:00
parent 50b417ce13
commit 8e9affc841

View File

@ -52,7 +52,13 @@ 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 node = minetest.get_node(npos)
local reg_node = minetest.registered_nodes[node.name]
if meta:get_int("l"..i.."s") == 1 and reg_node then
local tube_def = reg_node.tube
if not tube_def or not tube_def.can_insert or
tube_def.can_insert(npos, node, stack, vect) then
local invname = "line"..i local invname = "line"..i
local is_empty = true local is_empty = true
for _, st in ipairs(inv:get_list(invname)) do for _, st in ipairs(inv:get_list(invname)) do
@ -70,6 +76,7 @@ if pipeworks.enable_mese_tube then
end end
end end
end end
end
return (foundn > 0) and found or tbl return (foundn > 0) and found or tbl
end}, end},
on_construct = function(pos) on_construct = function(pos)