X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=doc%2Flua_api.txt;h=e3fc92b29df13ffd494d17cb9cb9b430e74d372e;hb=c3eb7fe316fc74892288a92c1fe645f9834cc3ed;hp=b0281bee7b4e2979bf9c1c938c8917817be2622b;hpb=a0f5b70568c1140085cba2e2d8d83b6ae6912ed1;p=minetest.git diff --git a/doc/lua_api.txt b/doc/lua_api.txt index b0281bee7..e3fc92b29 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1,4 +1,4 @@ -Minetest Lua Modding API Reference 0.4.7 +Minetest Lua Modding API Reference 0.4.9 ======================================== More information at http://www.minetest.net/ Developer Wiki: http://dev.minetest.net/ @@ -100,6 +100,8 @@ Mod directory structure mods |-- modname | |-- depends.txt +| |-- screenshot.png +| |-- description.txt | |-- init.lua | |-- textures | | |-- modname_stuff.png @@ -121,12 +123,11 @@ depends.txt: to a single modname. Their meaning is that if the specified mod is missing, that does not prevent this mod from being loaded. -optdepends.txt: - An alternative way of specifying optional dependencies. - Like depends.txt, a single line contains a single modname. +screenshot.png: + A screenshot shown in modmanager within mainmenu. - NOTE: This file exists for compatibility purposes only and - support for it will be removed from the engine by the end of 2013. +description.txt: + File containing desctiption to be shown within mainmenu. init.lua: The main Lua script. Running this script should register everything it @@ -322,6 +323,8 @@ param2 is reserved for the engine when any of these are used: facedir modulo 4 = axisdir 0 = y+ 1 = z+ 2 = z- 3 = x+ 4 = x- 5 = y- facedir's two less significant bits are rotation around the axis + paramtype2 == "leveled" + ^ The drawn node level is read from param2, like flowingliquid Nodes can also contain extra data. See "Node Metadata". @@ -353,7 +356,7 @@ Node selection boxes are defined using "node boxes" The "nodebox" node drawtype allows defining visual of nodes consisting of arbitrary number of boxes. It allows defining stuff like stairs. Only the -"fixed" box type is supported for these. +"fixed" and "leveled" box type is supported for these. ^ Please note that this is still experimental, and may be incompatibly changed in the future. @@ -381,6 +384,8 @@ A box is defined as: A box of a regular node would look like: {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, +type = "leveled" is same as "fixed", but y2 will be automaticaly setted to level from param2 + Ore types --------------- These tell in what manner the ore is generated. @@ -432,18 +437,16 @@ Schematic specifier or through raw data supplied through Lua, in the form of a table. This table must specify two fields: - The 'size' field is a 3d vector containing the dimensions of the provided schematic. - The 'data' field is a flat table of MapNodes making up the schematic, in the order of [z [y [x]]]. +Important: The default value for param1 in MapNodes here is 255, which represents "always place". In the bulk MapNode data, param1, instead of the typical light values, instead represents the probability of that node appearing in the structure. -When passed to minetest.create_schematic, probability is an integer value ranging from -1 to 255: - - A probability value of 0 means that node will always appear. - - A probability value of -1 means the node will never appear. +When passed to minetest.create_schematic, probability is an integer value ranging from 0 to 255: + - A probability value of 0 means that node will never appear (0% chance). + - A probability value of 255 means the node will always appear (100% chance). - If the probability value p is greater than 0, then there is a (p / 256 * 100)% chance that node will appear when the schematic is placed on the map. -If registering a structure in the raw format, however, -1 is not a valid probability value; in order to -have a node that is not placed, it must be CONTENT_IGNORE (the name for which is "ignore"). - Important note: Node aliases cannot be used for a raw schematic provided when registering as a decoration. Schematic attributes @@ -476,8 +479,10 @@ Note: Future revisions to the HUD API may be incompatible; the HUD API is still - image Displays an image on the HUD. - - scale: The scale of the image, with 1 being the original texture size. - Only the X coordinate scale is used. + - scale: The scale of the image, with 1 being the original texture size. + Only the X coordinate scale is used (positive values) + Negative values represent that percentage of the screen it + should take; e.g. x=-100 means 100% (width) - text: The name of the texture that is displayed. - alignment: The alignment of the image. - offset: offset in pixels from position. @@ -869,6 +874,22 @@ list[;;,;,;] list[;;,;,;] ^ Show an inventory list +listcolors[;] +^ Sets background color of slots in HEX-Color format +^ Sets background color of slots on mouse hovering + +listcolors[;;] +^ Sets background color of slots in HEX-Color format +^ Sets background color of slots on mouse hovering +^ Sets color of slots border + +listcolors[;;;;] +^ Sets background color of slots in HEX-Color format +^ Sets background color of slots on mouse hovering +^ Sets color of slots border +^ Sets background color of tooltips +^ Sets font color of tooltips + image[,;,;] ^ Show an image ^ Position and size units are inventory slots @@ -877,11 +898,21 @@ item_image[,;,;] ^ Show an inventory image of registered item/node ^ Position and size units are inventory slots +bgcolor[;] +^ Sets background color of formspec in HEX-Color format +^ If true the background color is drawn fullscreen (does not effect the size of the formspec) + background[,;,;] ^ 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 +background[,;,;;] +^ 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 +^ If true the background is clipped to formspec size (x and y are used as offset values, w and h are ignored) + pwdfield[,;,;;