summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorNovatux <nathanael.courant@laposte.net>2013-10-26 11:25:28 +0200
committerNovatux <nathanael.courant@laposte.net>2013-11-01 15:55:34 +0100
commitbd6d4666abe20247437ede28f73955d413fe5e22 (patch)
treec67cd847a18096a5889f00f8a4e613209bd6382e /doc
parent2f10cfb226c6de8024f5efa9bf14ea22b5b90ce2 (diff)
downloadminetest-bd6d4666abe20247437ede28f73955d413fe5e22.tar.gz
minetest-bd6d4666abe20247437ede28f73955d413fe5e22.tar.bz2
minetest-bd6d4666abe20247437ede28f73955d413fe5e22.zip
Add a callback: minetest.register_on_craft(itemstack, player,
old_craft_grid, craft_inv) and minetest.register_craft_predict(itemstack, player, old_craft_grid, craft_inv)
Diffstat (limited to 'doc')
-rw-r--r--doc/lua_api.txt9
1 files changed, 9 insertions, 0 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index 5a0d5817f..e94fd30a9 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -1145,6 +1145,15 @@ minetest.register_on_player_receive_fields(func(player, formname, fields))
minetest.register_on_mapgen_init(func(MapgenParams))
^ Called just before the map generator is initialized but before the environment is initialized
^ MapgenParams consists of a table with the fields mgname, seed, water_level, and flags
+minetest.register_on_craft(func(itemstack, player, old_craft_grid, craft_inv))
+^ Called when player crafts something
+^ itemstack is the output
+^ old_craft_grid contains the recipe (Note: the one in the inventory is cleared)
+^ craft_inv is the inventory with the crafting grid
+^ Return either an ItemStack, to replace the output, or nil, to not modify it
+minetest.register_craft_predict(func(itemstack, player, old_craft_grid, craft_inv))
+^ The same as before, except that it is called before the player crafts, to make
+^ craft prediction, and it should not change anything.
Other registration functions:
minetest.register_chatcommand(cmd, chatcommand definition)