Vanessa Ezekowitz
2017-04-09 af39221df9d2436cffedaca25365ae55489d6e48
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)
6 files modified
22 ■■■■■ changed files
technic/machines/MV/tool_workshop.lua 3 ●●●● patch | view | raw | blame | history
technic/machines/other/injector.lua 5 ●●●●● patch | view | raw | blame | history
technic/machines/register/battery_box.lua 5 ●●●●● patch | view | raw | blame | history
technic/machines/register/generator.lua 3 ●●●● patch | view | raw | blame | history
technic/machines/register/machine_base.lua 3 ●●●● patch | view | raw | blame | history
technic_chests/common.lua 3 ●●●● patch | view | raw | blame | history
technic/machines/MV/tool_workshop.lua
@@ -103,7 +103,8 @@
    allow_metadata_inventory_take = technic.machine_inventory_take,
    tube = {
        can_insert = function (pos, node, stack, direction)
            return minetest.get_meta(pos):get_inventory():room_for_item("src", stack)
            local onestack = stack:peek_item(1)
            return minetest.get_meta(pos):get_inventory():room_for_item("src", onestack)
        end,
        insert_object = function (pos, node, stack, direction)
            return minetest.get_meta(pos):get_inventory():add_item("src", stack)
technic/machines/other/injector.lua
@@ -69,10 +69,11 @@
    groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, tubedevice=1, tubedevice_receiver=1},
    tube = {
        can_insert = function(pos, node, stack, direction)
            return minetest.get_meta(pos):get_inventory():room_for_item("main",stack)
            local onestack = stack:peek_item(1)
            return minetest.get_meta(pos):get_inventory():room_for_item("main", onestack)
        end,
        insert_object = function(pos, node, stack, direction)
            return minetest.get_meta(pos):get_inventory():add_item("main",stack)
            return minetest.get_meta(pos):get_inventory():add_item("main", stack)
        end,
        connect_sides = {left=1, right=1, front=1, back=1, top=1, bottom=1},
    },
technic/machines/register/battery_box.lua
@@ -50,10 +50,11 @@
        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},
technic/machines/register/generator.lua
@@ -9,7 +9,8 @@
    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},
}
technic/machines/register/machine_base.lua
@@ -10,7 +10,8 @@
    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},
}
technic_chests/common.lua
@@ -13,7 +13,8 @@
    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, front=1, back=1, top=1, bottom=1},