summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2016-11-26 13:32:21 -0500
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2016-11-27 04:10:10 -0500
commit029d5c4c6a5236779f89c7fe8f0f7f8278e4c22f (patch)
tree07d4072c54b5d1d817ff961d73f2614328a0edb7
parent75a0e6a31880bb3b0412288e7add99257805e8d1 (diff)
avoid "leaking" detached inventories to other players (see also, https://github.com/minetest/minetest_game/pull/1413/commits/2ff48b22a99cc5d30ee774ec13093604ea8e0738 )
-rw-r--r--bags.lua5
-rw-r--r--callbacks.lua2
-rw-r--r--depends.txt1
3 files changed, 5 insertions, 3 deletions
diff --git a/bags.lua b/bags.lua
index 6cedffa..4af4ff5 100644
--- a/bags.lua
+++ b/bags.lua
@@ -76,7 +76,8 @@ end)
minetest.register_on_joinplayer(function(player)
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)
player:get_inventory():set_stack(listname, index, stack)
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)
return 0
end,
- })
+ }, player_name)
for i=1,4 do
local bag = "bag"..i
player_inv:set_size(bag, 1)
diff --git a/callbacks.lua b/callbacks.lua
index ad6de0a..7240814 100644
--- a/callbacks.lua
+++ b/callbacks.lua
@@ -43,7 +43,7 @@ minetest.register_on_joinplayer(function(player)
minetest.sound_play("electricity",
{to_player=player_name, gain = 1.0})
end,
- })
+ }, player_name)
refill:set_size("main", 1)
end)
diff --git a/depends.txt b/depends.txt
index 3879b2c..dadaff0 100644
--- a/depends.txt
+++ b/depends.txt
@@ -1,3 +1,4 @@
+default
creative?
intllib?
datastorage?