diff options
author | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2017-04-09 15:05:44 -0400 |
---|---|---|
committer | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2017-04-09 20:27:32 -0400 |
commit | cf97f02434af2d6342b3e11156d089f40a7a2460 (patch) | |
tree | ef302d07643217d076ae51d8ffa83fd02427cccf | |
parent | 8d50c191c89ad390cf6b870e11aaf8fd42b2c3d6 (diff) | |
download | pipeworks-cf97f02434af2d6342b3e11156d089f40a7a2460.tar pipeworks-cf97f02434af2d6342b3e11156d089f40a7a2460.tar.gz pipeworks-cf97f02434af2d6342b3e11156d089f40a7a2460.tar.bz2 pipeworks-cf97f02434af2d6342b3e11156d089f40a7a2460.tar.xz pipeworks-cf97f02434af2d6342b3e11156d089f40a7a2460.zip |
only reject part of itemtack from chest, 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)
-rw-r--r-- | compat.lua | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -26,12 +26,13 @@ minetest.override_item("default:furnace", { end end, can_insert = function(pos,node,stack,direction) + local onestack = stack:peek_item(1) local meta = minetest.get_meta(pos) local inv = meta:get_inventory() if direction.y == 1 then - return inv:room_for_item("fuel", stack) + return inv:room_for_item("fuel", onestack) else - return inv:room_for_item("src", stack) + return inv:room_for_item("src", onestack) end end, input_inventory = "dst", @@ -77,10 +78,11 @@ minetest.override_item("default:furnace_active", { can_insert = function(pos, node, stack, direction) local meta = minetest.get_meta(pos) local inv = meta:get_inventory() + local onestack = stack:peek_item(1) if direction.y == 1 then - return inv:room_for_item("fuel", stack) + return inv:room_for_item("fuel", onestack) else - return inv:room_for_item("src", stack) + return inv:room_for_item("src", onestack) end end, input_inventory = "dst", @@ -109,7 +111,8 @@ minetest.override_item("default:chest", { can_insert = function(pos, node, stack, direction) local meta = minetest.get_meta(pos) local inv = meta:get_inventory() - return inv:room_for_item("main", stack) + local onestack = stack:peek_item(1) + return inv:room_for_item("main", onestack) end, input_inventory = "main", connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1} @@ -137,7 +140,8 @@ minetest.override_item("default:chest_locked", { can_insert = function(pos, node, stack, direction) local meta = minetest.get_meta(pos) local inv = meta:get_inventory() - return inv:room_for_item("main", stack) + local onestack = stack:peek_item(1) + return inv:room_for_item("main", onestack) end, connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1} }, |