aboutsummaryrefslogtreecommitdiff
path: root/games/devtest/mods/experimental/detached.lua
diff options
context:
space:
mode:
authorWuzzy <wuzzy2@mail.ru>2020-05-26 00:17:52 +0200
committerGitHub <noreply@github.com>2020-05-26 00:17:52 +0200
commit083b285f4319c470f307f0b52f03a2fb68facd38 (patch)
treebdd02540ad58756a38606f03a995ab837a176709 /games/devtest/mods/experimental/detached.lua
parentb546e8938d41aa9e3101fb9d4d5b02924ed73b60 (diff)
downloadminetest-083b285f4319c470f307f0b52f03a2fb68facd38.tar.gz
minetest-083b285f4319c470f307f0b52f03a2fb68facd38.tar.bz2
minetest-083b285f4319c470f307f0b52f03a2fb68facd38.zip
Rename “Minimal development test” to “Development Test” (#9928)
Diffstat (limited to 'games/devtest/mods/experimental/detached.lua')
-rw-r--r--games/devtest/mods/experimental/detached.lua29
1 files changed, 29 insertions, 0 deletions
diff --git a/games/devtest/mods/experimental/detached.lua b/games/devtest/mods/experimental/detached.lua
new file mode 100644
index 000000000..673adfdd4
--- /dev/null
+++ b/games/devtest/mods/experimental/detached.lua
@@ -0,0 +1,29 @@
+-- Create a detached 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, stack, 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, stack, player)
+ experimental.print_to_everything(player:get_player_name().." took items")
+ end,
+})
+inv:set_size("main", 4*6)
+inv:add_item("main", "experimental:callback_node")
+inv:add_item("main", "experimental:particle_spawner")
+
+