Corrige un crash avec les wielders (Fix by Crabman)

This commit is contained in:
sys4-fr 2019-02-08 20:14:04 +01:00
parent e429300d4e
commit 1911b5d160

View File

@ -191,13 +191,15 @@ end
-- tool break sound + autorefill
function refill(player, stck_name, index)
local inv = player:get_inventory()
for i,stack in ipairs(inv:get_list("main")) do
if stack:get_name() == stck_name then
inv:set_stack("main", index, stack)
stack:clear()
inv:set_stack("main", i, stack)
minetest.log("action", "Inventory Tweaks: refilled stack("..stck_name..") of " .. player:get_player_name() )
return
if inv:get_list("main") then
for i,stack in ipairs(inv:get_list("main")) do
if stack:get_name() == stck_name then
inv:set_stack("main", index, stack)
stack:clear()
inv:set_stack("main", i, stack)
minetest.log("action", "Inventory Tweaks: refilled stack("..stck_name..") of " .. player:get_player_name() )
return
end
end
end
end