diff options
author | Wuzzy <wuzzy2@mail.ru> | 2020-05-24 15:46:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-24 14:46:26 +0100 |
commit | 6456aba73f0ef3f2fa7fd2b2a69cfdf8624afe23 (patch) | |
tree | f2bada583c6f4d3032f28b2627bf052174f0a847 /games/minimal/mods/experimental/detached.lua | |
parent | a9b74f4c3966ad38c2f9a97364d3fdda0e514c93 (diff) | |
download | minetest-6456aba73f0ef3f2fa7fd2b2a69cfdf8624afe23.tar.gz minetest-6456aba73f0ef3f2fa7fd2b2a69cfdf8624afe23.tar.bz2 minetest-6456aba73f0ef3f2fa7fd2b2a69cfdf8624afe23.zip |
Replacement for Minimal Development Test (PR) (#9450)
Diffstat (limited to 'games/minimal/mods/experimental/detached.lua')
-rw-r--r-- | games/minimal/mods/experimental/detached.lua | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/games/minimal/mods/experimental/detached.lua b/games/minimal/mods/experimental/detached.lua new file mode 100644 index 000000000..673adfdd4 --- /dev/null +++ b/games/minimal/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") + + |