Lua_api.txt: Improve bullet point indentation consistency

master
ezhh 2018-01-13 17:25:01 +00:00 committed by paramat
parent 670f8afd18
commit 5435b07d4e
1 changed files with 133 additions and 131 deletions

View File

@ -595,10 +595,10 @@ appropriate `drawtype`:
palette). These nodes can have 32 different colors, and the palette palette). These nodes can have 32 different colors, and the palette
should contain 32 pixels. should contain 32 pixels.
Examples: Examples:
* `param2 = 17` is 2 * 8 + 1, so the rotation is 1 and the third (= 2 + 1) * `param2 = 17` is 2 * 8 + 1, so the rotation is 1 and the third (= 2 + 1)
pixel will be picked from the palette. pixel will be picked from the palette.
* `param2 = 35` is 4 * 8 + 3, so the rotation is 3 and the fifth (= 4 + 1) * `param2 = 35` is 4 * 8 + 3, so the rotation is 3 and the fifth (= 4 + 1)
pixel will be picked from the palette. pixel will be picked from the palette.
* `drawtype = "colorfacedir"` for nodes which use the first * `drawtype = "colorfacedir"` for nodes which use the first
three bits of `param2` for palette indexing. The remaining three bits of `param2` for palette indexing. The remaining
five bits are describing rotation, as in `facedir` draw type. five bits are describing rotation, as in `facedir` draw type.
@ -606,10 +606,10 @@ appropriate `drawtype`:
palette). These nodes can have 8 different colors, and the palette). These nodes can have 8 different colors, and the
palette should contain 8 pixels. palette should contain 8 pixels.
Examples: Examples:
* `param2 = 17` is 0 * 32 + 17, so the rotation is 17 and the * `param2 = 17` is 0 * 32 + 17, so the rotation is 17 and the
first (= 0 + 1) pixel will be picked from the palette. first (= 0 + 1) pixel will be picked from the palette.
* `param2 = 35` is 1 * 32 + 3, so the rotation is 3 and the * `param2 = 35` is 1 * 32 + 3, so the rotation is 3 and the
second (= 1 + 1) pixel will be picked from the palette. second (= 1 + 1) pixel will be picked from the palette.
To colorize a node on the map, set its `param2` value (according To colorize a node on the map, set its `param2` value (according
to the node's draw type). to the node's draw type).
@ -1300,11 +1300,11 @@ in the form of a table. This table specifies the following fields:
* The `data` field is a flat table of MapNode tables making up the schematic, * The `data` field is a flat table of MapNode tables making up the schematic,
in the order of `[z [y [x]]]`. (required) in the order of `[z [y [x]]]`. (required)
Each MapNode table contains: Each MapNode table contains:
* `name`: the name of the map node to place (required) * `name`: the name of the map node to place (required)
* `prob` (alias `param1`): the probability of this node being placed (default: 255) * `prob` (alias `param1`): the probability of this node being placed (default: 255)
* `param2`: the raw param2 value of the node being placed onto the map (default: 0) * `param2`: the raw param2 value of the node being placed onto the map (default: 0)
* `force_place`: boolean representing if the node should forcibly overwrite any * `force_place`: boolean representing if the node should forcibly overwrite any
previous contents (default: false) previous contents (default: false)
About probability values: About probability values:
@ -1849,7 +1849,7 @@ Some of the values in the key-value store are handled specially:
* `description`: Set the item stack'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. * `color`: A `ColorString`, which sets the stack's color.
* `palette_index`: If the item has a palette, this is used to get the * `palette_index`: If the item has a palette, this is used to get the
current color from the palette. current color from the palette.
Example stuff: Example stuff:
@ -2061,8 +2061,8 @@ examples.
#### `item_image_button[<X>,<Y>;<W>,<H>;<item name>;<name>;<label>]` #### `item_image_button[<X>,<Y>;<W>,<H>;<item name>;<name>;<label>]`
* `x`, `y`, `w`, `h`, `name` and `label` work as per button * `x`, `y`, `w`, `h`, `name` and `label` work as per button
* `item name` is the registered name of an item/node, * `item name` is the registered name of an item/node,
tooltip will be made out of its description tooltip will be made out of its description
to override it use tooltip element to override it use tooltip element
* Position and size units are inventory slots * Position and size units are inventory slots
#### `button_exit[<X>,<Y>;<W>,<H>;<name>;<label>]` #### `button_exit[<X>,<Y>;<W>,<H>;<name>;<label>]`
@ -2077,7 +2077,7 @@ examples.
* `w` and `h` are the size of the itemlist * `w` and `h` are the size of the itemlist
* `name` fieldname sent to server on doubleclick value is current selected element * `name` fieldname sent to server on doubleclick value is current selected element
* `listelements` can be prepended by #color in hexadecimal format RRGGBB (only), * `listelements` can be prepended by #color in hexadecimal format RRGGBB (only),
* if you want a listelement to start with "#" write "##". * if you want a listelement to start with "#" write "##".
#### `textlist[<X>,<Y>;<W>,<H>;<name>;<listelem 1>,<listelem 2>,...,<listelem n>;<selected idx>;<transparent>]` #### `textlist[<X>,<Y>;<W>,<H>;<name>;<listelem 1>,<listelem 2>,...,<listelem n>;<selected idx>;<transparent>]`
* Scrollable itemlist showing arbitrary text elements * Scrollable itemlist showing arbitrary text elements
@ -2085,7 +2085,7 @@ examples.
* `w` and `h` are the size of the item list * `w` and `h` are the size of the item list
* `name` fieldname sent to server on doubleclick value is current selected element * `name` fieldname sent to server on doubleclick value is current selected element
* `listelements` can be prepended by #RRGGBB (only) in hexadecimal format * `listelements` can be prepended by #RRGGBB (only) in hexadecimal format
* if you want a listelement to start with "#" write "##" * if you want a listelement to start with "#" write "##"
* Index to be selected within textlist * Index to be selected within textlist
* `true`/`false`: draw transparent background * `true`/`false`: draw transparent background
* See also `minetest.explode_textlist_event` (main menu: `engine.explode_textlist_event`) * See also `minetest.explode_textlist_event` (main menu: `engine.explode_textlist_event`)
@ -2108,8 +2108,8 @@ examples.
#### `dropdown[<X>,<Y>;<W>;<name>;<item 1>,<item 2>, ...,<item n>;<selected idx>]` #### `dropdown[<X>,<Y>;<W>;<name>;<item 1>,<item 2>, ...,<item n>;<selected idx>]`
* Show a dropdown field * Show a dropdown field
* **Important note**: There are two different operation modes: * **Important note**: There are two different operation modes:
1. handle directly on change (only changed dropdown is submitted) 1. handle directly on change (only changed dropdown is submitted)
2. read the value on pressing a button (all dropdown values are available) 2. read the value on pressing a button (all dropdown values are available)
* `x` and `y` position of dropdown * `x` and `y` position of dropdown
* Width of dropdown * Width of dropdown
* Fieldname data is transferred to Lua * Fieldname data is transferred to Lua
@ -2126,8 +2126,8 @@ examples.
#### `scrollbar[<X>,<Y>;<W>,<H>;<orientation>;<name>;<value>]` #### `scrollbar[<X>,<Y>;<W>,<H>;<orientation>;<name>;<value>]`
* Show a scrollbar * Show a scrollbar
* There are two ways to use it: * There are two ways to use it:
1. handle the changed event (only changed scrollbar is available) 1. handle the changed event (only changed scrollbar is available)
2. read the value on pressing a button (all scrollbars are available) 2. read the value on pressing a button (all scrollbars are available)
* `x` and `y`: position of trackbar * `x` and `y`: position of trackbar
* `w` and `h`: width and height * `w` and `h`: width and height
* `orientation`: `vertical`/`horizontal` * `orientation`: `vertical`/`horizontal`
@ -2148,25 +2148,25 @@ examples.
#### `tableoptions[<opt 1>;<opt 2>;...]` #### `tableoptions[<opt 1>;<opt 2>;...]`
* Sets options for `table[]` * Sets options for `table[]`
* `color=#RRGGBB` * `color=#RRGGBB`
* default text color (`ColorString`), defaults to `#FFFFFF` * default text color (`ColorString`), defaults to `#FFFFFF`
* `background=#RRGGBB` * `background=#RRGGBB`
* table background color (`ColorString`), defaults to `#000000` * table background color (`ColorString`), defaults to `#000000`
* `border=<true/false>` * `border=<true/false>`
* should the table be drawn with a border? (default: `true`) * should the table be drawn with a border? (default: `true`)
* `highlight=#RRGGBB` * `highlight=#RRGGBB`
* highlight background color (`ColorString`), defaults to `#466432` * highlight background color (`ColorString`), defaults to `#466432`
* `highlight_text=#RRGGBB` * `highlight_text=#RRGGBB`
* highlight text color (`ColorString`), defaults to `#FFFFFF` * highlight text color (`ColorString`), defaults to `#FFFFFF`
* `opendepth=<value>` * `opendepth=<value>`
* all subtrees up to `depth < value` are open (default value = `0`) * all subtrees up to `depth < value` are open (default value = `0`)
* only useful when there is a column of type "tree" * only useful when there is a column of type "tree"
#### `tablecolumns[<type 1>,<opt 1a>,<opt 1b>,...;<type 2>,<opt 2a>,<opt 2b>;...]` #### `tablecolumns[<type 1>,<opt 1a>,<opt 1b>,...;<type 2>,<opt 2a>,<opt 2b>;...]`
* Sets columns for `table[]` * Sets columns for `table[]`
* Types: `text`, `image`, `color`, `indent`, `tree` * Types: `text`, `image`, `color`, `indent`, `tree`
* `text`: show cell contents as text * `text`: show cell contents as text
* `image`: cell contents are an image index, use column options to define images * `image`: cell contents are an image index, use column options to define images
* `color`: cell contents are a ColorString and define color of following cell * `color`: cell contents are a ColorString and define color of following cell
* `indent`: cell contents are a number and define indentation of following cell * `indent`: cell contents are a number and define indentation of following cell
* `tree`: same as indent, but user can open and close subtrees (treeview-like) * `tree`: same as indent, but user can open and close subtrees (treeview-like)
* Column options: * Column options:
@ -2244,8 +2244,8 @@ The following functions provide escape sequences:
* `minetest.colorize(color, message)`: * `minetest.colorize(color, message)`:
* Equivalent to: * Equivalent to:
`minetest.get_color_escape_sequence(color) .. `minetest.get_color_escape_sequence(color) ..
message .. message ..
minetest.get_color_escape_sequence("#ffffff")` minetest.get_color_escape_sequence("#ffffff")`
* `minetest.get_background_escape_sequence(color)` * `minetest.get_background_escape_sequence(color)`
* `color` is a ColorString * `color` is a ColorString
* The escape sequence sets the background of the whole text element to * The escape sequence sets the background of the whole text element to
@ -2300,7 +2300,7 @@ For the following functions `x` can be either a vector or a number:
Helper functions Helper functions
---------------- ----------------
* `dump2(obj, name, dumped)`: returns a string which makes `obj` human readable, * `dump2(obj, name, dumped)`: returns a string which makes `obj` human readable,
handles reference loops handles reference loops
* `obj`: arbitrary variable * `obj`: arbitrary variable
* `name`: string, default: `"_"` * `name`: string, default: `"_"`
* `dumped`: table, default: `{}` * `dumped`: table, default: `{}`
@ -2490,9 +2490,9 @@ Strings that need to be translated can contain several escapes, preceded by `@`.
if they don't exist. if they don't exist.
* `minetest.get_dir_list(path, [is_dir])`: returns list of entry names * `minetest.get_dir_list(path, [is_dir])`: returns list of entry names
* is_dir is one of: * is_dir is one of:
* nil: return all entries, * nil: return all entries,
* true: return only subdirectory names, or * true: return only subdirectory names, or
* false: return only file names. * false: return only file names.
* `minetest.safe_file_write(path, content)`: returns boolean indicating success * `minetest.safe_file_write(path, content)`: returns boolean indicating success
* Replaces contents of file at path with new contents in a safe (atomic) way. * 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: Use this instead of below code when writing e.g. database files:
@ -2574,24 +2574,24 @@ Call these functions only at load time!
* **Not recommended**; Use `on_destruct` or `after_dig_node` in node definition * **Not recommended**; Use `on_destruct` or `after_dig_node` in node definition
whenever possible whenever possible
* `minetest.register_on_punchnode(func(pos, node, puncher, pointed_thing))` * `minetest.register_on_punchnode(func(pos, node, puncher, pointed_thing))`
* Called when a node is punched * Called when a node is punched
* `minetest.register_on_generated(func(minp, maxp, blockseed))` * `minetest.register_on_generated(func(minp, maxp, blockseed))`
* Called after generating a piece of world. Modifying nodes inside the area * Called after generating a piece of world. Modifying nodes inside the area
is a bit faster than usually. is a bit faster than usually.
* `minetest.register_on_newplayer(func(ObjectRef))` * `minetest.register_on_newplayer(func(ObjectRef))`
* Called after a new player has been created * Called after a new player has been created
* `minetest.register_on_dieplayer(func(ObjectRef))` * `minetest.register_on_dieplayer(func(ObjectRef))`
* Called when a player dies * Called when a player dies
* `minetest.register_on_punchplayer(func(player, hitter, time_from_last_punch, tool_capabilities, dir, damage))` * `minetest.register_on_punchplayer(func(player, hitter, time_from_last_punch, tool_capabilities, dir, damage))`
* Called when a player is punched * Called when a player is punched
* `player` - ObjectRef - Player that was punched * `player` - ObjectRef - Player that was punched
* `hitter` - ObjectRef - Player that hit * `hitter` - ObjectRef - Player that hit
* `time_from_last_punch`: Meant for disallowing spamming of clicks (can be nil) * `time_from_last_punch`: Meant for disallowing spamming of clicks (can be nil)
* `tool_capabilities`: capability table of used tool (can be nil) * `tool_capabilities`: capability table of used tool (can be nil)
* `dir`: unit vector of direction of punch. Always defined. Points from * `dir`: unit vector of direction of punch. Always defined. Points from
the puncher to the punched. the puncher to the punched.
* `damage` - number that represents the damage calculated by the engine * `damage` - number that represents the damage calculated by the engine
* should return `true` to prevent the default damage mechanism * should return `true` to prevent the default damage mechanism
* `minetest.register_on_player_hpchange(func(player, hp_change), modifier)` * `minetest.register_on_player_hpchange(func(player, hp_change), modifier)`
* Called when the player gets damaged or healed * Called when the player gets damaged or healed
* `player`: ObjectRef of the player * `player`: ObjectRef of the player
@ -2601,12 +2601,12 @@ Call these functions only at load time!
modifiers can return true as a second argument to stop the execution of further functions. 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. Non-modifiers receive the final hp change calculated by the modifiers.
* `minetest.register_on_respawnplayer(func(ObjectRef))` * `minetest.register_on_respawnplayer(func(ObjectRef))`
* Called when player is to be respawned * Called when player is to be respawned
* Called _before_ repositioning of player occurs * Called _before_ repositioning of player occurs
* return true in func to disable regular player placement * return true in func to disable regular player placement
* `minetest.register_on_prejoinplayer(func(name, ip))` * `minetest.register_on_prejoinplayer(func(name, ip))`
* Called before a player joins the game * Called before a player joins the game
* If it returns a string, the player is disconnected with that string as reason * If it returns a string, the player is disconnected with that string as reason
* `minetest.register_on_joinplayer(func(ObjectRef))` * `minetest.register_on_joinplayer(func(ObjectRef))`
* Called when a player joins the game * Called when a player joins the game
* `minetest.register_on_leaveplayer(func(ObjectRef, timed_out))` * `minetest.register_on_leaveplayer(func(ObjectRef, timed_out))`
@ -2640,10 +2640,10 @@ Call these functions only at load time!
* `minetest.register_on_protection_violation(func(pos, name))` * `minetest.register_on_protection_violation(func(pos, name))`
* Called by `builtin` and mods when a player violates protection at a position * Called by `builtin` and mods when a player violates protection at a position
(eg, digs a node or punches a protected entity). (eg, digs a node or punches a protected entity).
* The registered functions can be called using `minetest.record_protection_violation` * The registered functions can be called using `minetest.record_protection_violation`
* The provided function should check that the position is protected by the mod * The provided function should check that the position is protected by the mod
calling this function before it prints a message, if it does, to allow for calling this function before it prints a message, if it does, to allow for
multiple protection mods. multiple protection mods.
* `minetest.register_on_item_eat(func(hp_change, replace_with_item, itemstack, user, pointed_thing))` * `minetest.register_on_item_eat(func(hp_change, replace_with_item, itemstack, user, pointed_thing))`
* Called when an item is eaten, by `minetest.item_eat` * Called when an item is eaten, by `minetest.item_eat`
* Return `true` or `itemstack` to cancel the default item eat response (i.e.: hp increase) * Return `true` or `itemstack` to cancel the default item eat response (i.e.: hp increase)
@ -2676,9 +2676,9 @@ Call these functions only at load time!
the default of `give_to_singleplayer` is true the default of `give_to_singleplayer` is true
* To allow players with `basic_privs` to grant, see `basic_privs` minetest.conf setting. * To allow players with `basic_privs` to grant, see `basic_privs` minetest.conf setting.
* `on_grant(name, granter_name)`: Called when given to player `name` by `granter_name`. * `on_grant(name, granter_name)`: Called when given to player `name` by `granter_name`.
`granter_name` will be nil if the priv was granted by a mod. `granter_name` will be nil if the priv was granted by a mod.
* `on_revoke(name, revoker_name)`: Called when taken from player `name` by `revoker_name`. * `on_revoke(name, revoker_name)`: Called when taken from player `name` by `revoker_name`.
`revoker_name` will be nil if the priv was revoked by a mod `revoker_name` will be nil if the priv was revoked by a mod
* Note that the above two callbacks will be called twice if a player is responsible - * Note that the above two callbacks will be called twice if a player is responsible -
once with the player name, and then with a nil player name. once with the player name, and then with a nil player name.
* Return true in the above callbacks to stop register_on_priv_grant or revoke being called. * Return true in the above callbacks to stop register_on_priv_grant or revoke being called.
@ -2815,8 +2815,8 @@ and `minetest.auth_reload` call the authentication handler.
* `minetest.set_gen_notify(flags, {deco_ids})` * `minetest.set_gen_notify(flags, {deco_ids})`
* Set the types of on-generate notifications that should be collected * Set the types of on-generate notifications that should be collected
* `flags` is a flag field with the available flags: `dungeon`, `temple`, `cave_begin`, * `flags` is a flag field with the available flags: `dungeon`, `temple`, `cave_begin`,
`cave_end`, `large_cave_begin`, `large_cave_end`, `decoration` `cave_end`, `large_cave_begin`, `large_cave_end`, `decoration`
* The second parameter is a list of IDS of decorations which notification is requested for * 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_id`s * `get_gen_notify()`: returns a flagstring and a table with the `deco_id`s
* `minetest.get_mapgen_object(objectname)` * `minetest.get_mapgen_object(objectname)`
* Return requested mapgen object if available (see "Mapgen objects") * Return requested mapgen object if available (see "Mapgen objects")
@ -2825,7 +2825,7 @@ and `minetest.auth_reload` call the authentication handler.
given biome_name string. given biome_name string.
* `minetest.get_mapgen_params()` Returns mapgen parameters, a table containing * `minetest.get_mapgen_params()` Returns mapgen parameters, a table containing
`mgname`, `seed`, `chunksize`, `water_level`, and `flags`. `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)` * `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 * Set map generation parameters
@ -2848,11 +2848,11 @@ and `minetest.auth_reload` call the authentication handler.
* Same as above, but returns the value as a NoiseParams table if the setting `name` exists * Same as above, but returns the value as a NoiseParams table if the setting `name` exists
and is a valid NoiseParams and is a valid NoiseParams
* `minetest.set_mapgen_setting(name, value, [override_meta])` * `minetest.set_mapgen_setting(name, value, [override_meta])`
* Sets a mapgen param to `value`, and will take effect if the corresponding mapgen setting * Sets a mapgen param to `value`, and will take effect if the corresponding mapgen setting
is not already present in map_meta.txt. is not already present in map_meta.txt.
* `override_meta` is an optional boolean (default: `false`). If this is set to true, * `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. 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])` * `minetest.set_mapgen_setting_noiseparams(name, value, [override_meta])`
* Same as above, except value is a NoiseParams table. * Same as above, except value is a NoiseParams table.
* `minetest.set_noiseparams(name, noiseparams, set_default)` * `minetest.set_noiseparams(name, noiseparams, set_default)`
@ -2874,17 +2874,20 @@ and `minetest.auth_reload` call the authentication handler.
clear objects in unloaded mapblocks only when the mapblocks are next activated. clear objects in unloaded mapblocks only when the mapblocks are next activated.
* `minetest.emerge_area(pos1, pos2, [callback], [param])` * `minetest.emerge_area(pos1, pos2, [callback], [param])`
* Queue all blocks in the area from `pos1` to `pos2`, inclusive, to be asynchronously * Queue all blocks in the area from `pos1` to `pos2`, inclusive, to be asynchronously
* fetched from memory, loaded from disk, or if inexistent, generates them. fetched from memory, loaded from disk, or if inexistent, generates them.
* If `callback` is a valid Lua function, this will be called for each block emerged. * If `callback` is a valid Lua function, this will be called for each block emerged.
* The function signature of callback is: * The function signature of callback is:
* `function EmergeAreaCallback(blockpos, action, calls_remaining, param)` * `function EmergeAreaCallback(blockpos, action, calls_remaining, param)`
* - `blockpos` is the *block* coordinates of the block that had been emerged * `blockpos` is the *block* coordinates of the block that had been emerged
* - `action` could be one of the following constant values: * `action` could be one of the following constant values:
* `minetest.EMERGE_CANCELLED`, `minetest.EMERGE_ERRORED`, `minetest.EMERGE_FROM_MEMORY`, * `minetest.EMERGE_CANCELLED`
* `minetest.EMERGE_FROM_DISK`, `minetest.EMERGE_GENERATED` * `minetest.EMERGE_ERRORED`
* - `calls_remaining` is the number of callbacks to be expected after this one * `minetest.EMERGE_FROM_MEMORY`
* - `param` is the user-defined parameter passed to emerge_area (or nil if the * `minetest.EMERGE_FROM_DISK`
* parameter was absent) * `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)
* `minetest.delete_area(pos1, pos2)` * `minetest.delete_area(pos1, pos2)`
* delete all mapblocks in the area from pos1 to pos2, inclusive * delete all mapblocks in the area from pos1 to pos2, inclusive
* `minetest.line_of_sight(pos1, pos2)`: returns `boolean, pos` * `minetest.line_of_sight(pos1, pos2)`: returns `boolean, pos`
@ -2971,7 +2974,7 @@ You can find mod channels communication scheme in `docs/mod_channels.png`.
Note that this parameter is mostly just a workaround and will be removed in future releases. 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. * Creates a detached inventory. If it already exists, it is cleared.
* `minetest.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed_thing)`: * `minetest.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed_thing)`:
returns left over ItemStack returns left over ItemStack
* See `minetest.item_eat` and `minetest.register_on_item_eat` * See `minetest.item_eat` and `minetest.register_on_item_eat`
### Formspec ### Formspec
@ -2983,7 +2986,7 @@ You can find mod channels communication scheme in `docs/mod_channels.png`.
* `minetest.close_formspec(playername, formname)` * `minetest.close_formspec(playername, formname)`
* `playername`: name of player to close formspec * `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. 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 * 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!**
@ -3054,7 +3057,7 @@ You can find mod channels communication scheme in `docs/mod_channels.png`.
* `input.width` = for example `3` * `input.width` = for example `3`
* `input.items` = for example * `input.items` = for example
`{ stack1, stack2, stack3, stack4, stack 5, stack 6, stack 7, stack 8, stack 9 }` `{ stack1, stack2, stack3, stack4, stack 5, stack 6, stack 7, stack 8, stack 9 }`
* `input.items` = `nil` if no recipe found * `input.items` = `nil` if no recipe found
* `minetest.get_all_craft_recipes(query item)`: returns a table or `nil` * `minetest.get_all_craft_recipes(query item)`: returns a table or `nil`
* returns indexed table with all registered recipes for query item (node) * returns indexed table with all registered recipes for query item (node)
or `nil` if no recipe was found or `nil` if no recipe was found
@ -3153,11 +3156,11 @@ These functions return the leftover itemstack.
* Optional: Variable number of arguments that are passed to `func` * Optional: Variable number of arguments that are passed to `func`
### Server ### Server
* `minetest.request_shutdown([message],[reconnect],[delay])`: request for server shutdown. Will display `message` to clients, * `minetest.request_shutdown([message],[reconnect],[delay])`: request for server shutdown. Will display `message` to clients.
`reconnect` == true displays a reconnect button, * `reconnect` == true displays a reconnect button
`delay` adds an optional delay (in seconds) before shutdown * `delay` adds an optional delay (in seconds) before shutdown.
negative delay cancels the current active shutdown Negative delay cancels the current active shutdown.
zero delay triggers an immediate shutdown. Zero delay triggers an immediate shutdown.
* `minetest.cancel_shutdown_requests()`: cancel current delayed shutdown * `minetest.cancel_shutdown_requests()`: cancel current delayed shutdown
* `minetest.get_server_status()`: returns server status string * `minetest.get_server_status()`: returns server status string
* `minetest.get_server_uptime()`: returns the server uptime in seconds * `minetest.get_server_uptime()`: returns the server uptime in seconds
@ -3193,8 +3196,7 @@ These functions return the leftover itemstack.
* `minetest.delete_particlespawner(id, player)` * `minetest.delete_particlespawner(id, player)`
* Delete `ParticleSpawner` with `id` (return value from `minetest.add_particlespawner`) * Delete `ParticleSpawner` with `id` (return value from `minetest.add_particlespawner`)
* If playername is specified, only deletes on the player's client, * If playername is specified, only deletes on the player's client, otherwise on all clients
* otherwise on all clients
### Schematics ### Schematics
* `minetest.create_schematic(p1, p2, probability_list, filename, slice_prob_list)` * `minetest.create_schematic(p1, p2, probability_list, filename, slice_prob_list)`
@ -3336,9 +3338,9 @@ These functions return the leftover itemstack.
* Compress a string of data. * Compress a string of data.
* `method` is a string identifying the compression method to be used. * `method` is a string identifying the compression method to be used.
* Supported compression methods: * Supported compression methods:
* Deflate (zlib): `"deflate"` * Deflate (zlib): `"deflate"`
* `...` indicates method-specific arguments. Currently defined arguments are: * `...` indicates method-specific arguments. Currently defined arguments are:
* Deflate: `level` - Compression level, `0`-`9` or `nil`. * Deflate: `level` - Compression level, `0`-`9` or `nil`.
* `minetest.decompress(compressed_data, method, ...)`: returns data * `minetest.decompress(compressed_data, method, ...)`: returns data
* Decompress a string of data (using ZLib). * Decompress a string of data (using ZLib).
* See documentation on `minetest.compress()` for supported compression methods. * See documentation on `minetest.compress()` for supported compression methods.
@ -3371,8 +3373,8 @@ These functions return the leftover itemstack.
return old_is_protected(pos, name) return old_is_protected(pos, name)
end end
* `minetest.record_protection_violation(pos, name)` * `minetest.record_protection_violation(pos, name)`
* This function calls functions registered with * This function calls functions registered with
`minetest.register_on_protection_violation`. `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)`
* Attempt to predict the desired orientation of the facedir-capable node * Attempt to predict the desired orientation of the facedir-capable node
defined by `itemstack`, and place it accordingly (on-wall, on the floor, or defined by `itemstack`, and place it accordingly (on-wall, on the floor, or
@ -3380,7 +3382,7 @@ These functions return the leftover itemstack.
field is false or omitted (else, the itemstack is not changed). `orient_flags` field is false or omitted (else, the itemstack is not changed). `orient_flags`
is an optional table containing extra tweaks to the placement code: is an optional table containing extra tweaks to the placement code:
* `invert_wall`: if `true`, place wall-orientation on the ground and ground- * `invert_wall`: if `true`, place wall-orientation on the ground and ground-
orientation on the wall. orientation on the wall.
* `force_wall` : if `true`, always place the node in wall orientation. * `force_wall` : if `true`, always place the node in wall orientation.
* `force_ceiling`: if `true`, always place on the ceiling. * `force_ceiling`: if `true`, always place on the ceiling.
* `force_floor`: if `true`, always place the node on the floor. * `force_floor`: if `true`, always place the node on the floor.
@ -3390,8 +3392,8 @@ These functions return the leftover itemstack.
precedence over the first. precedence over the first.
* `minetest.rotate_node(itemstack, placer, pointed_thing)` * `minetest.rotate_node(itemstack, placer, pointed_thing)`
* calls `rotate_and_place()` with infinitestacks set according to the state of * 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` the creative mode setting, and checks for "sneak" to set the `invert_wall`
parameter. parameter.
* `minetest.forceload_block(pos[, transient])` * `minetest.forceload_block(pos[, transient])`
* forceloads the position `pos`. * forceloads the position `pos`.
@ -3418,8 +3420,8 @@ These functions return the leftover itemstack.
### Global objects ### Global objects
* `minetest.env`: `EnvRef` of the server environment and world. * `minetest.env`: `EnvRef` of the server environment and world.
* Any function in the minetest namespace can be called using the syntax * Any function in the minetest namespace can be called using the syntax
`minetest.env:somefunction(somearguments)` `minetest.env:somefunction(somearguments)`
instead of `minetest.somefunction(somearguments)` instead of `minetest.somefunction(somearguments)`
* Deprecated, but support is not to be dropped soon * Deprecated, but support is not to be dropped soon
### Global tables ### Global tables
@ -3561,13 +3563,13 @@ This is basically a reference to a C++ `ServerActiveObject`
* `set_armor_groups({group1=rating, group2=rating, ...})` * `set_armor_groups({group1=rating, group2=rating, ...})`
* `get_armor_groups()`: returns a table with the armor group ratings * `get_armor_groups()`: returns a table with the armor group ratings
* `set_animation(frame_range, frame_speed, frame_blend, frame_loop)` * `set_animation(frame_range, frame_speed, frame_blend, frame_loop)`
* `frame_range`: table {x=num, y=num}, default: `{x=1, y=1}` * `frame_range`: table {x=num, y=num}, default: `{x=1, y=1}`
* `frame_speed`: number, default: `15.0` * `frame_speed`: number, default: `15.0`
* `frame_blend`: number, default: `0.0` * `frame_blend`: number, default: `0.0`
* `frame_loop`: boolean, default: `true` * `frame_loop`: boolean, default: `true`
* `get_animation()`: returns `range`, `frame_speed`, `frame_blend` and `frame_loop` * `get_animation()`: returns `range`, `frame_speed`, `frame_blend` and `frame_loop`
* `set_animation_frame_speed(frame_speed)` * `set_animation_frame_speed(frame_speed)`
* `frame_speed`: number, default: `15.0` * `frame_speed`: number, default: `15.0`
* `set_attach(parent, bone, position, rotation)` * `set_attach(parent, bone, position, rotation)`
* `bone`: string * `bone`: string
* `position`: `{x=num, y=num, z=num}` (relative) * `position`: `{x=num, y=num, z=num}` (relative)
@ -3625,22 +3627,22 @@ This is basically a reference to a C++ `ServerActiveObject`
table {x, y, z} representing the player's instantaneous velocity in nodes/s table {x, y, z} representing the player's instantaneous velocity in nodes/s
* `get_look_dir()`: get camera direction as a unit vector * `get_look_dir()`: get camera direction as a unit vector
* `get_look_vertical()`: pitch in radians * `get_look_vertical()`: pitch in radians
* Angle ranges between -pi/2 and pi/2, which are straight up and down respectively. * Angle ranges between -pi/2 and pi/2, which are straight up and down respectively.
* `get_look_horizontal()`: yaw in radians * `get_look_horizontal()`: yaw in radians
* Angle is counter-clockwise from the +z direction. * Angle is counter-clockwise from the +z direction.
* `set_look_vertical(radians)`: sets look pitch * `set_look_vertical(radians)`: sets look pitch
* radians - Angle from looking forward, where positive is downwards. * radians - Angle from looking forward, where positive is downwards.
* `set_look_horizontal(radians)`: sets look yaw * `set_look_horizontal(radians)`: sets look yaw
* radians - Angle from the +z direction, where positive is counter-clockwise. * 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. * 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. * Angle is counter-clockwise from the +x direction.
* `set_look_pitch(radians)`: sets look pitch - Deprecated. Use `set_look_vertical`. * `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_yaw(radians)`: sets look yaw - Deprecated. Use `set_look_horizontal`.
* `get_breath()`: returns players breath * `get_breath()`: returns players breath
* `set_breath(value)`: sets players breath * `set_breath(value)`: sets players breath
* values: * values:
* `0`: player is drowning * `0`: player is drowning
* max: bubbles bar is not shown * max: bubbles bar is not shown
* See Object Properties for more information * See Object Properties for more information
@ -3838,14 +3840,14 @@ an itemstring, a table or `nil`.
* `is_known()`: returns `true` if the item name refers to a defined item type. * `is_known()`: returns `true` if the item name refers to a defined item type.
* `get_definition()`: returns the item definition table. * `get_definition()`: returns the item definition table.
* `get_tool_capabilities()`: returns the digging properties of the item, * `get_tool_capabilities()`: returns the digging properties of the item,
or those of the hand if none are defined for this item type or those of the hand if none are defined for this item type
* `add_wear(amount)` * `add_wear(amount)`
* Increases wear by `amount` if the item is a tool * Increases wear by `amount` if the item is a tool
* `amount`: number, integer * `amount`: number, integer
* `add_item(item)`: returns leftover `ItemStack` * `add_item(item)`: returns leftover `ItemStack`
* Put some item or stack onto this stack * Put some item or stack onto this stack
* `item_fits(item)`: returns `true` if item or stack can be fully added to * `item_fits(item)`: returns `true` if item or stack can be fully added to
this one. this one.
* `take_item(n)`: returns taken `ItemStack` * `take_item(n)`: returns taken `ItemStack`
* Take (and remove) up to `n` items from this stack * Take (and remove) up to `n` items from this stack
* `n`: number, default: `1` * `n`: number, default: `1`
@ -3876,8 +3878,8 @@ It can be created via `PcgRandom(seed)` or `PcgRandom(seed, sequence)`.
* `next(min, max)`: return next integer random number [`min`...`max`] * `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`] * `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: * This is only a rough approximation of a normal distribution with:
* `mean = (max - min) / 2`, and * `mean = (max - min) / 2`, and
* `variance = (((max - min + 1) ^ 2) - 1) / (12 * num_trials)` * `variance = (((max - min + 1) ^ 2) - 1) / (12 * num_trials)`
* Increasing `num_trials` improves accuracy of the approximation * Increasing `num_trials` improves accuracy of the approximation
### `SecureRandom` ### `SecureRandom`
@ -4193,10 +4195,10 @@ the object.
It can be created via `Raycast(pos1, pos2, objects, liquids)` or It can be created via `Raycast(pos1, pos2, objects, liquids)` or
`minetest.raycast(pos1, pos2, objects, liquids)` where: `minetest.raycast(pos1, pos2, objects, liquids)` where:
* `pos1`: start of the ray * `pos1`: start of the ray
* `pos2`: end of the ray * `pos2`: end of the ray
* `objects` : if false, only nodes will be returned. Default is true. * `objects` : if false, only nodes will be returned. Default is true.
* `liquids' : if false, liquid nodes won't be returned. Default is false. * `liquids' : if false, liquid nodes won't be returned. Default is false.
#### Methods #### Methods
* `next()`: returns a `pointed_thing` * `next()`: returns a `pointed_thing`
@ -4270,14 +4272,14 @@ Registered entities
* Called when somebody punches the object. * Called when somebody punches the object.
* Note that you probably want to handle most punches using the * Note that you probably want to handle most punches using the
automatic armor group system. automatic armor group system.
* `puncher`: an `ObjectRef` (can be `nil`) * `puncher`: an `ObjectRef` (can be `nil`)
* `time_from_last_punch`: Meant for disallowing spamming of clicks (can be `nil`) * `time_from_last_punch`: Meant for disallowing spamming of clicks (can be `nil`)
* `tool_capabilities`: capability table of used tool (can be `nil`) * `tool_capabilities`: capability table of used tool (can be `nil`)
* `dir`: unit vector of direction of punch. Always defined. Points from * `dir`: unit vector of direction of punch. Always defined. Points from
the puncher to the punched. the puncher to the punched.
* `on_death(self, killer)` * `on_death(self, killer)`
* Called when the object dies. * Called when the object dies.
* `killer`: an `ObjectRef` (can be `nil`) * `killer`: an `ObjectRef` (can be `nil`)
* `on_rightclick(self, clicker)` * `on_rightclick(self, clicker)`
* `get_staticdata(self)` * `get_staticdata(self)`
* Should return a string that will be passed to `on_activate` when * Should return a string that will be passed to `on_activate` when
@ -4583,7 +4585,7 @@ Definition tables
^ default: nil ^ default: nil
^ Function must return either nil if no item shall be removed from ^ Function must return either nil if no item shall be removed from
inventory, or an itemstack to replace the original itemstack. inventory, or an itemstack to replace the original itemstack.
e.g. itemstack:take_item(); return itemstack e.g. itemstack:take_item(); return itemstack
^ Otherwise, the function is free to do what it wants. ^ Otherwise, the function is free to do what it wants.
^ The user may be any ObjectRef or nil. ^ The user may be any ObjectRef or nil.
^ The default functions handle regular use cases. ^ The default functions handle regular use cases.
@ -4619,14 +4621,14 @@ Definition tables
Directions are from the point of view of the tile texture, Directions are from the point of view of the tile texture,
not the node it's on not the node it's on
* align style determines whether the texture will be rotated with the node * align style determines whether the texture will be rotated with the node
or kept aligned with its surroundings. "user" means that client or kept aligned with its surroundings. "user" means that client
setting will be used, similar to `glasslike_framed_optional`. setting will be used, similar to `glasslike_framed_optional`.
Note: supported by solid nodes and nodeboxes only. Note: supported by solid nodes and nodeboxes only.
* scale is used to make texture span several (exactly `scale`) nodes, * scale is used to make texture span several (exactly `scale`) nodes,
instead of just one, in each direction. Works for world-aligned instead of just one, in each direction. Works for world-aligned
textures only. textures only.
Note that as the effect is applied on per-mapblock basis, `16` should Note that as the effect is applied on per-mapblock basis, `16` should
be equally divisible by `scale` or you may get wrong results. be equally divisible by `scale` or you may get wrong results.
* `{name="image.png", color=ColorSpec}` * `{name="image.png", color=ColorSpec}`
* the texture's color will be multiplied with this color. * the texture's color will be multiplied with this color.
* the tile's color overrides the owning node's color in all cases. * the tile's color overrides the owning node's color in all cases.