aboutsummaryrefslogtreecommitdiff
path: root/games/minimal/mods/experimental
diff options
context:
space:
mode:
Diffstat (limited to 'games/minimal/mods/experimental')
-rw-r--r--games/minimal/mods/experimental/init.lua26
1 files changed, 24 insertions, 2 deletions
diff --git a/games/minimal/mods/experimental/init.lua b/games/minimal/mods/experimental/init.lua
index 498c64623..0b45aeb62 100644
--- a/games/minimal/mods/experimental/init.lua
+++ b/games/minimal/mods/experimental/init.lua
@@ -516,7 +516,7 @@ minetest.register_craft({
--[[minetest.register_on_joinplayer(function(player)
minetest.after(3, function()
- player:set_inventory_formspec("invsize[8,7.5;]"..
+ player:set_inventory_formspec("size[8,7.5]"..
"image[1,0.6;1,2;player.png]"..
"list[current_player;main;0,3.5;8,4;]"..
"list[current_player;craft;3,0;3,3;]"..
@@ -525,7 +525,29 @@ minetest.register_craft({
end)]]
-- Create a detached inventory
-local inv = minetest.create_detached_inventory("test_inventory")
+local inv = minetest.create_detached_inventory("test_inventory", {
+ allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
+ experimental.print_to_everything("allow move asked")
+ return count -- Allow all
+ end,
+ allow_put = function(inv, listname, index, stack, player)
+ experimental.print_to_everything("allow put asked")
+ return 1 -- Allow only 1
+ end,
+ allow_take = function(inv, listname, index, count, player)
+ experimental.print_to_everything("allow take asked")
+ return 4 -- Allow 4 at max
+ end,
+ on_move = function(inv, from_list, from_index, to_list, to_index, count, player)
+ experimental.print_to_everything(player:get_player_name().." moved items")
+ end,
+ 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)
+ experimental.print_to_everything(player:get_player_name().." took items")
+ end,
+})
inv:set_size("main", 4*6)
inv:add_item("main", "experimental:tester_tool_1")
inv:add_item("main", "experimental:tnt 5")