Merge branch 'master' of https://github.com/oversword/techpack into HEAD

This commit is contained in:
flux 2019-12-19 04:26:40 +00:00
commit c2a9d6f32f

@ -75,7 +75,9 @@ local function move_to_main(pos, index)
end end
end end
local function move_to_player_inv(player_name, pos, main_stack, index) local function move_to_player_inv(player_name, pos, index)
local node_inv = M(pos):get_inventory()
local main_stack = node_inv:get_stack("main", index)
local player_inv = minetest.get_inventory({type="player", name=player_name}) local player_inv = minetest.get_inventory({type="player", name=player_name})
local num = main_stack:get_count() local num = main_stack:get_count()
if num > 99 then if num > 99 then
@ -83,7 +85,6 @@ local function move_to_player_inv(player_name, pos, main_stack, index)
end end
local leftover = player_inv:add_item("main", ItemStack(main_stack:get_name().." "..num)) local leftover = player_inv:add_item("main", ItemStack(main_stack:get_name().." "..num))
main_stack:set_count(main_stack:get_count() - num + leftover:get_count()) main_stack:set_count(main_stack:get_count() - num + leftover:get_count())
local node_inv = M(pos):get_inventory()
node_inv:set_stack("main", index, main_stack) node_inv:set_stack("main", index, main_stack)
end end
@ -238,7 +239,7 @@ function techpack_warehouse.allow_metadata_inventory_take(pos, listname, index,
local number = M(pos):get_string("tubelib_number") local number = M(pos):get_string("tubelib_number")
if listname == "main" then if listname == "main" then
Cache[number] = nil Cache[number] = nil
minetest.after(0.1, move_to_player_inv, player:get_player_name(), pos, main_stack, index) minetest.after(0.1, move_to_player_inv, player:get_player_name(), pos, index)
return 0 return 0
elseif listname == "filter" and main_stack:is_empty() then elseif listname == "filter" and main_stack:is_empty() then
Cache[number] = nil Cache[number] = nil