mirror of
https://github.com/minetest-mods/unified_inventory.git
synced 2024-08-20 21:34:09 +02:00
avoid "leaking" detached inventories to other players (see also, 2ff48b22a9
)
This commit is contained in:
parent
75a0e6a318
commit
029d5c4c6a
5
bags.lua
5
bags.lua
@ -76,7 +76,8 @@ end)
|
|||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
minetest.register_on_joinplayer(function(player)
|
||||||
local player_inv = player:get_inventory()
|
local player_inv = player:get_inventory()
|
||||||
local bags_inv = minetest.create_detached_inventory(player:get_player_name().."_bags",{
|
local player_name = player:get_player_name()
|
||||||
|
local bags_inv = minetest.create_detached_inventory(player_name.."_bags",{
|
||||||
on_put = function(inv, listname, index, stack, player)
|
on_put = function(inv, listname, index, stack, player)
|
||||||
player:get_inventory():set_stack(listname, index, stack)
|
player:get_inventory():set_stack(listname, index, stack)
|
||||||
player:get_inventory():set_size(listname.."contents",
|
player:get_inventory():set_size(listname.."contents",
|
||||||
@ -127,7 +128,7 @@ minetest.register_on_joinplayer(function(player)
|
|||||||
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
||||||
return 0
|
return 0
|
||||||
end,
|
end,
|
||||||
})
|
}, player_name)
|
||||||
for i=1,4 do
|
for i=1,4 do
|
||||||
local bag = "bag"..i
|
local bag = "bag"..i
|
||||||
player_inv:set_size(bag, 1)
|
player_inv:set_size(bag, 1)
|
||||||
|
@ -43,7 +43,7 @@ minetest.register_on_joinplayer(function(player)
|
|||||||
minetest.sound_play("electricity",
|
minetest.sound_play("electricity",
|
||||||
{to_player=player_name, gain = 1.0})
|
{to_player=player_name, gain = 1.0})
|
||||||
end,
|
end,
|
||||||
})
|
}, player_name)
|
||||||
refill:set_size("main", 1)
|
refill:set_size("main", 1)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
default
|
||||||
creative?
|
creative?
|
||||||
intllib?
|
intllib?
|
||||||
datastorage?
|
datastorage?
|
||||||
|
Loading…
Reference in New Issue
Block a user