mirror of
https://github.com/joe7575/techpack.git
synced 2024-11-26 09:03:46 +01:00
#42 bls#168 fixed infinite item on scroll bug by being sensible and remembering how things work
This commit is contained in:
parent
6554619648
commit
c1c7e39e1f
@ -75,7 +75,9 @@ local function move_to_main(pos, index)
|
||||
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 num = main_stack:get_count()
|
||||
if num > 99 then
|
||||
@ -83,7 +85,6 @@ local function move_to_player_inv(player_name, pos, main_stack, index)
|
||||
end
|
||||
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())
|
||||
local node_inv = M(pos):get_inventory()
|
||||
node_inv:set_stack("main", index, main_stack)
|
||||
end
|
||||
|
||||
@ -238,7 +239,7 @@ function techpack_warehouse.allow_metadata_inventory_take(pos, listname, index,
|
||||
local number = M(pos):get_string("tubelib_number")
|
||||
if listname == "main" then
|
||||
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
|
||||
elseif listname == "filter" and main_stack:is_empty() then
|
||||
Cache[number] = nil
|
||||
|
Loading…
Reference in New Issue
Block a user