From 61c0c5feb646e13eb6df121d6ca19002155e36ad Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Tue, 17 Mar 2015 18:18:48 +0000 Subject: [PATCH] Lua API: update --- lua_api.html | 271 ++++++++++++++++++++++++++++------------------ update_lua_api.py | 2 +- 2 files changed, 164 insertions(+), 109 deletions(-) diff --git a/lua_api.html b/lua_api.html index a804026..ef8ca8d 100644 --- a/lua_api.html +++ b/lua_api.html @@ -323,7 +323,8 @@ source code patches to http://www.minetest.net/
  • Developer Wiki: http://dev.minetest.net/
  • Programming in Lua

    -

    If you have any difficulty in understanding this, please read Programming in Lua.

    +

    If you have any difficulty in understanding this, please read +Programming in Lua.

    Startup

    Mods are loaded during server startup from the mod load paths by running the init.lua scripts in a shared environment.

    @@ -829,7 +830,8 @@ set to level from param2.

    Only static meshes are implemented. For supported model formats see Irrlicht engine documentation.

    Noise Parameters

    -

    Noise Parameters, or commonly called "NoiseParams", define the properties of perlin noise.

    +

    Noise Parameters, or commonly called "NoiseParams", define the properties of +perlin noise.

    offset

    Offset that the noise is translated by (i.e. added) after calculation.

    scale

    @@ -884,17 +886,19 @@ If no flags are specified (or defaults is), 2D noise is eased and 3D noise is no

    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 -that point is greater than the noise_threshold, giving the ability to create a non-equal -distribution of ore.

    +that point is greater than the noise_threshold, giving the ability to create +a non-equal distribution of ore.

    sheet

    -

    Creates a sheet of ore in a blob shape according to the 2D perlin noise described by noise_params. -The relative height of the sheet can be controlled by the same perlin noise as well, by specifying -a non-zero scale parameter in noise_params.

    -

    IMPORTANT: The noise is not transformed by offset or scale when comparing against the noise -threshold, but scale is used to determine relative height. +

    Creates a sheet of ore in a blob shape according to the 2D perlin noise +described by noise_params. The relative height of the sheet can be +controlled by the same perlin noise as well, by specifying a non-zero +scale parameter in noise_params.

    +

    IMPORTANT: The noise is not transformed by offset or scale when comparing +against the noise threshold, but scale is used to determine relative height. The height of the blob is randomly scattered, with a maximum height of clust_size.

    clust_scarcity and clust_num_ores are ignored.

    -

    This is essentially an improved version of the so-called "stratus" ore seen in some unofficial mods.

    +

    This is essentially an improved version of the so-called "stratus" ore seen in +some unofficial mods.

    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 @@ -931,49 +935,60 @@ computationally expensive than any other ore.

    The varying types of decorations that can be placed.

    The default value is simple, and is currently the only type supported.

    simple

    -

    Creates a 1 times H times 1 column of a specified node (or a random node from a list, if a -decoration list is specified). Can specify a certain node it must spawn next to, such as water or -lava, for example. Can also generate a decoration of random height between a specified lower and -upper bound. This type of decoration is intended for placement of grass, flowers, cacti, papyri, -and so on.

    +

    Creates a 1 times H times 1 column of a specified node (or a random node from +a list, if a decoration list is specified). Can specify a certain node it must +spawn next to, such as water or lava, for example. Can also generate a +decoration of random height between a specified lower and upper bound. +This type of decoration is intended for placement of grass, flowers, cacti, +papyri, and so on.

    schematic

    -

    Copies a box of MapNodes from a specified schematic file (or raw description). Can specify a -probability of a node randomly appearing when placed. This decoration type is intended to be used -for multi-node sized discrete structures, such as trees, cave spikes, rocks, and so on.

    +

    Copies a box of MapNodes from a specified schematic file (or raw description). +Can specify a probability of a node randomly appearing when placed. +This decoration type is intended to be used for multi-node sized discrete +structures, such as trees, cave spikes, rocks, and so on.

    Schematic specifier

    -

    A schematic specifier identifies a schematic by either a filename to a Minetest Schematic file (.mts) -or through raw data supplied through Lua, in the form of a table. This table must specify two fields:

    +

    A schematic specifier identifies a schematic by either a filename to a +Minetest Schematic file (.mts) or through raw data supplied through Lua, +in the form of a table. This table must specify two fields:

    -

    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 0 to 255:

    +

    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 0 to 255:

    -

    Important note: Node aliases cannot be used for a raw schematic provided when registering as a decoration.

    +

    Important note: Node aliases cannot be used for a raw schematic provided + when registering as a decoration.

    Schematic attributes

    See section "Flag Specifier Format".

    -

    Currently supported flags: place_center_x, place_center_y, place_center_z.

    +

    Currently supported flags: place_center_x, place_center_y, + place_center_z, force_placement.

    HUD element types

    The position field is used for all element types.

    -

    To account for differing resolutions, the position coordinates are the percentage of the screen, -ranging in value from 0 to 1.

    -

    The name field is not yet used, but should contain a description of what the HUD element represents. -The direction field is the direction in which something is drawn.

    -

    0 draws from left to right, 1 draws from right to left, 2 draws from top to bottom, -and 3 draws from bottom to top.

    +

    To account for differing resolutions, the position coordinates are the percentage +of the screen, ranging in value from 0 to 1.

    +

    The name field is not yet used, but should contain a description of what the +HUD element represents. The direction field is the direction in which something +is drawn.

    +

    0 draws from left to right, 1 draws from right to left, 2 draws from +top to bottom, and 3 draws from bottom to top.

    The alignment field specifies how the item will be aligned. It ranges from -1 to 1, with 0 being the center, -1 is moved to the left/up, and 1 is to the right/down. Fractional values can be used.

    @@ -982,7 +997,8 @@ the offset is not scaled to screen size. This allows for some precisely-position 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.

    +

    Note: Future revisions to the HUD API may be incompatible; the HUD API is still +in the experimental stages.

    image

    Displays an image on the HUD.

    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 +

    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.

    +

    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}
     
    @@ -1177,8 +1196,8 @@ effective towards.

    dropped as an item. If the node is wallmounted the wallmounted direction is checked.
  • soil: saplings will grow on nodes in this group
  • -
  • connect_to_raillike: makes nodes of raillike drawtype connect to - other group members with same drawtype
  • +
  • connect_to_raillike: makes nodes of raillike drawtype with same group value + connect to each other
  • Known damage and digging time defining groups