Clean up old player lists after saving

This commit is contained in:
SmallJoker 2018-06-21 21:22:12 +02:00
parent 50e7d86718
commit 7ec48dedef
1 changed files with 6 additions and 2 deletions

View File

@ -146,14 +146,18 @@ local function load_bags_metadata(player, bags_inv)
local bag = "bag"..i local bag = "bag"..i
bags_inv:set_size(bag, 1) bags_inv:set_size(bag, 1)
bags_inv:set_stack(bag, 1, bags[i] or "") bags_inv:set_stack(bag, 1, bags[i] or "")
-- Deprecated, clean up garbage
player_inv:set_size(bag, 0)
end end
if dirty_meta then if dirty_meta then
-- Requires detached inventory to be set up -- Requires detached inventory to be set up
save_bags_metadata(player, bags_inv) save_bags_metadata(player, bags_inv)
end end
-- Clean up deprecated garbage after saving
for i = 1, 4 do
local bag = "bag"..i
player_inv:set_size(bag, 0)
end
end end
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)