X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=doc%2Flua_api.txt;h=6ed5608694d95e0318c3555f48933b0374b46030;hb=2625323f25ebb4e9ab1079ff60a77b40f58c5bf9;hp=cd9e27b7a1e2112e5dacec037c5bc25707cb0f5a;hpb=7433d65d3e383cd3d2f5ced38d9109e9fd7c72c0;p=dragonfireclient.git diff --git a/doc/lua_api.txt b/doc/lua_api.txt index cd9e27b7a..6ed560869 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1,4 +1,4 @@ -Minetest Lua Modding API Reference 0.4.8 +Minetest Lua Modding API Reference 0.4.9 ======================================== More information at http://www.minetest.net/ Developer Wiki: http://dev.minetest.net/ @@ -129,13 +129,6 @@ screenshot.png: description.txt: File containing desctiption to be shown within mainmenu. -optdepends.txt: - An alternative way of specifying optional dependencies. - Like depends.txt, a single line contains a single modname. - - NOTE: This file exists for compatibility purposes only and - support for it will be removed from the engine by the end of 2013. - init.lua: The main Lua script. Running this script should register everything it wants to register. Subsequent execution depends on minetest calling the @@ -400,7 +393,7 @@ All default ores are of the uniformly-distributed scatter type. - scatter Randomly chooses a location and generates a cluster of ore. - If noise_params is specified, the ore will be placed if the 3d perlin noise at + If noise_params is specified, the ore will be placed if the 3d perlin noise at that point is greater than the noise_threshhold, giving the ability to create a non-equal distribution of ore. - sheet @@ -417,6 +410,7 @@ All default ores are of the uniformly-distributed scatter type. Ore attributes ------------------- +See section Flag Specifier Format. Currently supported flags: absheight - absheight Also produce this same ore between the height range of -height_max and -height_min. @@ -446,7 +440,7 @@ or through raw data supplied through Lua, in the form of a table. This table mu - 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 +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 0 to 255: - A probability value of 0 means that node will never appear (0% chance). @@ -458,6 +452,7 @@ Important note: Node aliases cannot be used for a raw schematic provided when re Schematic attributes --------------------- +See section Flag Specifier Format. Currently supported flags: place_center_x, place_center_y, place_center_z - place_center_x Placement of this decoration is centered along the X axis. @@ -480,6 +475,7 @@ values can be used. The offset field specifies a pixel offset from the position. Contrary to position, the offset is not scaled to screen size. This allows for some precisely-positioned items in the HUD. +Note offset WILL adapt to screen dpi as well as user defined scaling factor! Below are the specific uses for fields in each type; fields not listed for that type are ignored. Note: Future revisions to the HUD API may be incompatible; the HUD API is still in the experimental stages. @@ -509,11 +505,18 @@ Note: Future revisions to the HUD API may be incompatible; the HUD API is still If odd, will end with a vertically center-split texture. - direction - offset: offset in pixels from position. + - size: If used will force full-image size to this value (override texture pack image size) - inventory - text: The name of the inventory list to be displayed. - number: Number of items in the inventory to be displayed. - item: Position of item that is selected. - direction +- waypoint + Displays distance to selected world position. + - name: The name of the waypoint. + - text: Distance suffix. Can be blank. + - number: An integer containing the RGB value of the color used to draw the text. + - world_pos: World position of the waypoint. Representations of simple things -------------------------------- @@ -526,6 +529,26 @@ pointed_thing: {type="node", under=pos, above=pos} {type="object", ref=ObjectRef} +Flag Specifier Format +----------------------- +Flags using the standardized flag specifier format can be specified in either of two ways, by string or table. +The string format is a comma-delimited set of flag names; whitespace and unrecognized flag fields are ignored. +Specifying a flag in the string sets the flag, and specifying a flag prefixed by the string "no" explicitly +clears the flag from whatever the default may be. +In addition to the standard string flag format, the schematic flags field can also be a table of flag names +to boolean values representing whether or not the flag is set. Additionally, if a field with the flag name +prefixed with "no" is present, mapped to a boolean of any value, the specified flag is unset. + +e.g. A flag field of value + {place_center_x = true, place_center_y=false, place_center_z=true} +is equivalent to + {place_center_x = true, noplace_center_y=true, place_center_z=true} +which is equivalent to + "place_center_x, noplace_center_y, place_center_z" +or even + "place_center_x, place_center_z" +since, by default, no schematic attributes are set. + Items ------ Node (register_node): @@ -543,7 +566,7 @@ eg. 'default:pick_wood 21323' eg. 'default:apple' Table format: -eg. {name="default:dirt", count=5, wear=0, metadata=""} +eg. {name="default:dirt", count=5, wear=0, metadata=""} ^ 5 dirt nodes eg. {name="default:pick_wood", count=1, wear=21323, metadata=""} ^ a wooden pick about 1/3 weared out @@ -828,7 +851,7 @@ Example stuff: local meta = minetest.get_meta(pos) meta:set_string("formspec", - "invsize[8,9;]".. + "size[8,9]".. "list[context;main;0,0;8,4;]".. "list[current_player;main;0,5;8,4;]") meta:set_string("infotext", "Chest"); @@ -840,7 +863,7 @@ meta:from_table({ main = {[1] = "default:dirt", [2] = "", [3] = "", [4] = "", [5] = "", [6] = "", [7] = "", [8] = "", [9] = "", [10] = "", [11] = "", [12] = "", [13] = "", [14] = "default:cobble", [15] = "", [16] = "", [17] = "", [18] = "", [19] = "", [20] = "default:cobble", [21] = "", [22] = "", [23] = "", [24] = "", [25] = "", [26] = "", [27] = "", [28] = "", [29] = "", [30] = "", [31] = "", [32] = ""} }, fields = { - formspec = "invsize[8,9;]list[context;main;0,0;8,4;]list[current_player;main;0,5;8,4;]", + formspec = "size[8,9]list[context;main;0,0;8,4;]list[current_player;main;0,5;8,4;]", infotext = "Chest" } }) @@ -855,17 +878,17 @@ examples. Examples: - Chest: - invsize[8,9;] + size[8,9] list[context;main;0,0;8,4;] list[current_player;main;0,5;8,4;] - Furnace: - invsize[8,9;] + size[8,9] list[context;fuel;2,3;1,1;] list[context;src;2,1;1,1;] list[context;dst;5,1;2,2;] list[current_player;main;0,5;8,4;] - Minecraft-like player inventory - invsize[8,7.5;] + size[8,7.5] image[1,0.6;1,2;player.png] list[current_player;main;0,3.5;8,4;] list[current_player;craft;3,0;3,3;] @@ -873,8 +896,9 @@ Examples: Elements: -size[,] +size[,,] ^ Define the size of the menu in inventory slots +^ fixed_size true/false (optional) ^ deprecated: invsize[,;] list[;;,;,;] @@ -962,32 +986,28 @@ vertlabel[,;