only reject part of itemtack from chest/machine/etc., if possible

(e.g. if there's room for 50 of some item, and you send a stack of 99,
50 are added to the chest and a stack of 49 is rejected and sent
on to the next destination)
This commit is contained in:
Vanessa Ezekowitz
2017-04-09 17:16:25 -04:00
parent 72c536c04e
commit af39221df9
6 changed files with 14 additions and 8 deletions

View File

@ -50,10 +50,11 @@ local tube = {
end
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local onestack = stack:peek_item(1)
if direction.y > 0 then
return inv:room_for_item("src", stack)
return inv:room_for_item("src", onestack)
else
return inv:room_for_item("dst", stack)
return inv:room_for_item("dst", onestack)
end
end,
connect_sides = {left=1, right=1, back=1, top=1, bottom=1},

View File

@ -9,7 +9,8 @@ local tube = {
can_insert = function(pos, node, stack, direction)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:room_for_item("src", stack)
local onestack = stack:peek_item(1)
return inv:room_for_item("src", onestack)
end,
connect_sides = {left=1, right=1, back=1, top=1, bottom=1},
}

View File

@ -10,7 +10,8 @@ local tube = {
can_insert = function(pos, node, stack, direction)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:room_for_item("src", stack)
local onestack = stack:peek_item(1)
return inv:room_for_item("src", onestack)
end,
connect_sides = {left = 1, right = 1, back = 1, top = 1, bottom = 1},
}