aboutsummaryrefslogtreecommitdiff
path: root/games
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-07-25 14:35:59 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-07-25 15:39:39 +0300
commit983e45ae928fe295fcdd30b33544fda156df240a (patch)
tree6ef05d76529ae9ecd4ace289618424f10aeeacb2 /games
parent0a18dda158e8f256de121ed2cf7a7a161a083b1c (diff)
downloadminetest-983e45ae928fe295fcdd30b33544fda156df240a.tar.gz
minetest-983e45ae928fe295fcdd30b33544fda156df240a.tar.bz2
minetest-983e45ae928fe295fcdd30b33544fda156df240a.zip
Improve inventory callbacks a bit
Diffstat (limited to 'games')
-rw-r--r--games/minimal/mods/default/init.lua6
-rw-r--r--games/minimal/mods/experimental/init.lua4
2 files changed, 5 insertions, 5 deletions
diff --git a/games/minimal/mods/default/init.lua b/games/minimal/mods/default/init.lua
index fe7ab955e..133b9ed22 100644
--- a/games/minimal/mods/default/init.lua
+++ b/games/minimal/mods/default/init.lua
@@ -1223,7 +1223,7 @@ minetest.register_node("default:chest_locked", {
end
return stack:get_count()
end,
- allow_metadata_inventory_take = function(pos, listname, index, count, player)
+ allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.env:get_meta(pos)
if not has_locked_chest_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
@@ -1232,7 +1232,7 @@ minetest.register_node("default:chest_locked", {
minetest.pos_to_string(pos))
return 0
end
- return count
+ return stack:get_count()
end,
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
minetest.log("action", player:get_player_name()..
@@ -1242,7 +1242,7 @@ minetest.register_node("default:chest_locked", {
minetest.log("action", player:get_player_name()..
" moves stuff to locked chest at "..minetest.pos_to_string(pos))
end,
- on_metadata_inventory_take = function(pos, listname, index, count, player)
+ on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" takes stuff from locked chest at "..minetest.pos_to_string(pos))
end,
diff --git a/games/minimal/mods/experimental/init.lua b/games/minimal/mods/experimental/init.lua
index 0b45aeb62..2edfd0f67 100644
--- a/games/minimal/mods/experimental/init.lua
+++ b/games/minimal/mods/experimental/init.lua
@@ -534,7 +534,7 @@ local inv = minetest.create_detached_inventory("test_inventory", {
experimental.print_to_everything("allow put asked")
return 1 -- Allow only 1
end,
- allow_take = function(inv, listname, index, count, player)
+ allow_take = function(inv, listname, index, stack, player)
experimental.print_to_everything("allow take asked")
return 4 -- Allow 4 at max
end,
@@ -544,7 +544,7 @@ local inv = minetest.create_detached_inventory("test_inventory", {
on_put = function(inv, listname, index, stack, player)
experimental.print_to_everything(player:get_player_name().." put items")
end,
- on_take = function(inv, listname, index, count, player)
+ on_take = function(inv, listname, index, stack, player)
experimental.print_to_everything(player:get_player_name().." took items")
end,
})