diff options
author | Perttu Ahola <celeron55@gmail.com> | 2012-07-22 17:11:41 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2012-07-22 17:40:48 +0300 |
commit | acf3a4309595b735a5c4c6c743b202e37e6366a5 (patch) | |
tree | 303f9da916dcf6b2ef8bc0a3303af43122a15be2 /games/minimal/mods | |
parent | 4cc98d7add7b697ac302a6136bbeb95ef78cec45 (diff) | |
download | minetest-acf3a4309595b735a5c4c6c743b202e37e6366a5.tar.gz minetest-acf3a4309595b735a5c4c6c743b202e37e6366a5.tar.bz2 minetest-acf3a4309595b735a5c4c6c743b202e37e6366a5.zip |
Add /test1 command to minimal for testing a more complicated player inventory form
Diffstat (limited to 'games/minimal/mods')
-rw-r--r-- | games/minimal/mods/experimental/init.lua | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/games/minimal/mods/experimental/init.lua b/games/minimal/mods/experimental/init.lua index 5661a660f..12aab3b06 100644 --- a/games/minimal/mods/experimental/init.lua +++ b/games/minimal/mods/experimental/init.lua @@ -517,6 +517,38 @@ minetest.register_craft({ end) end)]] +minetest.register_chatcommand("test1", { + params = "", + description = "Test 1: Modify player's inventory view", + func = function(name, param) + local player = minetest.env:get_player_by_name(name) + if not player then + return + end + player:set_inventory_formspec( + "size[13,7.5]".. + "image[6,0.6;1,2;player.png]".. + "list[current_player;main;5,3.5;8,4;]".. + "list[current_player;craft;8,0;3,3;]".. + "list[current_player;craftpreview;12,1;1,1;]".. + "button[0.5,7;2,1;button1;Button 1]".. + "button[2.5,7;2,1;button2;Button 2]" + ) + minetest.chat_send_player(name, "Done."); + end, +}) + +minetest.register_on_player_receive_fields(function(player, formname, fields) + experimental.print_to_everything("Inventory fields 1: player="..player:get_player_name()..", fields="..dump(fields)) +end) +minetest.register_on_player_receive_fields(function(player, formname, fields) + experimental.print_to_everything("Inventory fields 2: player="..player:get_player_name()..", fields="..dump(fields)) + return true -- Disable the first callback +end) +minetest.register_on_player_receive_fields(function(player, formname, fields) + experimental.print_to_everything("Inventory fields 3: player="..player:get_player_name()..", fields="..dump(fields)) +end) + minetest.log("experimental modname="..dump(minetest.get_current_modname())) minetest.log("experimental modpath="..dump(minetest.get_modpath("experimental"))) minetest.log("experimental worldpath="..dump(minetest.get_worldpath())) |