From bd6d4666abe20247437ede28f73955d413fe5e22 Mon Sep 17 00:00:00 2001 From: Novatux Date: Sat, 26 Oct 2013 11:25:28 +0200 Subject: 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) --- doc/lua_api.txt | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'doc') 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) -- cgit v1.2.3