Revert "Fix incorrect count check on item put"

This reverts commit 3082c64dac5d5107d87c339559edfe3c4113eabe. (incorrect branch)
This commit is contained in:
Andrey Kozlovskiy 2019-08-07 21:46:32 +03:00
parent 3082c64dac
commit 2e14f13c46

@ -142,19 +142,19 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player)
local meta = M(pos) local meta = M(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
local list = inv:get_list(listname) local list = inv:get_list(listname)
local stack_count = stack:get_count()
if minetest.is_protected(pos, player:get_player_name()) then if minetest.is_protected(pos, player:get_player_name()) then
return 0 return 0
end end
if listname == "src" then if listname == "src" then
if State:get_state(meta) == tubelib.STANDBY then if State:get_state(M(pos)) == tubelib.STANDBY then
State:start(pos, meta) State:start(pos, meta)
end end
return stack_count return stack:get_count()
elseif invlist_num_entries(list) < MAX_NUM_PER_CYC then
return stack:get_count()
end end
return 0
return math.min(stack_count, MAX_NUM_PER_CYC - invlist_num_entries(list))
end end
local function allow_metadata_inventory_take(pos, listname, index, stack, player) local function allow_metadata_inventory_take(pos, listname, index, stack, player)