diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/lua_api.txt | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 301832618..e32efc6df 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1,4 +1,4 @@ -Minetest Lua Modding API Reference 0.4.0 +Minetest Lua Modding API Reference 0.4.4 ========================================== More information at http://c55.me/minetest/ @@ -694,6 +694,11 @@ image[<X>,<Y>;<W>,<H>;<texture name>] ^ Show an image ^ Position and size units are inventory slots +background[<X>,<Y>;<W>,<H>;<texture name>] +^ Use a background. Inventory rectangles are not drawn then. +^ Position and size units are inventory slots +^ Example for formspec 8x4 in 16x resolution: image shall be sized 8*16px x 4*16px + field[<X>,<Y>;<W>,<H>;<name>;<label>;<default>] ^ Textual field; will be sent to server when a button is clicked ^ x and y position the field relative to the top left of the menu @@ -787,6 +792,11 @@ minetest.register_craft(recipe) Global callback registration functions: (Call these only at load time) minetest.register_globalstep(func(dtime)) ^ Called every server step, usually interval of 0.05s +minetest.register_on_shutdown(func()) +^ Called before server shutdown +^ WARNING: If the server terminates abnormally (i.e. crashes), the registered + callbacks WILL LIKELY NOT BE RUN. Data should be saved at + semi-frequent intervals as well as on server shutdown. minetest.register_on_placenode(func(pos, newnode, placer, oldnode)) ^ Called when a node has been placed ^ Deprecated: Use on_construct or after_place_node in node definition instead @@ -1098,6 +1108,10 @@ methods: - get_wielded_item() -> ItemStack - set_wielded_item(item): replaces the wielded item, returns true if successful - set_armor_groups({group1=rating, group2=rating, ...}) +- set_animation({x=1,y=1}, frame_speed=15, frame_blend=0) +- set_attach(parent, "", {x=0,y=0,z=0}, {x=0,y=0,z=0}) +- set_detach() +- set_bone_position("", {x=0,y=0,z=0}, {x=0,y=0,z=0}) - set_properties(object property table) LuaEntitySAO-only: (no-op for other objects) - setvelocity({x=num, y=num, z=num}) @@ -1123,7 +1137,11 @@ Player-only: (no-op for other objects) ^ Redefine player's inventory form ^ Should usually be called in on_joinplayer - get_inventory_formspec() -> formspec string - +- get_player_control(): returns table with player pressed keys + {jump=bool,right=bool,left=bool,LMB=bool,RMB=bool,sneak=bool,aux1=bool,down=bool,up=bool} +- get_player_control_bits(): returns integer with bit packed player pressed keys + bit nr/meaning: 0/up ,1/down ,2/left ,3/right ,4/jump ,5/aux1 ,6/sneak ,7/LMB ,8/RMB + InvRef: Reference to an inventory methods: - is_empty(listname): return true if list is empty @@ -1222,9 +1240,11 @@ Object Properties physical = true, weight = 5, collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5}, - visual = "cube"/"sprite"/"upright_sprite", + visual = "cube"/"sprite"/"upright_sprite"/"mesh", visual_size = {x=1, y=1}, + mesh = "model", textures = {}, -- number of required textures depends on visual + colors = {}, -- number of required colors depends on visual spritediv = {x=1, y=1}, initial_sprite_basepos = {x=0, y=0}, is_visible = true, |