X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=doc%2Flua_api.txt;h=91ea900d0ce9f366e51e851402cdc9f93d68b62b;hb=75320e7e88ab5088a46c9e42c1e789cbdacb13b0;hp=d8e58f2a88d5adcea4f4281c2701d7f6e507c494;hpb=e09c7fceaa93ad3d7d85f657df0663f6efc70281;p=oweals%2Fminetest.git diff --git a/doc/lua_api.txt b/doc/lua_api.txt index d8e58f2a8..91ea900d0 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -15,8 +15,7 @@ Mods are contained and ran solely on the server side. Definitions and media files are automatically transferred to the client. If you see a deficiency in the API, feel free to attempt to add the -functionality in the engine and API. You can send such improvements as -source code patches to . +functionality in the engine and API. Programming in Lua ------------------ @@ -285,11 +284,19 @@ on top of `cobble.png`. ### Advanced texture modifiers -#### `[crack::

` +#### Crack +* `[crack::

` +* `[cracko::

` +* `[crack:::

` +* `[cracko:::

` + +Parameters: +* `` = tile count (in each direction) * `` = animation frame count * `

` = current animation frame Draw a step of the crack animation on the texture. +`crack` draws it normally, while `cracko` lays it over, keeping transparent pixels intact. Example: @@ -715,6 +722,10 @@ the global `minetest.registered_*` tables. * added to `minetest.registered_biome` with the key of `biome.name` * if `biome.name` is nil, the key is the returned ID +* `minetest.unregister_biome(name)` + * Unregisters the biome name from engine, and deletes the entry with key + * `name` from `minetest.registered_biome` + * `minetest.register_ore(ore definition)` * returns an integer uniquely identifying the registered ore * added to `minetest.registered_ores` with the key of `ore.name` @@ -820,6 +831,15 @@ node definition: 0 = y+ 1 = z+ 2 = z- 3 = x+ 4 = x- 5 = y- facedir modulo 4 = rotation around that axis paramtype2 == "leveled" + ^ Only valid for "nodebox" with 'type = "leveled"', and "plantlike_rooted". + Leveled nodebox: + The level of the top face of the nodebox is stored in param2. + The other faces are defined by 'fixed = {}' like 'type = "fixed"' nodeboxes. + The nodebox height is (param2 / 64) nodes. + The maximum accepted value of param2 is 127. + Rooted plantlike: + The height of the 'plantlike' section is stored in param2. + The height is (param2 / 16) nodes. paramtype2 == "degrotate" ^ The rotation of this node is stored in param2. Plants are rotated this way. Values range 0 - 179. The value stored in param2 is multiplied by two to @@ -855,13 +875,14 @@ node definition: The palette should have 32 pixels. paramtype2 == "glasslikeliquidlevel" ^ Only valid for "glasslike_framed" or "glasslike_framed_optional" drawtypes. - param2 defines 64 levels of internal liquid. + param2 values 0-63 define 64 levels of internal liquid, 0 being empty and + 63 being full. Liquid texture is defined using `special_tiles = {"modname_tilename.png"},` Nodes can also contain extra data. See "Node Metadata". Node drawtypes ---------------- +-------------- There are a bunch of different looking node types. Look for examples in `games/minimal` or `games/minetest_game`. @@ -881,22 +902,18 @@ Look for examples in `games/minimal` or `games/minetest_game`. * `firelike` * `fencelike` * `raillike` -* `nodebox` -- See below. (**Experimental!**) -* `mesh` -- use models for nodes -* `plantlike_rooted` +* `nodebox` -- See below +* `mesh` -- Use models for nodes, see below +* `plantlike_rooted` -- See below `*_optional` drawtypes need less rendering time if deactivated (always client side). Node boxes ------------ +---------- 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` and `leveled` box type is supported for these. - -Please note that this is still experimental, and may be incompatibly -changed in the future. +The `nodebox` node drawtype allows defining nodes consisting of an arbitrary +number of boxes. It allows defining stuff like stairs and slabs. A nodebox is defined as any of: @@ -905,10 +922,18 @@ A nodebox is defined as any of: type = "regular" } { - -- A fixed box (facedir param2 is used, if applicable) + -- A fixed box (or boxes) (facedir param2 is used, if applicable) type = "fixed", fixed = box OR {box1, box2, ...} } + { + -- A variable height box (or boxes) with the top face position defined by + -- the node parameter 'leveled = ', or if 'paramtype2 == "leveled"' by + -- param2. + -- Other faces are defined by 'fixed = {}' as with 'type = "fixed"'. + type = "leveled", + fixed = box OR {box1, box2, ...} + } { -- A box like the selection box for torches -- (wallmounted param2 is used, if applicable) @@ -938,16 +963,24 @@ 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 `type = "fixed"`, but `y2` will be automatically -set to level from `param2`. - - Meshes ------ If drawtype `mesh` is used, tiles should hold model materials textures. Only static meshes are implemented. For supported model formats see Irrlicht engine documentation. +Rooted plantlike drawtype +------------------------- +The `plantlike_rooted` drawtype was developed to enable underwater plants +without air bubbles around the plants. +It consists of a base cube at the co-ordinates of the node (the seabed / +lakebed / riverbed node) plus a 'plantlike' extension above with a height +defined by param2 (maximum height 16 nodes). This extension visually passes +through any nodes above the base cube without affecting them. +The node is dug by digging the base cube. +The base cube texture tiles are defined as normal, the plantlike extension +uses the defined 'special tile', for example: +`special_tiles = {{name = "default_papyrus.png", tileable_vertical = true}},` Noise Parameters ---------------- @@ -1065,7 +1098,6 @@ within the currently generated chunk. The vertical top and bottom displacement of each puff are determined by the noise parameters `np_puff_top` and `np_puff_bottom`, respectively. - ### `blob` Creates a deformed sphere of ore according to 3d perlin noise described by `noise_params`. The maximum size of the blob is `clust_size`, and @@ -1074,12 +1106,17 @@ Creates a deformed sphere of ore according to 3d perlin noise described by ### `vein` Creates veins of ore varying in density by according to the intersection of two instances of 3d perlin noise with diffferent seeds, both described by -`noise_params`. `random_factor` varies the influence random chance has on -placement of an ore inside the vein, which is `1` by default. Note that -modifying this parameter may require adjusting `noise_threshold`. +`noise_params`. + +`random_factor` varies the influence random chance has on placement of an ore +inside the vein, which is `1` by default. Note that modifying this parameter may +require adjusting `noise_threshold`. + The parameters `clust_scarcity`, `clust_num_ores`, and `clust_size` are ignored -by this ore type. This ore type is difficult to control since it is sensitive -to small changes. The following is a decent set of parameters to work from: +by this ore type. + +This ore type is difficult to control since it is sensitive to small changes. +The following is a decent set of parameters to work from: noise_params = { offset = 0, @@ -1095,6 +1132,30 @@ to small changes. The following is a decent set of parameters to work from: **WARNING**: Use this ore type *very* sparingly since it is ~200x more computationally expensive than any other ore. +### `stratum` +Creates a single undulating ore stratum that is continuous across mapchunk +borders and horizontally spans the world. + +The 2D perlin noise described by `noise_params` varies the Y co-ordinate of the +stratum midpoint. The 2D perlin noise described by `np_stratum_thickness` +varies the stratum's vertical thickness (in units of nodes). Due to being +continuous across mapchunk borders the stratum's vertical thickness is +unlimited. + +`y_min` and `y_max` define the limits of the ore generation and for performance +reasons should be set as close together as possible but without clipping the +stratum's Y variation. + +If either of the 2 noise parameters are omitted the ore will occur from y_min +to y_max in a simple horizontal stratum. As this does not compute noise +performance improves, and is ideal for placing many layers. + +Each node in the stratum has a 1-in-`clust_scarcity` chance of being ore, so a +solid-ore stratum would require a `clust_scarcity` of 1. + +The parameters `clust_num_ores`, `clust_size`, `noise_threshold` and +`random_factor` are ignored by this ore type. + Ore attributes -------------- See section "Flag Specifier Format". @@ -1448,7 +1509,7 @@ Another example: Make red wool from white wool and red dye: * `connect_to_raillike`: makes nodes of raillike drawtype with same group value connect to each other * `slippery`: Players and items will slide on the node. - Only use `slippery = 3` for now to ensure forwards compatibility. + Slipperiness rises steadily with `slippery` value, starting at 1. ### Known damage and digging time defining groups @@ -1867,6 +1928,8 @@ examples. #### `textarea[,;,;;