* More information at <http://www.minetest.net/>
* Developer Wiki: <http://dev.minetest.net/>
+* (Unofficial) Minetest Modding Book by rubenwardy: <https://rubenwardy.com/minetest_modding_book/>
Introduction
------------
--------------
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:
+of the game's nodes are to be used for core mapgen generation. For example:
minetest.register_alias("mapgen_stone", "default:stone")
-### Aliases needed for all mapgens except Mapgen V6
+### Aliases for non-V6 mapgens
-#### Base terrain
+#### Essential aliases
* mapgen_stone
* mapgen_water_source
* mapgen_river_water_source
-#### Caves
+`mapgen_river_water_source` is required for mapgens with sloping rivers where
+it is necessary to have a river liquid node with a short `liquid_range` and
+`liquid_renewable = false` to avoid flooding.
-Not required if cave liquid nodes are set in biome definitions.
+#### Optional aliases
* mapgen_lava_source
-#### Dungeons
-
-Not required if dungeon nodes are set in biome definitions.
+Fallback lava node used if cave liquids are not defined in biome definitions.
+Deprecated for non-V6 mapgens, define cave liquids in biome definitions instead.
* mapgen_cobble
-* mapgen_stair_cobble
-* mapgen_mossycobble
-* mapgen_desert_stone
-* mapgen_stair_desert_stone
-* mapgen_sandstone
-* mapgen_sandstonebrick
-* mapgen_stair_sandstone_block
-### Aliases needed for Mapgen V6
+Fallback node used if dungeon nodes are not defined in biome definitions.
+Deprecated for non-V6 mapgens, define dungeon nodes in biome definitions instead.
-#### Terrain and biomes
+### Aliases needed for Mapgen V6
* mapgen_stone
* mapgen_water_source
* mapgen_snow
* mapgen_ice
-#### Flora
-
* mapgen_tree
* mapgen_leaves
* mapgen_apple
* mapgen_pine_tree
* mapgen_pine_needles
-#### Dungeons
-
* mapgen_cobble
* mapgen_stair_cobble
* mapgen_mossycobble
Special groups
--------------
-* `immortal`: Disables the group damage system for an entity
+* `immortal`: Skips all damage and breath handling for an object. This group
+ will also hide the integrated HUD status bars for players, and is
+ automatically set to all players when damage is disabled on the server.
* `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.
Spaces and newlines can be inserted between the blocks, as is used in the
examples.
-Position and size units are inventory slots, `X` and `Y` position the formspec
-element relative to the top left of the menu or container. `W` and `H` are its
-width and height values.
+Position and size units are inventory slots unless the new coordinate system
+is enabled. `X` and `Y` position the formspec element relative to the top left
+of the menu or container. `W` and `H` are its width and height values.
+
+If the new system is enabled, all elements have unified coordinates for all
+elements with no padding or spacing in between. This is highly recommended
+for new forms. See `real_coordinates[<bool>]` and `Migrating to Real
+Coordinates`.
+
Inventories with a `player:<name>` inventory location are only sent to the
player named `<name>`.
use `minetest.formspec_escape`.
For coloured text you can use `minetest.colorize`.
-WARNING: Minetest allows you to add elements to every single formspec instance
+**WARNING**: do _not_ use a element name starting with `key_`; those names are
+reserved to pass key press events to formspec!
+
+**WARNING**: Minetest allows you to add elements to every single formspec instance
using `player:set_formspec_prepend()`, which may be the reason backgrounds are
-appearing when you don't expect them to. See [`no_prepend[]`].
+appearing when you don't expect them to, or why things are styled differently
+to normal. See [`no_prepend[]`] and [Styling Formspecs].
Examples
--------
* Must be used after the `size`, `position`, and `anchor` elements (if present).
* Disables player:set_formspec_prepend() from applying to this formspec.
+### `real_coordinates[<bool>]`
+
+* When set to true, all following formspec elements will use the new coordinate system.
+* If used immediately after `size`, `position`, `anchor`, and `no_prepend` elements
+ (if present), the form size will use the new coordinate system.
+* **Note**: Formspec prepends are not affected by the coordinates in the main form.
+ They must enable it explicitly.
+* For information on converting forms to the new coordinate system, see `Migrating
+ to Real Coordinates`.
+
### `container[<X>,<Y>]`
* Start of a container block, moves all physical elements in the container by
* Show an inventory list if it has been sent to the client. Nothing will
be shown if the inventory list is of size 0.
+* **Note**: With the new coordinate system, the spacing between inventory
+ slots is one-fourth the size of an inventory slot.
### `list[<inventory location>;<list name>;<X>,<Y>;<W>,<H>;<starting item index>]`
* Show an inventory list if it has been sent to the client. Nothing will
be shown if the inventory list is of size 0.
+* **Note**: With the new coordinate system, the spacing between inventory
+ slots is one-fourth the size of an inventory slot.
### `listring[<inventory location>;<list name>]`
### `background[<X>,<Y>;<W>,<H>;<texture name>]`
-* Use a background. Inventory rectangles are not drawn then.
* Example for formspec 8x4 in 16x resolution: image shall be sized
8 times 16px times 4 times 16px.
### `background[<X>,<Y>;<W>,<H>;<texture name>;<auto_clip>]`
-* Use a background. Inventory rectangles are not drawn then.
+* Example for formspec 8x4 in 16x resolution:
+ image shall be sized 8 times 16px times 4 times 16px
+* If `auto_clip` is `true`, the background is clipped to the formspec size
+ (`x` and `y` are used as offset values, `w` and `h` are ignored)
+
+### `background[<X>,<Y>;<W>,<H>;<texture name>;<auto_clip>;<middle>]`
+
+* 9-sliced background. See https://en.wikipedia.org/wiki/9-slice_scaling
+* Middle is a rect which defines the middle of the 9-slice.
+ * `x` - The middle will be x pixels from all sides.
+ * `x,y` - The middle will be x pixels from the horizontal and y from the vertical.
+ * `x,y,x2,y2` - The middle will start at x,y, and end at x2, y2. Negative x2 and y2 values
+ will be added to the width and height of the texture, allowing it to be used as the
+ distance from the far end.
+ * All numbers in middle are integers.
* Example for formspec 8x4 in 16x resolution:
image shall be sized 8 times 16px times 4 times 16px
* If `auto_clip` is `true`, the background is clipped to the formspec size
* Textual password style 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 of this field.
-* Fields are a set height, but will be vertically centred on `H`
+* With the old coordinate system, fields are a set height, but will be vertically
+ centred on `H`. With the new coordinate system, `H` will modify the height.
* `name` is the name of the field as returned in fields to `on_receive_fields`
* `label`, if not blank, will be text printed on the top left above the field
* See `field_close_on_enter` to stop enter closing the formspec
* 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 of this field.
-* Fields are a set height, but will be vertically centred on `H`
+* With the old coordinate system, fields are a set height, but will be vertically
+ centred on `H`. With the new coordinate system, `H` will modify the height.
* `name` is the name of the field as returned in fields to `on_receive_fields`
* `label`, if not blank, will be text printed on the top left above the field
* `default` is the default value of the field
* The label formspec element displays the text set in `label`
at the specified position.
+* **Note**: If the new coordinate system is enabled, labels are
+ positioned from the center of the text, not the top.
* The text is displayed directly without automatic line breaking,
- so label should not be used for big text chunks.
+ so label should not be used for big text chunks. Newlines can be
+ used to make labels multiline.
+* **Note**: With the new coordinate system, newlines are spaced with
+ half a coordinate. With the old system, newlines are spaced 2/5 of
+ an inventory slot.
### `vertlabel[<X>,<Y>;<label>]`
* Textual label drawn vertically
* `label` is the text on the label
+* **Note**: If the new coordinate system is enabled, vertlabels are
+ positioned from the center of the text, not the left.
### `button[<X>,<Y>;<W>,<H>;<name>;<label>]`
* Clickable button. When clicked, fields will be sent.
-* Fixed button height. It will be vertically centred on `H`
+* With the old coordinate system, buttons are a set height, but will be vertically
+ centred on `H`. With the new coordinate system, `H` will modify the height.
* `label` is the text on the button
### `image_button[<X>,<Y>;<W>,<H>;<texture name>;<name>;<label>]`
* `texture name` is the filename of an image
+* **Note**: Height is supported on both the old and new coordinate systems
+ for image_buttons.
### `image_button[<X>,<Y>;<W>,<H>;<texture name>;<name>;<label>;<noclip>;<drawborder>;<pressed texture name>]`
### `button_exit[<X>,<Y>;<W>,<H>;<name>;<label>]`
* When clicked, fields will be sent and the form will quit.
+* Same as `button` in all other respects.
### `image_button_exit[<X>,<Y>;<W>,<H>;<texture name>;<name>;<label>]`
* When clicked, fields will be sent and the form will quit.
+* Same as `image_button` in all other respects.
### `textlist[<X>,<Y>;<W>,<H>;<name>;<listelem 1>,<listelem 2>,...,<listelem n>]`
### `tabheader[<X>,<Y>;<name>;<caption 1>,<caption 2>,...,<caption n>;<current_tab>;<transparent>;<draw_border>]`
* Show a tab**header** at specific position (ignores formsize)
+* `X` and `Y`: position of the tabheader
+* *Note*: Width and height are automatically chosen with this syntax
+* `name` fieldname data is transferred to Lua
+* `caption 1`...: name shown on top of tab
+* `current_tab`: index of selected tab 1...
+* `transparent` (optional): show transparent
+* `draw_border` (optional): draw border
+
+### `tabheader[<X>,<Y>;<H>;<name>;<caption 1>,<caption 2>,...,<caption n>;<current_tab>;<transparent>;<draw_border>]`
+
+* Show a tab**header** at specific position (ignores formsize)
+* **Important note**: This syntax for tabheaders can only be used with the
+ new coordinate system.
+* `X` and `Y`: position of the tabheader
+* `H`: height of the tabheader. Width is automatically determined with this syntax.
+* `name` fieldname data is transferred to Lua
+* `caption 1`...: name shown on top of tab
+* `current_tab`: index of selected tab 1...
+* `transparent` (optional): show transparent
+* `draw_border` (optional): draw border
+
+### `tabheader[<X>,<Y>;<W>,<H>;<name>;<caption 1>,<caption 2>,...,<caption n>;<current_tab>;<transparent>;<draw_border>]`
+
+* Show a tab**header** at specific position (ignores formsize)
+* **Important note**: This syntax for tabheaders can only be used with the
+ new coordinate system.
+* `X` and `Y`: position of the tabheader
+* `W` and `H`: width and height of the tabheader
* `name` fieldname data is transferred to Lua
* `caption 1`...: name shown on top of tab
* `current_tab`: index of selected tab 1...
* **Important note**: There are two different operation modes:
1. handle directly on change (only changed dropdown is submitted)
2. read the value on pressing a button (all dropdown values are available)
-* `x` and `y` position of dropdown
-* Width of dropdown
+* `X` and `Y`: position of the dropdown
+* `W`: width of the dropdown. Height is automatically chosen with this syntax.
+* Fieldname data is transferred to Lua
+* Items to be shown in dropdown
+* Index of currently selected dropdown item
+
+### `dropdown[<X>,<Y>;<W>,<H>;<name>;<item 1>,<item 2>, ...,<item n>;<selected idx>]`
+
+* Show a dropdown field
+* **Important note**: This syntax for dropdowns can only be used with the
+ new coordinate system.
+* **Important note**: There are two different operation modes:
+ 1. handle directly on change (only changed dropdown is submitted)
+ 2. read the value on pressing a button (all dropdown values are available)
+* `X` and `Y`: position of the dropdown
+* `W` and `H`: width and height of the dropdown
* Fieldname data is transferred to Lua
* Items to be shown in dropdown
* Index of currently selected dropdown item
* `name` fieldname data is transferred to Lua
* `label` to be shown left of checkbox
* `selected` (optional): `true`/`false`
+* **Note**: If the new coordinate system is enabled, checkboxes are
+ positioned from the center of the checkbox, not the top.
### `scrollbar[<X>,<Y>;<W>,<H>;<orientation>;<name>;<value>]`
* `span=<value>`: number of following columns to affect
(default: infinite).
-**Note**: do _not_ use a element name starting with `key_`; those names are
-reserved to pass key press events to formspec!
+### `style[<name>;<prop1>;<prop2>;...]`
+
+* Set the style for the named element `name`.
+* Note: this **must** be before the element is defined.
+* See [Styling Formspecs].
+### `style_type[<type>;<prop1>;<prop2>;...]`
+* Sets the style for all elements of type `type` which appear after this element.
+* See [Styling Formspecs].
+
+Migrating to Real Coordinates
+-----------------------------
+
+In the old system, positions included padding and spacing. Padding is a gap between
+the formspec window edges and content, and spacing is the gaps between items. For
+example, two `1x1` elements at `0,0` and `1,1` would have a spacing of `5/4` between them,
+and a padding of `3/8` from the formspec edge. It may be easiest to recreate old layouts
+in the new coordinate system from scratch.
+
+To recreate an old layout with padding, you'll need to pass the positions and sizes
+through the following formula to re-introduce padding:
+
+```
+pos = (oldpos + 1)*spacing + padding
+where
+ padding = 3/8
+ spacing = 5/4
+```
+
+You'll need to change the `size[]` tag like this:
+
+```
+size = (oldsize-1)*spacing + padding*2 + 1
+```
+
+A few elements had random offsets in the old system. Here is a table which shows these
+offsets when migrating:
+
+| Element | Position | Size | Notes
+|---------|------------|---------|-------
+| box | +0.3, +0.1 | 0, -0.4 |
+| button | | | Buttons now support height, so set h = 2 * 15/13 * 0.35, and reposition if h ~= 15/13 * 0.35 before
+| list | | | Spacing is now 0.25 for both directions, meaning lists will be taller in height
+| label | 0, +0.3 | | The first line of text is now positioned centered exactly at the position specified
+
+Styling Formspecs
+-----------------
+
+Formspec elements can be themed using the style elements:
+
+ style[<name>;<prop1>;<prop2>;...]
+ style_type[<type>;<prop1>;<prop2>;...]
+
+Where a prop is:
+
+ property_name=property_value
+
+For example:
+
+ style_type[button;bgcolor=#006699]
+ style[world_delete;bgcolor=red;textcolor=yellow]
+ button[4,3.95;2.6,1;world_delete;Delete]
+
+Setting a property to nothing will reset it to the default value. For example:
+
+ style_type[button;bgimg=button.png;bgimg_pressed=button_pressed.png;border=false]
+ style[btn_exit;bgimg=;bgimg_pressed=;border=;bgcolor=red]
+
+
+### Supported Element Types
+
+Some types may inherit styles from parent types.
+
+* button
+* button_exit, inherits from button
+* checkbox
+* scrollbar
+* table
+* textlist
+* dropdown
+* field
+* pwdfield, inherits from field
+* textarea
+* label
+* vertlabel, inherits from field
+* image_button
+* item_image_button, inherits from image_button
+* tabheader
+
+
+### Valid Properties
+
+* button, button_exit
+ * alpha - boolean, whether to draw alpha in bgimg. Default true.
+ * bgcolor - color, sets button tint.
+ * bgimg - standard image. Defaults to none.
+ * bgimg_pressed - image when pressed. Defaults to bgimg when not provided.
+ * border - boolean, draw border. Set to false to hide the bevelled button pane. Default true.
+ * noclip - boolean, set to true to allow the element to exceed formspec bounds.
+ * textcolor - color, default white.
+* checkbox
+ * noclip - boolean, set to true to allow the element to exceed formspec bounds.
+* scrollbar
+ * noclip - boolean, set to true to allow the element to exceed formspec bounds.
+* table, textlist
+ * noclip - boolean, set to true to allow the element to exceed formspec bounds.
+* dropdown
+ * noclip - boolean, set to true to allow the element to exceed formspec bounds.
+* field, pwdfield, textarea
+ * border - set to false to hide the textbox background and border. Default true.
+ * noclip - boolean, set to true to allow the element to exceed formspec bounds.
+ * textcolor - color. Default white.
+* label, vertlabel
+ * noclip - boolean, set to true to allow the element to exceed formspec bounds.
+* image_button
+ * alpha - boolean, whether to draw alpha in bgimg. Default true.
+ * border - boolean, draw border. Set to false to hide the bevelled button pane. Default false.
+ * noclip - boolean, set to true to allow the element to exceed formspec bounds.
+* item_image_button
+ * border - boolean, draw border. Set to false to hide the bevelled button pane. Default false.
+ * noclip - boolean, set to true to allow the element to exceed formspec bounds.
+* tabheader
+ * noclip - boolean, set to true to allow the element to exceed formspec bounds.
+ * textcolor - color. Default white.
Inventory
=========
* Returns in order minp, maxp vectors of the cuboid defined by `v1`, `v2`.
* `vector.angle(v1, v2)`:
* Returns the angle between `v1` and `v2` in radians.
+* `vector.dot(v1, v2)`
+ * Returns the dot product of `v1` and `v2`
+* `vector.cross(v1, v2)`
+ * Returns the cross product of `v1` and `v2`
For the following functions `x` can be either a vector or a number:
* `decoration`
Decorations have a key in the format of `"decoration#id"`, where `id` is the
-numeric unique decoration ID.
+numeric unique decoration ID as returned by `minetest.get_decoration_id`.
-- Chat messages are no longer predicted (0.4.16)
no_chat_message_prediction = true,
-- The transparency channel of textures can optionally be used on
- -- objects (ie: players and lua entities) (5.0)
+ -- objects (ie: players and lua entities) (5.0.0)
object_use_texture_alpha = true,
-- Object selectionbox is settable independently from collisionbox
- -- (5.0)
+ -- (5.0.0)
object_independent_selectionbox = true,
+ -- Specifies whether binary data can be uploaded or downloaded using
+ -- the HTTP API (5.1.0)
+ httpfetch_binary_data = true,
}
* `minetest.has_feature(arg)`: returns `boolean, missing_features`
mapgens. See [Mapgen aliases] section above.
* `minetest.register_alias_force(alias, original_name)`
* `minetest.register_ore(ore definition)`
- * Returns an integer uniquely identifying the registered ore on success.
+ * Returns an integer object handle uniquely identifying the registered
+ ore on success.
* The order of ore registrations determines the order of ore generation.
* `minetest.register_biome(biome definition)`
- * Returns an integer uniquely identifying the registered biome on success.
+ * Returns an integer object handle uniquely identifying the registered
+ biome on success. To get the biome ID, use `minetest.get_biome_id`.
* `minetest.unregister_biome(name)`
* Unregisters the biome from the engine, and deletes the entry with key
`name` from `minetest.registered_biomes`.
* `minetest.register_decoration(decoration definition)`
- * Returns an integer uniquely identifying the registered decoration on
- success.
+ * Returns an integer object handle uniquely identifying the registered
+ decoration on success. To get the decoration ID, use
+ `minetest.get_decoration_id`.
* The order of decoration registrations determines the order of decoration
generation.
* `minetest.register_schematic(schematic definition)`
- * Returns an integer uniquely identifying the registered schematic on
- success.
+ * Returns an integer object handle uniquely identifying the registered
+ schematic on success.
* If the schematic is loaded from a file, the `name` field is set to the
filename.
* If the function is called when loading the mod, and `name` is a relative
* `minetest.chat_send_all(text)`
* `minetest.chat_send_player(name, text)`
+* `minetest.format_chat_message(name, message)`
+ * Used by the server to format a chat message, based on the setting `chat_message_format`.
+ Refer to the documentation of the setting for a list of valid placeholders.
+ * Takes player name and message, and returns the formatted string to be sent to players.
+ * Can be redefined by mods if required, for things like colored names or messages.
+ * **Only** the first occurrence of each placeholder will be replaced.
Environment access
------------------
the Lua code generated will use that number of spaces as indentation
instead of a tab character.
+* `minetest.read_schematic(schematic, options)`
+ * Returns a Lua table representing the schematic (see: [Schematic specifier])
+ * `schematic` is the schematic to read (see: [Schematic specifier])
+ * `options` is a table containing the following optional parameters:
+ * `write_yslice_prob`: string value:
+ * `none`: no `write_yslice_prob` table is inserted,
+ * `low`: only probabilities that are not 254 or 255 are written in
+ the `write_ylisce_prob` table,
+ * `all`: write all probabilities to the `write_yslice_prob` table.
+ * The default for this option is `all`.
+ * Any invalid value will be interpreted as `all`.
+
HTTP Requests
-------------
* `minetest.decode_base64(string)`: returns string
* Decodes a string encoded in base64.
* `minetest.is_protected(pos, name)`: returns boolean
- * Returns true, if player `name` shouldn't be able to dig at `pos` or do
- other actions, definable 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 protected by the mod.
+ * Returning `true` restricts the player `name` from modifying (i.e. digging,
+ placing) the node at position `pos`.
+ * `name` will be `""` for non-players or unknown players.
+ * This function should be overridden by protection mods. It is highly
+ recommended to grant access to players with the `protection_bypass` privilege.
+ * Cache and call the old version of this function if the position is
+ not protected by the mod. This will allow using multiple protection mods.
* Example:
local old_is_protected = minetest.is_protected
of the creative mode setting, checks for "sneak" to set the `invert_wall`
parameter and `prevent_after_place` set to `true`.
+* `minetest.calculate_knockback(player, hitter, time_from_last_punch,
+ tool_capabilities, dir, distance, damage)`
+ * Returns the amount of knockback applied on the punched player.
+ * Arguments are equivalent to `register_on_punchplayer`, except the following:
+ * `distance`: distance between puncher and punched player
+ * This function can be overriden by mods that wish to modify this behaviour.
+ * You may want to cache and call the old function to allow multiple mods to
+ change knockback behaviour.
+
* `minetest.forceload_block(pos[, transient])`
* forceloads the position `pos`.
* returns `true` if area could be forceloaded
* Map of registered aliases, indexed by name
* `minetest.registered_ores`
* Map of registered ore definitions, indexed by the `name` field.
- * If `name` is nil, the key is the ID returned by `minetest.register_ore`.
+ * If `name` is nil, the key is the object handle returned by
+ `minetest.register_ore`.
* `minetest.registered_biomes`
* Map of registered biome definitions, indexed by the `name` field.
- * If `name` is nil, the key is the ID returned by `minetest.register_biome`.
+ * If `name` is nil, the key is the object handle returned by
+ `minetest.register_biome`.
* `minetest.registered_decorations`
* Map of registered decoration definitions, indexed by the `name` field.
- * If `name` is nil, the key is the ID returned by
+ * If `name` is nil, the key is the object handle returned by
`minetest.register_decoration`.
* `minetest.registered_schematics`
* Map of registered schematic definitions, indexed by the `name` field.
- * If `name` is nil, the key is the ID returned by
+ * If `name` is nil, the key is the object handle returned by
`minetest.register_schematic`.
* `minetest.registered_chatcommands`
* Map of registered chat command definitions, indexed by name
### Methods
-* `remove()`: remove object (after returning from Lua)
- * 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
text = "My Nametag",
}
-#### LuaEntitySAO-only (no-op for other objects)
+#### Lua entity only (no-op for other objects)
+* `remove()`: remove object (after returning from Lua)
* `set_velocity(vel)`
* `vel` is a vector, e.g. `{x=0.0, y=2.3, z=1.0}`
* `add_velocity(vel)`
* `get_entity_name()` (**Deprecated**: Will be removed in a future version)
* `get_luaentity()`
-#### Player-only (no-op for other objects)
+#### Player only (no-op for other objects)
* `get_player_name()`: returns `""` if is not a player
* `get_player_velocity()`: returns `nil` if is not a player, otherwise a
table {x, y, z} representing the player's instantaneous velocity in nodes/s
+* `add_player_velocity(vel)`
+ * Adds to player velocity, this happens client-side and only once.
+ * Does not apply during free_move.
+ * Note that since the player speed is normalized at each move step,
+ increasing e.g. Y velocity beyond what would usually be achieved
+ (see: physics overrides) will cause existing X/Z velocity to be reduced.
+ * Example: `add_player_velocity({x=0, y=6.5, z=0})` is equivalent to
+ pressing the jump key (assuming default settings)
* `get_look_dir()`: get camera direction as a unit vector
* `get_look_vertical()`: pitch in radians
* Angle ranges between -pi/2 and pi/2, which are straight up and down
-- "mesh" uses the defined mesh model.
-- "wielditem" is used for dropped items.
-- (see builtin/game/item_entity.lua).
- -- For this use 'textures = {itemname}'.
+ -- For this use 'wield_item = itemname' (Deprecated: 'textures = {itemname}').
-- If the item has a 'wield_image' the object will be an extrusion of
-- that, otherwise:
-- If 'itemname' is a cubic node or nodebox the object will appear
-- of its texture.
-- Otherwise for non-node items, the object will be an extrusion of
-- 'inventory_image'.
+ -- If 'itemname' contains a ColorString or palette index (e.g. from
+ -- `minetest.itemstring_with_palette()`), the entity will inherit the color.
-- "item" is similar to "wielditem" but ignores the 'wield_image' parameter.
visual_size = {x = 1, y = 1, z = 1},
depth_riverbed = 2,
-- Node placed under river water and thickness of this layer
- node_cave_liquid = "default:water_source",
- -- Nodes placed as a blob of liquid in 50% of large caves.
- -- If absent, cave liquids fall back to classic behaviour of lava or
- -- water distributed according to a hardcoded 3D noise.
+ node_cave_liquid = "default:lava_source",
+ node_cave_liquid = {"default:water_source", "default:lava_source"},
+ -- Nodes placed inside 50% of the medium size caves.
+ -- Multiple nodes can be specified, each cave will use a randomly
+ -- chosen node from the list.
+ -- If this field is left out or 'nil', cave liquids fall back to
+ -- classic behaviour of lava and water distributed using 3D noise.
+ -- For no cave liquid, specify "air".
node_dungeon = "default:cobble",
-- Node used for primary dungeon structure.
- -- If absent, dungeon materials fall back to classic behaviour.
+ -- If absent, dungeon nodes fall back to the 'mapgen_cobble' mapgen
+ -- alias, if that is also absent, dungeon nodes fall back to the biome
+ -- 'node_stone'.
-- If present, the following two nodes are also used.
node_dungeon_alt = "default:mossycobble",