aboutsummaryrefslogtreecommitdiff
path: root/doc/lua_api.txt
diff options
context:
space:
mode:
Diffstat (limited to 'doc/lua_api.txt')
-rw-r--r--doc/lua_api.txt866
1 files changed, 645 insertions, 221 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index 4427e26d8..ca6f1585f 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -1,4 +1,4 @@
-Minetest Lua Modding API Reference 0.4.15
+Minetest Lua Modding API Reference 0.4.17
=========================================
* More information at <http://www.minetest.net/>
* Developer Wiki: <http://dev.minetest.net/>
@@ -172,8 +172,8 @@ The main Lua script. Running this script should register everything it
wants to register. Subsequent execution depends on minetest calling the
registered callbacks.
-`minetest.setting_get(name)` and `minetest.setting_getbool(name)` can be used
-to read custom or existing settings at load time, if necessary.
+`minetest.settings` can be used to read custom or existing settings at load
+time, if necessary. (See `Settings`)
### `models`
Models for entities or meshnodes.
@@ -186,7 +186,11 @@ Naming convention for registered textual names
----------------------------------------------
Registered names should generally be in this format:
- "modname:<whatever>" (<whatever> can have characters a-zA-Z0-9_)
+ `modname:<whatever>`
+
+`<whatever>` can have these characters:
+
+ a-zA-Z0-9_
This is to prevent conflicting names from corrupting maps and is
enforced by the mod loader.
@@ -207,9 +211,10 @@ when registering it.
The `:` prefix can also be used for maintaining backwards compatibility.
-### Aliases
+Aliases
+-------
Aliases can be added by using `minetest.register_alias(name, convert_to)` or
-`minetest.register_alias_force(name, convert_to).
+`minetest.register_alias_force(name, convert_to)`.
This will make Minetest to convert things called name to things called
`convert_to`.
@@ -228,6 +233,75 @@ you have an item called `epiclylongmodname:stuff`, you could do
and be able to use `/giveme stuff`.
+Mapgen aliases
+--------------
+In a game, a certain number of these must be set to tell core mapgens which
+of the game's nodes are to be used by the core mapgens. For example:
+
+ minetest.register_alias("mapgen_stone", "default:stone")
+
+### Aliases needed for all mapgens except Mapgen v6
+
+Base terrain:
+
+"mapgen_stone"
+"mapgen_water_source"
+"mapgen_river_water_source"
+
+Caves:
+
+"mapgen_lava_source"
+
+Dungeons:
+
+Only needed for registered biomes where 'node_stone' is stone:
+"mapgen_cobble"
+"mapgen_stair_cobble"
+"mapgen_mossycobble"
+Only needed for registered biomes where 'node_stone' is desert stone:
+"mapgen_desert_stone"
+"mapgen_stair_desert_stone"
+Only needed for registered biomes where 'node_stone' is sandstone:
+"mapgen_sandstone"
+"mapgen_sandstonebrick"
+"mapgen_stair_sandstone_block"
+
+### Aliases needed for Mapgen v6
+
+Terrain and biomes:
+
+"mapgen_stone"
+"mapgen_water_source"
+"mapgen_lava_source"
+"mapgen_dirt"
+"mapgen_dirt_with_grass"
+"mapgen_sand"
+"mapgen_gravel"
+"mapgen_desert_stone"
+"mapgen_desert_sand"
+"mapgen_dirt_with_snow"
+"mapgen_snowblock"
+"mapgen_snow"
+"mapgen_ice"
+
+Flora:
+
+"mapgen_tree"
+"mapgen_leaves"
+"mapgen_apple"
+"mapgen_jungletree"
+"mapgen_jungleleaves"
+"mapgen_junglegrass"
+"mapgen_pine_tree"
+"mapgen_pine_needles"
+
+Dungeons:
+
+"mapgen_cobble"
+"mapgen_stair_cobble"
+"mapgen_mossycobble"
+"mapgen_stair_desert_stone"
+
Textures
--------
Mods should generally prefix their textures with `modname_`, e.g. given
@@ -309,10 +383,10 @@ Example:
default_sandstone.png^[resize:16x16
#### `[opacity:<r>`
- Makes the base image transparent according to the given ratio.
- r must be between 0 and 255.
- 0 means totally transparent.
- 255 means totally opaque.
+Makes the base image transparent according to the given ratio.
+
+`r` must be between 0 and 255.
+0 means totally transparent. 255 means totally opaque.
Example:
@@ -426,6 +500,184 @@ Result is more like what you'd expect if you put a color on top of another
color. Meaning white surfaces get a lot of your new color while black parts don't
change very much.
+Hardware coloring
+-----------------
+The goal of hardware coloring is to simplify the creation of
+colorful nodes. If your textures use the same pattern, and they only
+differ in their color (like colored wool blocks), you can use hardware
+coloring instead of creating and managing many texture files.
+All of these methods use color multiplication (so a white-black texture
+with red coloring will result in red-black color).
+
+### Static coloring
+This method is useful if you wish to create nodes/items with
+the same texture, in different colors, each in a new node/item definition.
+
+#### Global color
+When you register an item or node, set its `color` field (which accepts a
+`ColorSpec`) to the desired color.
+
+An `ItemStack`s static color can be overwritten by the `color` metadata
+field. If you set that field to a `ColorString`, that color will be used.
+
+#### Tile color
+Each tile may have an individual static color, which overwrites every
+other coloring methods. To disable the coloring of a face,
+set its color to white (because multiplying with white does nothing).
+You can set the `color` property of the tiles in the node's definition
+if the tile is in table format.
+
+### Palettes
+For nodes and items which can have many colors, a palette is more
+suitable. A palette is a texture, which can contain up to 256 pixels.
+Each pixel is one possible color for the node/item.
+You can register one node/item, which can have up to 256 colors.
+
+#### Palette indexing
+When using palettes, you always provide a pixel index for the given
+node or `ItemStack`. The palette is read from left to right and from
+top to bottom. If the palette has less than 256 pixels, then it is
+stretched to contain exactly 256 pixels (after arranging the pixels
+to one line). The indexing starts from 0.
+
+Examples:
+* 16x16 palette, index = 0: the top left corner
+* 16x16 palette, index = 4: the fifth pixel in the first row
+* 16x16 palette, index = 16: the pixel below the top left corner
+* 16x16 palette, index = 255: the bottom right corner
+* 2 (width)x4 (height) palette, index=31: the top left corner.
+ The palette has 8 pixels, so each pixel is stretched to 32 pixels,
+ to ensure the total 256 pixels.
+* 2x4 palette, index=32: the top right corner
+* 2x4 palette, index=63: the top right corner
+* 2x4 palette, index=64: the pixel below the top left corner
+
+#### Using palettes with items
+When registering an item, set the item definition's `palette` field to
+a texture. You can also use texture modifiers.
+
+The `ItemStack`'s color depends on the `palette_index` field of the
+stack's metadata. `palette_index` is an integer, which specifies the
+index of the pixel to use.
+
+#### Linking palettes with nodes
+When registering a node, set the item definition's `palette` field to
+a texture. You can also use texture modifiers.
+The node's color depends on its `param2`, so you also must set an
+appropriate `drawtype`:
+* `drawtype = "color"` for nodes which use their full `param2` for
+ palette indexing. These nodes can have 256 different colors.
+ The palette should contain 256 pixels.
+* `drawtype = "colorwallmounted"` for nodes which use the first
+ five bits (most significant) of `param2` for palette indexing.
+ The remaining three bits are describing rotation, as in `wallmounted`
+ draw type. Division by 8 yields the palette index (without stretching the
+ palette). These nodes can have 32 different colors, and the palette
+ should contain 32 pixels.
+ Examples:
+ * `param2 = 17` is 2 * 8 + 1, so the rotation is 1 and the third (= 2 + 1)
+ pixel will be picked from the palette.
+ * `param2 = 35` is 4 * 8 + 3, so the rotation is 3 and the fifth (= 4 + 1)
+ pixel will be picked from the palette.
+* `drawtype = "colorfacedir"` for nodes which use the first
+ three bits of `param2` for palette indexing. The remaining
+ five bits are describing rotation, as in `facedir` draw type.
+ Division by 32 yields the palette index (without stretching the
+ palette). These nodes can have 8 different colors, and the
+ palette should contain 8 pixels.
+ Examples:
+ * `param2 = 17` is 0 * 32 + 17, so the rotation is 17 and the
+ first (= 0 + 1) pixel will be picked from the palette.
+ * `param2 = 35` is 1 * 32 + 3, so the rotation is 3 and the
+ second (= 1 + 1) pixel will be picked from the palette.
+
+To colorize a node on the map, set its `param2` value (according
+to the node's draw type).
+
+### Conversion between nodes in the inventory and the on the map
+Static coloring is the same for both cases, there is no need
+for conversion.
+
+If the `ItemStack`'s metadata contains the `color` field, it will be
+lost on placement, because nodes on the map can only use palettes.
+
+If the `ItemStack`'s metadata contains the `palette_index` field, it is
+automatically transferred between node and item forms by the engine,
+when a player digs or places a colored node.
+You can disable this feature by setting the `drop` field of the node
+to itself (without metadata).
+To transfer the color to a special drop, you need a drop table.
+Example:
+
+ minetest.register_node("mod:stone", {
+ description = "Stone",
+ tiles = {"default_stone.png"},
+ paramtype2 = "color",
+ palette = "palette.png",
+ drop = {
+ items = {
+ -- assume that mod:cobblestone also has the same palette
+ {items = {"mod:cobblestone"}, inherit_color = true },
+ }
+ }
+ })
+
+### Colored items in craft recipes
+Craft recipes only support item strings, but fortunately item strings
+can also contain metadata. Example craft recipe registration:
+
+ local stack = ItemStack("wool:block")
+ dyed:get_meta():set_int("palette_index", 3) -- add index
+ minetest.register_craft({
+ output = dyed:to_string(), -- convert to string
+ type = "shapeless",
+ recipe = {
+ "wool:block",
+ "dye:red",
+ },
+ })
+
+Metadata field filtering in the `recipe` field are not supported yet,
+so the craft output is independent of the color of the ingredients.
+
+Soft texture overlay
+--------------------
+Sometimes hardware coloring is not enough, because it affects the
+whole tile. Soft texture overlays were added to Minetest to allow
+the dynamic coloring of only specific parts of the node's texture.
+For example a grass block may have colored grass, while keeping the
+dirt brown.
+
+These overlays are 'soft', because unlike texture modifiers, the layers
+are not merged in the memory, but they are simply drawn on top of each
+other. This allows different hardware coloring, but also means that
+tiles with overlays are drawn slower. Using too much overlays might
+cause FPS loss.
+
+To define an overlay, simply set the `overlay_tiles` field of the node
+definition. These tiles are defined in the same way as plain tiles:
+they can have a texture name, color etc.
+To skip one face, set that overlay tile to an empty string.
+
+Example (colored grass block):
+
+ minetest.register_node("default:dirt_with_grass", {
+ description = "Dirt with Grass",
+ -- Regular tiles, as usual
+ -- The dirt tile disables palette coloring
+ tiles = {{name = "default_grass.png"},
+ {name = "default_dirt.png", color = "white"}},
+ -- Overlay tiles: define them in the same style
+ -- The top and bottom tile does not have overlay
+ overlay_tiles = {"", "",
+ {name = "default_grass_side.png", tileable_vertical = false}},
+ -- Global color, used in inventory
+ color = "green",
+ -- Palette in the world
+ paramtype2 = "color",
+ palette = "default_foilage.png",
+ })
+
Sounds
------
Only Ogg Vorbis files are supported.
@@ -456,11 +708,13 @@ Examples of sound parameter tables:
-- Play locationless on all clients
{
gain = 1.0, -- default
+ fade = 0.0, -- default, change to a value > 0 to fade the sound in
}
-- Play locationless to one player
{
to_player = name,
gain = 1.0, -- default
+ fade = 0.0, -- default, change to a value > 0 to fade the sound in
}
-- Play locationless to one player, looped
{
@@ -513,7 +767,7 @@ the global `minetest.registered_*` tables.
* `minetest.unregister_item(name)`
* Unregisters the item name from engine, and deletes the entry with key
* `name` from `minetest.registered_items` and from the associated item
- * table according to its nature: minetest.registered_nodes[] etc
+ * table according to its nature: `minetest.registered_nodes[]` etc
* `minetest.register_biome(biome definition)`
* returns an integer uniquely identifying the registered biome
@@ -591,9 +845,9 @@ They are represented by a table:
{name="name", param1=num, param2=num}
-`param1` and `param2` are 8-bit integers. The engine uses them for certain
-automated functions. If you don't use these functions, you can use them to
-store arbitrary values.
+`param1` and `param2` are 8-bit integers ranging from 0 to 255. The engine uses
+them for certain automated functions. If you don't use these functions, you can
+use them to store arbitrary values.
The functions of `param1` and `param2` are determined by certain fields in the
node definition:
@@ -625,6 +879,11 @@ 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".
+ 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.
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
@@ -662,15 +921,6 @@ node definition:
^ Only valid for "glasslike_framed" or "glasslike_framed_optional" drawtypes.
param2 defines 64 levels of internal liquid.
Liquid texture is defined using `special_tiles = {"modname_tilename.png"},`
- collision_box = {
- type = "fixed",
- fixed = {
- {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
- },
- },
- ^ defines list of collision boxes for the node. If empty, collision boxes
- will be the same as nodeboxes, in case of any other nodes will be full cube
- as in the example above.
Nodes can also contain extra data. See "Node Metadata".
@@ -821,6 +1071,7 @@ If no flags are specified (or defaults is), 2D noise is eased and 3D noise is no
Accumulates the absolute value of each noise gradient result.
Noise parameters format example for 2D or 3D perlin noise or perlin noise maps:
+
np_terrain = {
offset = 0,
scale = 1,
@@ -831,8 +1082,8 @@ Noise parameters format example for 2D or 3D perlin noise or perlin noise maps:
lacunarity = 2.0,
flags = "defaults, absvalue"
}
- ^ A single noise parameter table can be used to get 2D or 3D noise,
- when getting 2D noise spread.z is ignored.
+ ^ A single noise parameter table can be used to get 2D or 3D noise,
+ when getting 2D noise spread.z is ignored.
Ore types
@@ -904,14 +1155,15 @@ to small changes. The following is a decent set of parameters to work from:
},
noise_threshold = 1.6
-WARNING: Use this ore type *very* sparingly since it is ~200x more
+**WARNING**: Use this ore type *very* sparingly since it is ~200x more
computationally expensive than any other ore.
Ore attributes
--------------
See section "Flag Specifier Format".
-Currently supported flags: `absheight`
+Currently supported flags:
+`absheight`, `puff_cliffs`, `puff_additive_composition`.
### `absheight`
Also produce this same ore between the height range of `-y_max` and `-y_min`.
@@ -967,6 +1219,7 @@ in the form of a table. This table specifies the following fields:
previous contents (default: false)
About probability values:
+
* A probability value of `0` or `1` means that node will never appear (0% chance).
* A probability value of `254` or `255` means the node will always appear (100% chance).
* If the probability value `p` is greater than `1`, then there is a
@@ -1121,16 +1374,32 @@ There are three kinds of items: nodes, tools and craftitems.
things according to `tool_capabilities`.
* Craftitem (`register_craftitem`): A miscellaneous item.
+### Amount and wear
+All item stacks have an amount between 0 to 65535. It is 1 by
+default. Tool item stacks can not have an amount greater than 1.
+
+Tools use a wear (=damage) value ranging from 0 to 65535. The
+value 0 is the default and used is for unworn tools. The values
+1 to 65535 are used for worn tools, where a higher value stands for
+a higher wear. Non-tools always have a wear value of 0.
+
### Item formats
Items and item stacks can exist in three formats: Serializes, table format
and `ItemStack`.
#### Serialized
-This is called "stackstring" or "itemstring":
+This is called "stackstring" or "itemstring". It is a simple string with
+1-3 components: the full item identifier, an optional amount and an optional
+wear value. Syntax:
+
+ <identifier> [<amount>[ <wear>]]
+
+Examples:
-* e.g. `'default:dirt 5'`
-* e.g. `'default:pick_wood 21323'`
-* e.g. `'default:apple'`
+* `'default:apple'`: 1 apple
+* `'default:dirt 5'`: 5 dirt
+* `'default:pick_stone'`: a new stone pickaxe
+* `'default:pick_wood 1 21323'`: a wooden pickaxe, ca. 1/3 worn out
#### Table format
Examples:
@@ -1224,16 +1493,18 @@ Another example: Make red wool from white wool and red dye:
### Special groups
* `immortal`: Disables the group damage system for an entity
+* `punch_operable`: For entities; disables the regular damage mechanism for
+ players punching it by hand or a non-tool item, so that it can do something
+ else than take damage.
* `level`: Can be used to give an additional sense of progression in the game.
* A larger level will cause e.g. a weapon of a lower level make much less
damage, and get worn out much faster, or not be able to get drops
from destroyed nodes.
* `0` is something that is directly accessible at the start of gameplay
* There is no upper limit
-* `dig_immediate`: (player can always pick up node without tool wear)
- * `2`: node is removed without tool wear after 0.5 seconds or so
- (rail, sign)
- * `3`: node is removed without tool wear immediately (torch)
+* `dig_immediate`: (player can always pick up node without reducing tool wear)
+ * `2`: the node always gets the digging time 0.5 seconds (rail, sign)
+ * `3`: the node always gets the digging time 0 seconds (torch)
* `disable_jump`: Player (and possibly other things) cannot jump from node
* `fall_damage_add_percent`: damage speed = `speed * (1 + value/100)`
* `bouncy`: value is bounce speed in percent
@@ -1263,6 +1534,7 @@ Another example: Make red wool from white wool and red dye:
### Examples of custom groups
Item groups are often used for defining, well, _groups of items_.
+
* `meat`: any meat-kind of a thing (rating might define the size or healing
ability or be irrelevant -- it is not defined as of yet)
* `eatable`: anything that can be eaten. Rating might define HP gain in half
@@ -1334,6 +1606,10 @@ result in the tool to be able to dig nodes that have a rating of `2` or `3`
for this group, and unable to dig the rating `1`, which is the toughest.
Unless there is a matching group that enables digging otherwise.
+If the result digging time is 0, a delay of 0.15 seconds is added between
+digging nodes; If the player releases LMB after digging, this delay is set to 0,
+i.e. players can more quickly click the nodes away instead of holding LMB.
+
#### Damage groups
List of damage for groups of entities. See "Entity damage mechanism".
@@ -1479,7 +1755,7 @@ Item metadata only contains a key-value store.
Some of the values in the key-value store are handled specially:
-* `description`: Set the itemstack's description. Defaults to idef.description
+* `description`: Set the item stack's description. Defaults to `idef.description`
* `color`: A `ColorString`, which sets the stack's color.
* `palette_index`: If the item has a palette, this is used to get the
current color from the palette.
@@ -1541,7 +1817,7 @@ examples.
#### `container[<X>,<Y>]`
* Start of a container block, moves all physical elements in the container by (X, Y)
-* Must have matching container_end
+* Must have matching `container_end`
* Containers can be nested, in which case the offsets are added
(child containers are relative to parent containers)
@@ -1581,7 +1857,7 @@ examples.
* Sets default background color of tooltips
* Sets default font color of tooltips
-#### `tooltip[<gui_element_name>;<tooltip_text>;<bgcolor>,<fontcolor>]`
+#### `tooltip[<gui_element_name>;<tooltip_text>;<bgcolor>;<fontcolor>]`
* Adds tooltip for an element
* `<bgcolor>` tooltip background color as `ColorString` (optional)
* `<fontcolor>` tooltip font color as `ColorString` (optional)
@@ -1626,7 +1902,7 @@ examples.
#### `field[<X>,<Y>;<W>,<H>;<name>;<label>;<default>]`
* Textual field; will be sent to server when a button is clicked
-* When enter is pressed in field, fields.key_enter_field will be sent with the name
+* When enter is pressed in field, `fields.key_enter_field` will be sent with the name
of this field.
* `x` and `y` position the field relative to the top left of the menu
* `w` and `h` are the size of the field
@@ -1638,16 +1914,16 @@ examples.
* `default` may contain variable references such as `${text}'` which
will fill the value from the metadata value `text`
* **Note**: no extra text or more than a single variable is supported ATM.
-* See field_close_on_enter to stop enter closing the formspec
+* See `field_close_on_enter` to stop enter closing the formspec
#### `field[<name>;<label>;<default>]`
* As above, but without position/size units
-* When enter is pressed in field, fields.key_enter_field will be sent with the name
+* When enter is pressed in field, `fields.key_enter_field` will be sent with the name
of this field.
* Special field for creating simple forms, such as sign text input
* Must be used without a `size[]` element
* A "Proceed" button will be added automatically
-* See field_close_on_enter to stop enter closing the formspec
+* See `field_close_on_enter` to stop enter closing the formspec
#### `field_close_on_enter[<name>;<close_on_enter>]`
* <name> is the name of the field
@@ -1867,23 +2143,24 @@ Escape sequences
Most text can contain escape sequences, that can for example color the text.
There are a few exceptions: tab headers, dropdowns and vertical labels can't.
The following functions provide escape sequences:
-* `core.get_color_escape_sequence(color)`:
+
+* `minetest.get_color_escape_sequence(color)`:
* `color` is a ColorString
* The escape sequence sets the text color to `color`
-* `core.colorize(color, message)`:
+* `minetest.colorize(color, message)`:
* Equivalent to:
- `core.get_color_escape_sequence(color) ..
+ `minetest.get_color_escape_sequence(color) ..
message ..
- core.get_color_escape_sequence("#ffffff")`
-* `color.get_background_escape_sequence(color)`
+ minetest.get_color_escape_sequence("#ffffff")`
+* `minetest.get_background_escape_sequence(color)`
* `color` is a ColorString
* The escape sequence sets the background of the whole text element to
`color`. Only defined for item descriptions and tooltips.
-* `color.strip_foreground_colors(str)`
+* `minetest.strip_foreground_colors(str)`
* Removes foreground colors added by `get_color_escape_sequence`.
-* `color.strip_background_colors(str)`
+* `minetest.strip_background_colors(str)`
* Removes background colors added by `get_background_escape_sequence`.
-* `color.strip_colors(str)`
+* `minetest.strip_colors(str)`
* Removes all color escape sequences.
Spatial Vectors
@@ -1920,14 +2197,18 @@ Helper functions
* `math.sign(x, tolerance)`
* Get the sign of a number.
Optional: Also returns `0` when the absolute value is within the tolerance (default: `0`)
-* `string.split(str, separator=",", include_empty=false, max_splits=-1,
-* sep_is_pattern=false)`
+* `string.split(str, separator=",", include_empty=false, max_splits=-1, sep_is_pattern=false)`
* If `max_splits` is negative, do not limit splits.
* `sep_is_pattern` specifies if separator is a plain string or a pattern (regex).
* e.g. `string:split("a,b", ",") == {"a","b"}`
* `string:trim()`
* e.g. `string.trim("\n \t\tfoo bar\t ") == "foo bar"`
-* `minetest.pos_to_string({x=X,y=Y,z=Z}, decimal_places))`: returns `"(X,Y,Z)"`
+* `minetest.wrap_text(str, limit, [as_table])`: returns a string or table
+ * Adds newlines to the string to keep it within the specified character limit
+ Note that returned lines may be longer than the limit since it only splits at word borders.
+ * limit: Maximal amount of characters in one line
+ * as_table: optional, if true return table of lines instead of string
+* `minetest.pos_to_string({x=X,y=Y,z=Z}, decimal_places))`: returns string `"(X,Y,Z)"`
* Convert position to a printable string
Optional: 'decimal_places' will round the x, y and z of the pos to the given decimal place.
* `minetest.string_to_pos(string)`: returns a position
@@ -1959,51 +2240,51 @@ Helper functions
* Useful for storing custom data
* `minetest.is_singleplayer()`
* `minetest.features`: Table containing API feature flags
- {
- glasslike_framed = true,
- nodebox_as_selectionbox = true,
- chat_send_player_param3 = true,
- get_all_craft_recipes_works = true,
- use_texture_alpha = true,
- -- ^ The transparency channel of textures can be used optionally
- no_legacy_abms = true,
- -- ^ Tree and grass ABMs are no longer done from C++
- texture_names_parens = true,
- -- ^ Texture grouping is possible using parentheses
- area_store_custom_ids = true,
- -- ^ Unique Area ID for AreaStore:insert_area
- add_entity_with_staticdata = true,
- -- ^ add_entity supports passing initial staticdata to on_activate
- no_chat_message_prediction = true,
- -- ^ Chat messages are no longer predicted
- }
+
+ {
+ glasslike_framed = true,
+ nodebox_as_selectionbox = true,
+ chat_send_player_param3 = true,
+ get_all_craft_recipes_works = true,
+ use_texture_alpha = true,
+ -- ^ The transparency channel of textures can be used optionally
+ no_legacy_abms = true,
+ -- ^ Tree and grass ABMs are no longer done from C++
+ texture_names_parens = true,
+ -- ^ Texture grouping is possible using parentheses
+ area_store_custom_ids = true,
+ -- ^ Unique Area ID for AreaStore:insert_area
+ add_entity_with_staticdata = true,
+ -- ^ add_entity supports passing initial staticdata to on_activate
+ no_chat_message_prediction = true,
+ -- ^ Chat messages are no longer predicted
+ }
* `minetest.has_feature(arg)`: returns `boolean, missing_features`
* `arg`: string or table in format `{foo=true, bar=true}`
* `missing_features`: `{foo=true, bar=true}`
* `minetest.get_player_information(player_name)`:
- * Returns a table containing information about a player
- Example return value:
- {
- address = "127.0.0.1", -- IP address of client
- ip_version = 4, -- IPv4 / IPv6
- min_rtt = 0.01, -- minimum round trip time
- max_rtt = 0.2, -- maximum round trip time
- avg_rtt = 0.02, -- average round trip time
- min_jitter = 0.01, -- minimum packet time jitter
- max_jitter = 0.5, -- maximum packet time jitter
- avg_jitter = 0.03, -- average packet time jitter
- connection_uptime = 200, -- seconds since client connected
-
- -- following information is available on debug build only!!!
- -- DO NOT USE IN MODS
- --ser_vers = 26, -- serialization version used by client
- --prot_vers = 23, -- protocol version used by client
- --major = 0, -- major version number
- --minor = 4, -- minor version number
- --patch = 10, -- patch version number
- --vers_string = "0.4.9-git", -- full version string
- --state = "Active" -- current client state
- }
+ * Returns a table containing information about a player. Example return value:
+
+ {
+ address = "127.0.0.1", -- IP address of client
+ ip_version = 4, -- IPv4 / IPv6
+ min_rtt = 0.01, -- minimum round trip time
+ max_rtt = 0.2, -- maximum round trip time
+ avg_rtt = 0.02, -- average round trip time
+ min_jitter = 0.01, -- minimum packet time jitter
+ max_jitter = 0.5, -- maximum packet time jitter
+ avg_jitter = 0.03, -- average packet time jitter
+ connection_uptime = 200, -- seconds since client connected
+ protocol_version = 32, -- protocol version used by client
+ -- following information is available on debug build only!!!
+ -- DO NOT USE IN MODS
+ --ser_vers = 26, -- serialization version used by client
+ --major = 0, -- major version number
+ --minor = 4, -- minor version number
+ --patch = 10, -- patch version number
+ --vers_string = "0.4.9-git", -- full version string
+ --state = "Active" -- current client state
+ }
* `minetest.mkdir(path)`: returns success.
* Creates a directory specified by `path`, creating parent directories
if they don't exist.
@@ -2012,6 +2293,10 @@ Helper functions
* nil: return all entries,
* true: return only subdirectory names, or
* false: return only file names.
+* `minetest.safe_file_write(path, content)`: returns boolean indicating success
+ * Replaces contents of file at path with new contents in a safe (atomic) way.
+ Use this instead of below code when writing e.g. database files:
+ `local f = io.open(path, "wb"); f:write(content); f:close()`
* `minetest.get_version()`: returns a table containing components of the
engine version. Components:
* `project`: Name of the project, eg, "Minetest"
@@ -2022,7 +2307,10 @@ Helper functions
reliable or verifyable. Compatible forks will have a different name and
version entirely. To check for the presence of engine features, test
whether the functions exported by the wanted features exist. For example:
- `if core.nodeupdate then ... end`.
+ `if minetest.nodeupdate then ... end`.
+* `minetest.sha1(data, [raw])`: returns the sha1 hash of data
+ * `data`: string of data to hash
+ * `raw`: return raw bytes instead of hex digits, default: false
### Logging
* `minetest.debug(...)`
@@ -2042,6 +2330,8 @@ Call these functions only at load time!
* `minetest.register_craftitem(name, item definition)`
* `minetest.unregister_item(name)`
* `minetest.register_alias(name, convert_to)`
+ * Also use this to set the 'mapgen aliases' needed in a game for the core
+ * mapgens. See 'Mapgen aliases' section above.
* `minetest.register_alias_force(name, convert_to)`
* `minetest.register_craft(recipe)`
* Check recipe table syntax for different types below.
@@ -2050,7 +2340,7 @@ Call these functions only at load time!
* Specify either output or input only. If you specify both, input will be ignored. For input use the same recipe table
syntax as for `minetest.register_craft(recipe)`. For output specify only the item, without a quantity.
* If no erase candidate could be found, Lua exception will be thrown.
- * Warning! The type field ("shaped","cooking" or any other) will be ignored if the recipe
+ * **Warning**! The type field ("shaped","cooking" or any other) will be ignored if the recipe
contains output. Erasing is then done independently from the crafting method.
* `minetest.register_ore(ore definition)`
* `minetest.register_biome(biome definition)`
@@ -2076,6 +2366,7 @@ Call these functions only at load time!
* `minetest.register_on_placenode(func(pos, newnode, placer, oldnode, itemstack, pointed_thing))`
* Called when a node has been placed
* If return `true` no item is taken from `itemstack`
+ * `placer` may be any valid ObjectRef or nil.
* **Not recommended**; use `on_construct` or `after_place_node` in node definition
whenever possible
* `minetest.register_on_dignode(func(pos, oldnode, digger))`
@@ -2105,7 +2396,7 @@ Call these functions only at load time!
* Called when the player gets damaged or healed
* `player`: ObjectRef of the player
* `hp_change`: the amount of change. Negative when it is damage.
- * `modifier`: when true, the function should return the actual hp_change.
+ * `modifier`: when true, the function should return the actual `hp_change`.
Note: modifiers only get a temporary hp_change that can be modified by later modifiers.
modifiers can return true as a second argument to stop the execution of further functions.
Non-modifiers receive the final hp change calculated by the modifiers.
@@ -2159,63 +2450,65 @@ Call these functions only at load time!
### Other registration functions
* `minetest.register_chatcommand(cmd, chatcommand definition)`
- * Adds definition to minetest.registered_chatcommands
+ * Adds definition to `minetest.registered_chatcommands`
* `minetest.override_chatcommand(name, redefinition)`
- * Overrides fields of a chatcommand registered with register_chatcommand.
+ * Overrides fields of a chatcommand registered with `register_chatcommand`.
* `minetest.unregister_chatcommand(name)`
- * Unregisters a chatcommands registered with register_chatcommand.
+ * Unregisters a chatcommands registered with `register_chatcommand`.
* `minetest.register_privilege(name, definition)`
* `definition`: `"description text"`
* `definition`: `{ description = "description text", give_to_singleplayer = boolean}`
the default of `give_to_singleplayer` is true
- * To allow players with basic_privs to grant, see basic_privs minetest.conf setting.
-* `minetest.register_authentication_handler(handler)`
- * See `minetest.builtin_auth_handler` in `builtin.lua` for reference
+ * To allow players with `basic_privs` to grant, see `basic_privs` minetest.conf setting.
+* `minetest.register_authentication_handler(authentication handler definition)`
+ * Registers an auth handler that overrides the builtin one
+ * This function can be called by a single mod once only.
### Setting-related
-* `minetest.setting_set(name, value)`
- * Setting names can't contain whitespace or any of `="{}#`.
- * Setting values can't contain the sequence `\n"""`.
- * Setting names starting with "secure." can't be set.
-* `minetest.setting_get(name)`: returns string or `nil`
-* `minetest.setting_setbool(name, value)`
- * See documentation on `setting_set` for restrictions.
-* `minetest.setting_getbool(name)`: returns boolean or `nil`
-* `minetest.setting_get_pos(name)`: returns position or nil
-* `minetest.setting_save()`, returns `nil`, save all settings to config file
+* `minetest.settings`: Settings object containing all of the settings from the
+ main config file (`minetest.conf`).
+* `minetest.setting_get_pos(name)`: Loads a setting from the main settings and
+ parses it as a position (in the format `(1,2,3)`). Returns a position or nil.
### Authentication
-* `minetest.notify_authentication_modified(name)`
- * Should be called by the authentication handler if privileges changes.
- * To report everybody, set `name=nil`.
-* `minetest.check_password_entry(name, entry, password)`
- * Returns true if the "db entry" for a player with name matches given
- * password, false otherwise.
- * The "db entry" is the usually player-individual value that is derived
- * from the player's chosen password and stored on the server in order to allow
- * authentication whenever the player desires to log in.
- * Only use this function for making it possible to log in via the password from
- * via protocols like IRC, other uses for inside the game are frowned upon.
-* `minetest.get_password_hash(name, raw_password)`
- * Convert a name-password pair to a password hash that Minetest can use.
- * The returned value alone is not a good basis for password checks based
- * on comparing the password hash in the database with the password hash
- * from the function, with an externally provided password, as the hash
- * in the db might use the new SRP verifier format.
- * For this purpose, use minetest.check_password_entry instead.
* `minetest.string_to_privs(str)`: returns `{priv1=true,...}`
* `minetest.privs_to_string(privs)`: returns `"priv1,priv2,..."`
* Convert between two privilege representations
-* `minetest.set_player_password(name, password_hash)`
-* `minetest.set_player_privs(name, {priv1=true,...})`
* `minetest.get_player_privs(name) -> {priv1=true,...}`
-* `minetest.auth_reload()`
* `minetest.check_player_privs(player_or_name, ...)`: returns `bool, missing_privs`
* A quickhand for checking privileges.
- * `player_or_name`: Either a Player object or the name of a player.
- * `...` is either a list of strings, e.g. `"priva", "privb"` or
- a table, e.g. `{ priva = true, privb = true }`.
-* `minetest.get_player_ip(name)`: returns an IP address string
+ * `player_or_name`: Either a Player object or the name of a player.
+ * `...` is either a list of strings, e.g. `"priva", "privb"` or
+ a table, e.g. `{ priva = true, privb = true }`.
+
+* `minetest.check_password_entry(name, entry, password)`
+ * Returns true if the "password entry" for a player with name matches given
+ password, false otherwise.
+ * The "password entry" is the password representation generated by the engine
+ as returned as part of a `get_auth()` call on the auth handler.
+ * Only use this function for making it possible to log in via password from
+ external protocols such as IRC, other uses are frowned upon.
+* `minetest.get_password_hash(name, raw_password)`
+ * Convert a name-password pair to a password hash that Minetest can use.
+ * The returned value alone is not a good basis for password checks based
+ on comparing the password hash in the database with the password hash
+ from the function, with an externally provided password, as the hash
+ in the db might use the new SRP verifier format.
+ * For this purpose, use `minetest.check_password_entry` instead.
+* `minetest.get_player_ip(name)`: returns an IP address string for the player `name`
+ * The player needs to be online for this to be successful.
+
+* `minetest.get_auth_handler()`: Return the currently active auth handler
+ * See the `Authentication handler definition`
+ * Use this to e.g. get the authentication data for a player:
+ `local auth_data = minetest.get_auth_handler().get_auth(playername)`
+* `minetest.notify_authentication_modified(name)`
+ * Must be called by the authentication handler for privilege changes.
+ * `name`: string; if omitted, all auth data should be considered modified
+* `minetest.set_player_password(name, password_hash)`: Set password hash of player `name`
+* `minetest.set_player_privs(name, {priv1=true,...})`: Set privileges of player `name`
+* `minetest.auth_reload()`
+ * See `reload()` in authentication handler definition
`minetest.set_player_password`, `minetest_set_player_privs`, `minetest_get_player_privs`
and `minetest.auth_reload` call the authetification handler.
@@ -2276,15 +2569,20 @@ and `minetest.auth_reload` call the authetification handler.
* `minetest.get_gametime()`: returns the time, in seconds, since the world was created
* `minetest.get_day_count()`: returns number days elapsed since world was created,
* accounting for time changes.
-* `minetest.find_node_near(pos, radius, nodenames)`: returns pos or `nil`
+* `minetest.find_node_near(pos, radius, nodenames, [search_center])`: returns pos or `nil`
* `radius`: using a maximum metric
* `nodenames`: e.g. `{"ignore", "group:tree"}` or `"default:dirt"`
-* `minetest.find_nodes_in_area(minp, maxp, nodenames)`: returns a list of positions
- * returns as second value a table with the count of the individual nodes found
+ * `search_center` is an optional boolean (default: `false`)
+ If true `pos` is also checked for the nodes
+* `minetest.find_nodes_in_area(pos1, pos2, nodenames)`: returns a list of positions
* `nodenames`: e.g. `{"ignore", "group:tree"}` or `"default:dirt"`
-* `minetest.find_nodes_in_area_under_air(minp, maxp, nodenames)`: returns a list of positions
- * returned positions are nodes with a node air above
+ * First return value: Table with all node positions
+ * Second return value: Table with the count of each node with the node name as index
+ * Area volume is limited to 4,096,000 nodes
+* `minetest.find_nodes_in_area_under_air(pos1, pos2, nodenames)`: returns a list of positions
* `nodenames`: e.g. `{"ignore", "group:tree"}` or `"default:dirt"`
+ * Return value: Table with all node positions with a node air above
+ * Area volume is limited to 4,096,000 nodes
* `minetest.get_perlin(noiseparams)`
* `minetest.get_perlin(seeddiff, octaves, persistence, scale)`
* Return world-specific perlin noise (`int(worldseed)+seeddiff`)
@@ -2296,7 +2594,7 @@ and `minetest.auth_reload` call the authetification handler.
* `flags` is a flag field with the available flags: `dungeon`, `temple`, `cave_begin`,
`cave_end`, `large_cave_begin`, `large_cave_end`, `decoration`
* The second parameter is a list of IDS of decorations which notification is requested for
-* `get_gen_notify()`: returns a flagstring and a table with the deco_ids
+* `get_gen_notify()`: returns a flagstring and a table with the `deco_id`s
* `minetest.get_mapgen_object(objectname)`
* Return requested mapgen object if available (see "Mapgen objects")
* `minetest.get_biome_id(biome_name)`
@@ -2304,9 +2602,9 @@ and `minetest.auth_reload` call the authetification handler.
given biome_name string.
* `minetest.get_mapgen_params()` Returns mapgen parameters, a table containing
`mgname`, `seed`, `chunksize`, `water_level`, and `flags`.
- * Deprecated: use minetest.get_mapgen_setting(name) instead
+ * Deprecated: use `minetest.get_mapgen_setting(name)` instead
* `minetest.set_mapgen_params(MapgenParams)`
- * Deprecated: use minetest.set_mapgen_setting(name, value, override) instead
+ * Deprecated: use `minetest.set_mapgen_setting(name, value, override)` instead
* Set map generation parameters
* Function cannot be called after the registration period; only initialization
and `on_mapgen_init`
@@ -2331,7 +2629,7 @@ and `minetest.auth_reload` call the authetification handler.
is not already present in map_meta.txt.
* `override_meta` is an optional boolean (default: `false`). If this is set to true,
the setting will become the active setting regardless of the map metafile contents.
- * Note: to set the seed, use "seed", not "fixed_map_seed"
+ * Note: to set the seed, use `"seed"`, not `"fixed_map_seed"`
* `minetest.set_mapgen_setting_noiseparams(name, value, [override_meta])`
* Same as above, except value is a NoiseParams table.
* `minetest.set_noiseparams(name, noiseparams, set_default)`
@@ -2359,8 +2657,8 @@ and `minetest.auth_reload` call the authetification handler.
* `function EmergeAreaCallback(blockpos, action, calls_remaining, param)`
* - `blockpos` is the *block* coordinates of the block that had been emerged
* - `action` could be one of the following constant values:
- * `core.EMERGE_CANCELLED`, `core.EMERGE_ERRORED`, `core.EMERGE_FROM_MEMORY`,
- * `core.EMERGE_FROM_DISK`, `core.EMERGE_GENERATED`
+ * `minetest.EMERGE_CANCELLED`, `minetest.EMERGE_ERRORED`, `minetest.EMERGE_FROM_MEMORY`,
+ * `minetest.EMERGE_FROM_DISK`, `minetest.EMERGE_GENERATED`
* - `calls_remaining` is the number of callbacks to be expected after this one
* - `param` is the user-defined parameter passed to emerge_area (or nil if the
* parameter was absent)
@@ -2384,8 +2682,6 @@ and `minetest.auth_reload` call the authetification handler.
* `algorithm`: One of `"A*_noprefetch"` (default), `"A*"`, `"Dijkstra"`
* `minetest.spawn_tree (pos, {treedef})`
* spawns L-system tree at given `pos` with definition in `treedef` table
- * Warning: L-system generation currently creates lighting bugs in the form of mapblock-sized shadows.
- Often these bugs appear as subtle shadows in water.
* `minetest.transforming_liquid_add(pos)`
* add node to liquid update queue
* `minetest.get_node_max_level(pos)`
@@ -2399,11 +2695,27 @@ and `minetest.auth_reload` call the authetification handler.
* increase level of leveled node by level, default `level` equals `1`
* if `totallevel > maxlevel`, returns rest (`total-max`)
* can be negative for decreasing
-* `core.check_single_for_falling(pos)`
+* `minetest.fix_light(pos1, pos2)`: returns `true`/`false`
+ * resets the light in a cuboid-shaped part of
+ the map and removes lighting bugs.
+ * Loads the area if it is not loaded.
+ * `pos1` is the corner of the cuboid with the least coordinates
+ (in node coordinates), inclusive.
+ * `pos2` is the opposite corner of the cuboid, inclusive.
+ * The actual updated cuboid might be larger than the specified one,
+ because only whole map blocks can be updated.
+ The actual updated area consists of those map blocks that intersect
+ with the given cuboid.
+ * However, the neighborhood of the updated area might change
+ as well, as light can spread out of the cuboid, also light
+ might be removed.
+ * returns `false` if the area is not fully generated,
+ `true` otherwise
+* `minetest.check_single_for_falling(pos)`
* causes an unsupported `group:falling_node` node to fall and causes an
unattached `group:attached_node` node to fall.
* does not spread these updates to neighbours.
-* `core.check_for_falling(pos)`
+* `minetest.check_for_falling(pos)`
* causes an unsupported `group:falling_node` node to fall and causes an
unattached `group:attached_node` node to fall.
* spread these updates to neighbours and can cause a cascade
@@ -2418,7 +2730,7 @@ and `minetest.auth_reload` call the authetification handler.
* `{type="detached", name="creative"}`
* `minetest.create_detached_inventory(name, callbacks, [player_name])`: returns an `InvRef`
* callbacks: See "Detached inventory callbacks"
- * player_name: Make detached inventory available to one player exclusively,
+ * `player_name`: Make detached inventory available to one player exclusively,
by default they will be sent to every player (even if not used).
Note that this parameter is mostly just a workaround and will be removed in future releases.
* Creates a detached inventory. If it already exists, it is cleared.
@@ -2434,11 +2746,11 @@ and `minetest.auth_reload` call the authetification handler.
* `formspec`: formspec to display
* `minetest.close_formspec(playername, formname)`
* `playername`: name of player to close formspec
- * `formname`: has to exactly match the one given in show_formspec, or the formspec will
+ * `formname`: has to exactly match the one given in `show_formspec`, or the formspec will
not close.
- * calling show_formspec(playername, formname, "") is equal to this expression
+ * calling `show_formspec(playername, formname, "")` is equal to this expression
* to close a formspec regardless of the formname, call
- minetest.close_formspec(playername, ""). USE THIS ONLY WHEN ABSOLUTELY NECESSARY!
+ `minetest.close_formspec(playername, "")`. **USE THIS ONLY WHEN ABSOLUTELY NECESSARY!**
* `minetest.formspec_escape(string)`: returns a string
* escapes the characters "[", "]", "\", "," and ";", which can not be used in formspecs
* `minetest.explode_table_event(string)`: returns a table
@@ -2479,6 +2791,13 @@ and `minetest.auth_reload` call the authetification handler.
* Convert a vector into a yaw (angle)
* `minetest.yaw_to_dir(yaw)`
* Convert yaw (angle) to a vector
+* `minetest.is_colored_paramtype(ptype)`
+ * Returns a boolean. Returns `true` if the given `paramtype2` contains color
+ information (`color`, `colorwallmounted` or `colorfacedir`).
+* `minetest.strip_param2_color(param2, paramtype2)`
+ * Removes everything but the color information from the
+ given `param2` value.
+ * Returns `nil` if the given `paramtype2` does not contain color information
* `minetest.get_node_drops(nodename, toolname)`
* Returns list of item names.
* **Note**: This will be removed or modified in a future version.
@@ -2504,6 +2823,7 @@ and `minetest.auth_reload` call the authetification handler.
* returns indexed table with all registered recipes for query item (node)
or `nil` if no recipe was found
* recipe entry table:
+
{
method = 'normal' or 'cooking' or 'fuel'
width = 0-3, 0 means shapeless recipe
@@ -2511,10 +2831,11 @@ and `minetest.auth_reload` call the authetification handler.
output = string with item name and quantity
}
* Example query for `"default:gold_ingot"` will return table:
+
{
- [1]={type = "cooking", width = 3, output = "default:gold_ingot",
+ [1]={method = "cooking", width = 3, output = "default:gold_ingot",
items = {1 = "default:gold_lump"}},
- [2]={type = "normal", width = 1, output = "default:gold_ingot 9",
+ [2]={method = "normal", width = 1, output = "default:gold_ingot 9",
items = {1 = "default:goldblock"}}
}
* `minetest.handle_node_drops(pos, drops, digger)`
@@ -2536,9 +2857,11 @@ and `minetest.auth_reload` call the authetification handler.
### Defaults for the `on_*` item definition functions
These functions return the leftover itemstack.
-* `minetest.item_place_node(itemstack, placer, pointed_thing, param2)`
+* `minetest.item_place_node(itemstack, placer, pointed_thing[, param2, prevent_after_place])`
* Place item as a node
* `param2` overrides `facedir` and wallmounted `param2`
+ * `prevent_after_place`: if set to `true`, `after_place_node` is not called
+ for the newly placed node to prevent a callback and placement loop
* returns `itemstack, success`
* `minetest.item_place_object(itemstack, placer, pointed_thing)`
* Place item as-is
@@ -2569,6 +2892,11 @@ These functions return the leftover itemstack.
* `spec` is a `SimpleSoundSpec`
* `parameters` is a sound parameter table
* `minetest.sound_stop(handle)`
+* `minetest.sound_fade(handle, step, gain)`
+ * `handle` is a handle returned by `minetest.sound_play`
+ * `step` determines how fast a sound will fade.
+ Negative step will lower the sound volume, positive step will increase the sound volume
+ * `gain` the target gain for the fade.
### Timing
* `minetest.after(time, func, ...)`
@@ -2584,6 +2912,9 @@ These functions return the leftover itemstack.
* `minetest.cancel_shutdown_requests()`: cancel current delayed shutdown
* `minetest.get_server_status()`: returns server status string
* `minetest.get_server_uptime()`: returns the server uptime in seconds
+* `minetest.remove_player(name)`: remove player from database (if he is not connected).
+ * Does not remove player authentication data, minetest.player_exists will continue to return true.
+ * Returns a code (0: successful, 1: no such player, 2: player is connected)
### Bans
* `minetest.get_ban_list()`: returns the ban list (same as `minetest.get_ban_description("")`)
@@ -2608,7 +2939,7 @@ These functions return the leftover itemstack.
minsize, maxsize,
collisiondetection, texture, playername)`
-* `minetest.delete_particlespawner(id, player)``
+* `minetest.delete_particlespawner(id, player)`
* Delete `ParticleSpawner` with `id` (return value from `minetest.add_particlespawner`)
* If playername is specified, only deletes on the player's client,
* otherwise on all clients
@@ -2686,6 +3017,7 @@ These functions return the leftover itemstack.
### Misc.
* `minetest.get_connected_players()`: returns list of `ObjectRefs`
+* `minetest.is_player(o)`: boolean, whether `o` is a player
* `minetest.player_exists(name)`: boolean, whether player exists (regardless of online status)
* `minetest.hud_replace_builtin(name, hud_definition)`
* Replaces definition of a builtin hud element
@@ -2753,6 +3085,7 @@ These functions return the leftover itemstack.
* Returns true, if player `name` shouldn't be abled to dig at `pos` or do other
actions, defineable by mods, due to some mod-defined ownership-like concept.
Returns false or nil, if the player is allowed to do such actions.
+ * `name` will be "" for non-players or unknown players.
* This function should be overridden by protection mods and should be used to
check if a player can interact at a position.
* This function should call the old version of itself if the position is not
@@ -2769,25 +3102,29 @@ These functions return the leftover itemstack.
* `minetest.record_protection_violation(pos, name)`
* This function calls functions registered with
`minetest.register_on_protection_violation`.
-* `minetest.rotate_and_place(itemstack, placer, pointed_thing, infinitestacks, orient_flags)`
+* `minetest.rotate_and_place(itemstack, placer, pointed_thing[, infinitestacks,
+ orient_flags, prevent_after_place])`
* Attempt to predict the desired orientation of the facedir-capable node
- defined by `itemstack`, and place it accordingly (on-wall, on the floor, or
- hanging from the ceiling). Stacks are handled normally if the `infinitestacks`
- field is false or omitted (else, the itemstack is not changed). `orient_flags`
- is an optional table containing extra tweaks to the placement code:
- * `invert_wall`: if `true`, place wall-orientation on the ground and ground-
- orientation on the wall.
+ defined by `itemstack`, and place it accordingly (on-wall, on the floor,
+ or hanging from the ceiling).
+ * `infinitestacks`: if `true`, the itemstack is not changed. Otherwise the
+ stacks are handled normally.
+ * `orient_flags`: Optional table containing extra tweaks to the placement code:
+ * `invert_wall`: if `true`, place wall-orientation on the ground and
+ ground-orientation on the wall.
* `force_wall` : if `true`, always place the node in wall orientation.
* `force_ceiling`: if `true`, always place on the ceiling.
* `force_floor`: if `true`, always place the node on the floor.
- * `force_facedir`: if `true`, forcefully reset the facedir to north when placing on
- the floor or ceiling
- * The first four options are mutually-exclusive; the last in the list takes
- precedence over the first.
+ * `force_facedir`: if `true`, forcefully reset the facedir to north
+ when placing on the floor or ceiling.
+ * The first four options are mutually-exclusive; the last in the list
+ takes precedence over the first.
+ * `prevent_after_place` is directly passed to `minetest.item_place_node`
+ * Returns the new itemstack after placement
* `minetest.rotate_node(itemstack, placer, pointed_thing)`
- * calls `rotate_and_place()` with infinitestacks set according to the state of
- the creative mode setting, and checks for "sneak" to set the `invert_wall`
- parameter.
+ * calls `rotate_and_place()` with `infinitestacks` set according to the state
+ of the creative mode setting, checks for "sneak" to set the `invert_wall`
+ parameter and `prevent_after_place` set to `true`.
* `minetest.forceload_block(pos[, transient])`
* forceloads the position `pos`.
@@ -2872,6 +3209,10 @@ Can be obtained via `minetest.get_meta(pos)`.
#### Methods
* All methods in MetaDataRef
* `get_inventory()`: returns `InvRef`
+* `mark_as_private(name or {name1, name2, ...})`: Mark specific vars as private
+ This will prevent them from being sent to the client. Note that the "private"
+ status will only be remembered if an associated key-value pair exists, meaning
+ it's best to call this when initializing all other meta (e.g. `on_construct`).
### `ItemStackMetaRef`
ItemStack metadata: reference extra data and functionality stored in a stack.
@@ -2896,7 +3237,7 @@ Can be gotten via `minetest.get_node_timer(pos)`.
* set a timer's state
* `timeout` is in seconds, and supports fractional values (0.1 etc)
* `elapsed` is in seconds, and supports fractional values (0.1 etc)
- * will trigger the node's `on_timer` function after `timeout`-elapsed seconds
+ * will trigger the node's `on_timer` function after `(timeout - elapsed)` seconds
* `start(timeout)`
* start a timer
* equivalent to `set(timeout,0)`
@@ -2905,7 +3246,7 @@ Can be gotten via `minetest.get_node_timer(pos)`.
* `get_timeout()`: returns current timeout in seconds
* if `timeout` equals `0`, timer is inactive
* `get_elapsed()`: returns current elapsed time in seconds
- * the node's `on_timer` function will be called after `timeout`-elapsed seconds
+ * the node's `on_timer` function will be called after `(timeout - elapsed)` seconds
* `is_started()`: returns boolean state of timer
* returns `true` if timer is started, otherwise `false`
@@ -2916,7 +3257,7 @@ This is basically a reference to a C++ `ServerActiveObject`
#### Methods
* `remove()`: remove object (after returning from Lua)
- * Note: Doesn't work on players, use minetest.kick_player instead
+ * Note: Doesn't work on players, use `minetest.kick_player` instead
* `get_pos()`: returns `{x=num, y=num, z=num}`
* `set_pos(pos)`; `pos`=`{x=num, y=num, z=num}`
* `move_to(pos, continuous=false)`: interpolated move
@@ -2935,11 +3276,11 @@ This is basically a reference to a C++ `ServerActiveObject`
* `set_armor_groups({group1=rating, group2=rating, ...})`
* `get_armor_groups()`: returns a table with the armor group ratings
* `set_animation({x=1,y=1}, frame_speed=15, frame_blend=0, frame_loop=true)`
-* `get_animation()`: returns range, frame_speed, frame_blend and frame_loop
+* `get_animation()`: returns `range`, `frame_speed`, `frame_blend` and `frame_loop`
* `set_attach(parent, bone, position, rotation)`
* `bone`: string
* `position`: `{x=num, y=num, z=num}` (relative)
- * `rotation`: `{x=num, y=num, z=num}`
+ * `rotation`: `{x=num, y=num, z=num}` = Rotation on each axis, in degrees
* `get_attach()`: returns parent, bone, position, rotation or nil if it isn't attached
* `set_detach()`
* `set_bone_position(bone, position, rotation)`
@@ -2993,23 +3334,28 @@ This is basically a reference to a C++ `ServerActiveObject`
* radians - Angle from looking forward, where positive is downwards.
* `set_look_horizontal(radians)`: sets look yaw
* radians - Angle from the +z direction, where positive is counter-clockwise.
-* `get_look_pitch()`: pitch in radians - Deprecated as broken. Use get_look_vertical.
+* `get_look_pitch()`: pitch in radians - Deprecated as broken. Use `get_look_vertical`.
* Angle ranges between -pi/2 and pi/2, which are straight down and up respectively.
-* `get_look_yaw()`: yaw in radians - Deprecated as broken. Use get_look_horizontal.
+* `get_look_yaw()`: yaw in radians - Deprecated as broken. Use `get_look_horizontal`.
* Angle is counter-clockwise from the +x direction.
-* `set_look_pitch(radians)`: sets look pitch - Deprecated. Use set_look_vertical.
-* `set_look_yaw(radians)`: sets look yaw - Deprecated. Use set_look_horizontal.
+* `set_look_pitch(radians)`: sets look pitch - Deprecated. Use `set_look_vertical`.
+* `set_look_yaw(radians)`: sets look yaw - Deprecated. Use `set_look_horizontal`.
* `get_breath()`: returns players breath
* `set_breath(value)`: sets players breath
* values:
* `0`: player is drowning,
* `1`-`10`: remaining number of bubbles
* `11`: bubbles bar is not shown
-* `set_attribute(attribute, value)`: sets an extra attribute with value on player
-* `get_attribute(attribute)`: returns value for extra attribute. Returns nil if no attribute found.
+* `set_attribute(attribute, value)`:
+ * Sets an extra attribute with value on player.
+ * `value` must be a string, or a number which will be converted to a string.
+ * If `value` is `nil`, remove attribute from player.
+* `get_attribute(attribute)`:
+ * Returns value (a string) for extra attribute.
+ * Returns `nil` if no attribute found.
* `set_inventory_formspec(formspec)`
* Redefine player's inventory form
- * Should usually be called in on_joinplayer
+ * Should usually be called in `on_joinplayer`
* `get_inventory_formspec()`: returns a 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}`
@@ -3023,10 +3369,10 @@ This is basically a reference to a C++ `ServerActiveObject`
* `sneak`: whether player can sneak (default: `true`)
* `sneak_glitch`: whether player can use the new move code replications
of the old sneak side-effects: sneak ladders and 2 node sneak jump
- when next to a ledge 2 nodes up (default: `true`)
+ (default: `false`)
* `new_move`: use new move/sneak code. When `false` the exact old code
is used for the specific old sneak behaviour (default: `true`)
-* `get_physics_override()`: returns the table given to set_physics_override
+* `get_physics_override()`: returns the table given to `set_physics_override`
* `hud_add(hud definition)`: add a HUD element described by HUD def, returns ID
number on success
* `hud_remove(id)`: remove the HUD element of the specified id
@@ -3050,13 +3396,24 @@ This is basically a reference to a C++ `ServerActiveObject`
* `hud_set_hotbar_selected_image(texturename)`
* sets image for selected item of hotbar
* `hud_get_hotbar_selected_image`: returns texturename
-* `set_sky(bgcolor, type, {texture names})`
+* `set_sky(bgcolor, type, {texture names}, clouds)`
* `bgcolor`: ColorSpec, defaults to white
- * Available types:
+ * `type`: Available types:
* `"regular"`: Uses 0 textures, `bgcolor` ignored
* `"skybox"`: Uses 6 textures, `bgcolor` used
* `"plain"`: Uses 0 textures, `bgcolor` used
-* `get_sky()`: returns bgcolor, type and a table with the textures
+ * `clouds`: Boolean for whether clouds appear in front of `"skybox"` or
+ `"plain"` custom skyboxes (default: `true`)
+* `get_sky()`: returns bgcolor, type, table of textures, clouds
+* `set_clouds(parameters)`: set cloud parameters
+ * `parameters` is a table with the following optional fields:
+ * `density`: from `0` (no clouds) to `1` (full clouds) (default `0.4`)
+ * `color`: basic cloud color, with alpha channel (default `#fff0f0e5`)
+ * `ambient`: cloud color lower bound, use for a "glow at night" effect (default `#000000`)
+ * `height`: cloud height, i.e. y of cloud base (default per conf, usually `120`)
+ * `thickness`: cloud thickness in nodes (default `16`)
+ * `speed`: 2D cloud speed + direction in nodes per second (default `{x=0, y=-2}`)
+* `get_clouds()`: returns a table with the current cloud parameters as in `set_clouds`
* `override_day_night_ratio(ratio or nil)`
* `0`...`1`: Overrides day-night ratio, controlling sunlight to a specific amount
* `nil`: Disables override, defaulting to sunlight based on day-night cycle
@@ -3070,11 +3427,11 @@ This is basically a reference to a C++ `ServerActiveObject`
{x=189, y=198}, -- < dig animation key frames
{x=200, y=219}, -- < walk+dig animation key frames
frame_speed=30): -- < animation frame speed
-* `get_local_animation()`: returns stand, walk, dig, dig+walk tables and frame_speed
+* `get_local_animation()`: returns stand, walk, dig, dig+walk tables and `frame_speed`
* `set_eye_offset({x=0,y=0,z=0},{x=0,y=0,z=0})`: defines offset value for camera per player
* in first person view
* in third person view (max. values `{x=-10/10,y=-10,15,z=-5/5}`)
-* `get_eye_offset()`: returns offset_first and offset_third
+* `get_eye_offset()`: returns `offset_first` and `offset_third`
### `InvRef`
An `InvRef` is a reference to an inventory.
@@ -3095,8 +3452,9 @@ An `InvRef` is a reference to an inventory.
* `add_item(listname, stack)`: add item somewhere in list, returns leftover `ItemStack`
* `room_for_item(listname, stack):` returns `true` if the stack of items
can be fully added to the list
-* `contains_item(listname, stack)`: returns `true` if the stack of items
- can be fully taken from the list
+* `contains_item(listname, stack, [match_meta])`: returns `true` if
+ the stack of items can be fully taken from the list.
+ If `match_meta` is false, only the items' names are compared (default: `false`).
* `remove_item(listname, stack)`: take as many items as specified from the list,
returns the items that were actually removed (as an `ItemStack`) -- note that
any item metadata is ignored, so attempting to remove a specific unique
@@ -3207,9 +3565,9 @@ It can be created via `PcgRandom(seed)` or `PcgRandom(seed, sequence)`.
* `next(min, max)`: return next integer random number [`min`...`max`]
* `rand_normal_dist(min, max, num_trials=6)`: return normally distributed random number [`min`...`max`]
* This is only a rough approximation of a normal distribution with:
- * mean = (max - min) / 2, and
- * variance = (((max - min + 1) ^ 2) - 1) / (12 * num_trials)
- * Increasing num_trials improves accuracy of the approximation
+ * `mean = (max - min) / 2`, and
+ * `variance = (((max - min + 1) ^ 2) - 1) / (12 * num_trials)`
+ * Increasing `num_trials` improves accuracy of the approximation
### `SecureRandom`
Interface for the operating system's crypto-secure PRNG.
@@ -3277,11 +3635,11 @@ destruction callbacks run, and no rollback information is logged.
It is important to note that VoxelManip is designed for speed, and *not* ease of use or flexibility.
If your mod requires a map manipulation facility that will handle 100% of all edge cases, or the use
-of high level node placement features, perhaps minetest.set_node() is better suited for the job.
+of high level node placement features, perhaps `minetest.set_node()` is better suited for the job.
In addition, VoxelManip might not be faster, or could even be slower, for your specific use case.
VoxelManip is most effective when setting very large areas of map at once - for example, if only
-setting a 5x5x5 node area, a minetest.set_node() loop may be more optimal. Always profile code
+setting a 5x5x5 node area, a `minetest.set_node()` loop may be more optimal. Always profile code
using both methods of map manipulation to determine which is most appropriate for your usage.
#### Using VoxelManip
@@ -3317,10 +3675,10 @@ otherwise explicitly stated.
Once the bulk data has been edited to your liking, the internal VoxelManip state can be set using:
`VoxelManip:set_data()` for node content (in Content ID form, see section 'Content IDs'),
`VoxelManip:set_light_data()` for node light levels, and
-`VoxelManip:set_param2_data()` for the node type-dependent "param2" values.
+`VoxelManip:set_param2_data()` for the node type-dependent `param2` values.
The parameter to each of the above three functions can use any table at all in the same flat array
-format as produced by get_data() et al. and is *not required* to be a table retrieved from get_data().
+format as produced by `get_data()` et al. and is *not required* to be a table retrieved from `get_data()`.
Once the internal VoxelManip state has been modified to your liking, the changes can be committed back
to the map by calling `VoxelManip:write_to_map()`.
@@ -3336,6 +3694,7 @@ Then, for a loaded region of p1..p2, this array ranges from `1` up to and includ
the expression `Nx * Ny * Nz`.
Positions offset from p1 are present in the array with the format of:
+
```
[
(0, 0, 0), (1, 0, 0), (2, 0, 0), ... (Nx, 0, 0),
@@ -3367,11 +3726,10 @@ After registration of a node, its Content ID will remain the same throughout exe
Note that the node being queried needs to have already been been registered.
The following builtin node types have their Content IDs defined as constants:
-```
-core.CONTENT_UNKNOWN (ID for "unknown" nodes)
-core.CONTENT_AIR (ID for "air" nodes)
-core.CONTENT_IGNORE (ID for "ignore" nodes)
-```
+
+* `minetest.CONTENT_UNKNOWN`: ID for "unknown" nodes
+* `minetest.CONTENT_AIR`: ID for "air" nodes
+* `minetest.CONTENT_IGNORE`: ID for "ignore" nodes
##### Mapgen VoxelManip objects
Inside of `on_generated()` callbacks, it is possible to retrieve the same VoxelManip object used by the
@@ -3422,8 +3780,14 @@ will place the schematic inside of the VoxelManip.
* `read_from_map(p1, p2)`: Loads a chunk of map into the VoxelManip object containing
the region formed by `p1` and `p2`.
* returns actual emerged `pmin`, actual emerged `pmax`
-* `write_to_map()`: Writes the data loaded from the `VoxelManip` back to the map.
+* `write_to_map([light])`: Writes the data loaded from the `VoxelManip` back to the map.
* **important**: data must be set using `VoxelManip:set_data()` before calling this
+ * if `light` is true, then lighting is automatically recalculated.
+ The default value is true.
+ If `light` is false, no light calculations happen, and you should correct
+ all modified blocks with `minetest.fix_light()` as soon as possible.
+ Keep in mind that modifying the map where light is incorrect can cause
+ more lighting bugs.
* `get_node_at(pos)`: Returns a `MapNode` table of the node currently loaded in
the `VoxelManip` at that position
* `set_node_at(pos, node)`: Sets a specific `MapNode` in the `VoxelManip` at that position
@@ -3490,10 +3854,15 @@ It can be created via `Settings(filename)`.
* `get(key)`: returns a value
* `get_bool(key)`: returns a boolean
* `set(key, value)`
+ * Setting names can't contain whitespace or any of `="{}#`.
+ * Setting values can't contain the sequence `\n"""`.
+ * Setting names starting with "secure." can't be set on the main settings object (`minetest.settings`).
+* `set_bool(key, value)`
+ * See documentation for set() above.
* `remove(key)`: returns a boolean (`true` for success)
* `get_names()`: returns `{key1,...}`
* `write()`: returns a boolean (`true` for success)
- * write changes to file
+ * Writes changes to file.
* `to_table()`: returns `{[key1]=value1,...}`
Mapgen objects
@@ -3655,28 +4024,34 @@ Definition tables
{
hp_max = 1,
physical = true,
- collide_with_objects = true, -- collide with other objects if physical=true
+ collide_with_objects = true, -- collide with other objects if physical = true
weight = 5,
- collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
- visual = "cube"/"sprite"/"upright_sprite"/"mesh"/"wielditem",
- visual_size = {x=1, y=1},
+ collisionbox = {-0.5, 0.0, -0.5, 0.5, 1.0, 0.5},
+ visual = "cube" / "sprite" / "upright_sprite" / "mesh" / "wielditem",
+ 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},
+ spritediv = {x = 1, y = 1},
+ initial_sprite_basepos = {x = 0, y = 0},
is_visible = true,
makes_footstep_sound = false,
automatic_rotate = false,
stepheight = 0,
automatic_face_movement_dir = 0.0,
- -- ^ automatically set yaw to movement direction; offset in degrees; false to disable
+ -- ^ Automatically set yaw to movement direction, offset in degrees,
+ -- 'false' to disable.
automatic_face_movement_max_rotation_per_sec = -1,
- -- ^ limit automatic rotation to this value in degrees per second. values < 0 no limit
+ -- ^ Limit automatic rotation to this value in degrees per second,
+ -- value < 0 no limit.
backface_culling = true, -- false to disable backface_culling for model
nametag = "", -- by default empty, for players their name is shown if empty
nametag_color = <color>, -- sets color of nametag as ColorSpec
infotext = "", -- by default empty, text to be shown when pointed at object
+ static_save = true,
+ -- ^ If false, never save this object statically. It will simply be deleted when the block gets unloaded.
+ -- ^ The get_staticdata() callback is never called then.
+ -- ^ Defaults to 'true'
}
### Entity definition (`register_entity`)
@@ -3887,6 +4262,12 @@ Definition tables
tiles = {tile definition 1, def2, def3, def4, def5, def6}, --[[
^ Textures of node; +Y, -Y, +X, -X, +Z, -Z (old field name: tile_images)
^ List can be shortened to needed length ]]
+ overlay_tiles = {tile definition 1, def2, def3, def4, def5, def6}, --[[
+ ^ Same as `tiles`, but these textures are drawn on top of the
+ ^ base tiles. You can use this to colorize only specific parts of
+ ^ your texture. If the texture name is an empty string, that
+ ^ overlay is not drawn. Since such tiles are drawn twice, it
+ ^ is not recommended to use overlays on very common nodes.
special_tiles = {tile definition 1, Tile definition 2}, --[[
^ Special textures of node; used rarely (old field name: special_materials)
^ List can be shortened to needed length ]]
@@ -3914,7 +4295,9 @@ Definition tables
diggable = true, -- If false, can never be dug
climbable = false, -- If true, can be climbed on (ladder)
buildable_to = false, -- If true, placed nodes can replace this node
- floodable = false, -- If true, liquids flow into and replace this node
+ floodable = false, --[[
+ ^ If true, liquids flow into and replace this node.
+ ^ Warning: making a liquid node 'floodable' does not work and may cause problems. ]]
liquidtype = "none", -- "none"/"source"/"flowing"
liquid_alternative_flowing = "", -- Flowing version of source liquid
liquid_alternative_source = "", -- Source version of flowing liquid
@@ -3943,6 +4326,12 @@ Definition tables
^ If drawtype "nodebox" is used and selection_box is nil, then node_box is used. ]]
legacy_facedir_simple = false, -- Support maps made in and before January 2012
legacy_wallmounted = false, -- Support maps made in and before January 2012
+ waving = 0, --[[ valid for mesh, nodebox, plantlike, allfaces_optional nodes
+ ^ 1 - wave node like plants (top of node moves, bottom is fixed)
+ ^ 2 - wave node like leaves (whole node moves side-to-side synchronously)
+ ^ caveats: not all models will properly wave
+ ^ plantlike drawtype nodes can only wave like plants
+ ^ allfaces_optional drawtype nodes can only wave like leaves --]]
sounds = {
footstep = <SimpleSoundSpec>,
dig = <SimpleSoundSpec>, -- "__group" = group-based sound (default)
@@ -3958,6 +4347,7 @@ Definition tables
{
items = {"foo:bar", "baz:frob"}, -- Items to drop.
rarity = 1, -- Probability of dropping is 1 / rarity.
+ inherit_color = true, -- To inherit palette color from the node
},
},
},
@@ -3975,11 +4365,20 @@ Definition tables
^ Node destructor; called after removing node
^ Not called for bulk node placement (i.e. schematics and VoxelManip)
^ default: nil ]]
+ on_flood = func(pos, oldnode, newnode), --[[
+ ^ Called when a liquid (newnode) is about to flood oldnode, if
+ ^ it has `floodable = true` in the nodedef. Not called for bulk
+ ^ node placement (i.e. schematics and VoxelManip) or air nodes. If
+ ^ return true the node is not flooded, but on_flood callback will
+ ^ most likely be called over and over again every liquid update
+ ^ interval. Default: nil.
+ ^ Warning: making a liquid node 'floodable' does not work and may cause problems. ]]
after_place_node = func(pos, placer, itemstack, pointed_thing) --[[
^ Called after constructing node when node was placed using
minetest.item_place_node / minetest.place_node
^ If return true no item is taken from itemstack
+ ^ `placer` may be any valid ObjectRef or nil
^ default: nil ]]
after_dig_node = func(pos, oldnode, oldmetadata, digger), --[[
^ oldmetadata is in table format
@@ -3995,9 +4394,11 @@ Definition tables
^ By default: Calls minetest.register_on_punchnode callbacks ]]
on_rightclick = func(pos, node, clicker, itemstack, pointed_thing), --[[
^ default: nil
- ^ if defined, itemstack will hold clicker's wielded item
+ ^ itemstack will hold clicker's wielded item
^ Shall return the leftover itemstack
- ^ Note: pointed_thing can be nil, if a mod calls this function ]]
+ ^ Note: pointed_thing can be nil, if a mod calls this function
+ This function does not get triggered by clients <=0.4.16 if the
+ "formspec" node metadata field is set ]]
on_dig = func(pos, node, digger), --[[
^ default: minetest.node_dig
@@ -4412,3 +4813,26 @@ The Biome API is still in an experimental phase and subject to change.
-- ^ HTTP status code
data = "response"
}
+
+### Authentication handler definition
+
+ {
+ get_auth = func(name),
+ -- ^ Get authentication data for existing player `name` (`nil` if player doesn't exist)
+ -- ^ returns following structure `{password=<string>, privileges=<table>, last_login=<number or nil>}`
+ create_auth = func(name, password),
+ -- ^ Create new auth data for player `name`
+ -- ^ Note that `password` is not plain-text but an arbitrary representation decided by the engine
+ set_password = func(name, password),
+ -- ^ Set password of player `name` to `password`
+ Auth data should be created if not present
+ set_privileges = func(name, privileges),
+ -- ^ Set privileges of player `name`
+ -- ^ `privileges` is in table form, auth data should be created if not present
+ reload = func(),
+ -- ^ Reload authentication data from the storage location
+ -- ^ Returns boolean indicating success
+ record_login = func(name),
+ -- ^ Called when player joins, used for keeping track of last_login
+ }
+