mirror of
https://github.com/luanti-org/luanti.git
synced 2025-11-06 10:15:19 +01:00
Try to fix list indentation
This commit is contained in:
@@ -10,12 +10,12 @@ This list is largely advisory and items may be reevaluated once the time comes.
|
||||
* `game.conf` name/id mess
|
||||
* Remove `depends.txt` / `description.txt` (would simplify ContentDB and Minetest code a little)
|
||||
* Rotate moon texture by 180°, making it coherent with the sun
|
||||
* https://github.com/minetest/minetest/pull/11902
|
||||
* https://github.com/minetest/minetest/pull/11902
|
||||
* Remove undocumented `set_physics_override(num, num, num)`
|
||||
* Remove special handling of `${key}` syntax in metadata values
|
||||
* Remove `old_move`
|
||||
* Change physics_override `sneak` to disable the speed change and not just the node clipping
|
||||
* https://github.com/minetest/minetest/issues/13699
|
||||
* https://github.com/minetest/minetest/issues/13699
|
||||
* Migrate from player names to UUIDs, this would enable renaming of accounts and unicode player names (if desired)
|
||||
* Harmonize `use_texture_alpha` between entities & nodes, change default to 'opaque' and remove bool compat code
|
||||
* Merge `sound` and `sounds` table in itemdef
|
||||
|
||||
@@ -298,8 +298,8 @@ Refer to `lua_api.md`.
|
||||
contained in your mod:
|
||||
e.g. `dofile(minetest.get_modpath(minetest.get_current_modname()) .. "stuff.lua")`
|
||||
* `minetest.get_language()`: returns two strings
|
||||
* the current gettext locale
|
||||
* the current language code (the same as used for client-side translations)
|
||||
* the current gettext locale
|
||||
* the current language code (the same as used for client-side translations)
|
||||
* `minetest.get_version()`: returns a table containing components of the
|
||||
engine version. Components:
|
||||
* `project`: Name of the project, eg, "Minetest"
|
||||
@@ -319,8 +319,8 @@ Refer to `lua_api.md`.
|
||||
* `colorspec`: The ColorSpec to convert
|
||||
* `minetest.get_csm_restrictions()`: returns a table of `Flags` indicating the
|
||||
restrictions applied to the current mod.
|
||||
* If a flag in this table is set to true, the feature is RESTRICTED.
|
||||
* Possible flags: `load_client_mods`, `chat_messages`, `read_itemdefs`,
|
||||
* If a flag in this table is set to true, the feature is RESTRICTED.
|
||||
* Possible flags: `load_client_mods`, `chat_messages`, `read_itemdefs`,
|
||||
`read_nodedefs`, `lookup_nodes`, `read_playerinfo`
|
||||
* `minetest.urlencode(str)`: Encodes non-unreserved URI characters by a
|
||||
percent sign followed by two hex digits. See
|
||||
|
||||
185
doc/lua_api.md
185
doc/lua_api.md
@@ -1755,10 +1755,10 @@ Displays an image oriented or translated according to current heading direction.
|
||||
* `alignment`: The alignment of the image.
|
||||
* `offset`: Offset in pixels from position.
|
||||
* `direction`: How the image is rotated/translated:
|
||||
* 0 - Rotate as heading direction
|
||||
* 1 - Rotate in reverse direction
|
||||
* 2 - Translate as landscape direction
|
||||
* 3 - Translate in reverse direction
|
||||
* 0 - Rotate as heading direction
|
||||
* 1 - Rotate in reverse direction
|
||||
* 2 - Translate as landscape direction
|
||||
* 3 - Translate in reverse direction
|
||||
|
||||
If translation is chosen, texture is repeated horizontally to fill the whole element.
|
||||
|
||||
@@ -1924,12 +1924,12 @@ Examples:
|
||||
* `"default:pick_stone"`: a new stone pickaxe
|
||||
* `"default:pick_wood 1 21323"`: a wooden pickaxe, ca. 1/3 worn out
|
||||
* `[[default:pick_wood 1 21323 "\u0001description\u0002My worn out pick\u0003"]]`:
|
||||
* a wooden pickaxe from the `default` mod,
|
||||
* amount must be 1 (pickaxe is a tool), ca. 1/3 worn out (it's a tool),
|
||||
* with the `description` field set to `"My worn out pick"` in its metadata
|
||||
* a wooden pickaxe from the `default` mod,
|
||||
* amount must be 1 (pickaxe is a tool), ca. 1/3 worn out (it's a tool),
|
||||
* with the `description` field set to `"My worn out pick"` in its metadata
|
||||
* `[[default:dirt 5 0 "\u0001description\u0002Special dirt\u0003"]]`:
|
||||
* analogous to the above example
|
||||
* note how the wear is set to `0` as dirt is not a tool
|
||||
* analogous to the above example
|
||||
* note how the wear is set to `0` as dirt is not a tool
|
||||
|
||||
You should ideally use the `ItemStack` format to build complex item strings
|
||||
(especially if they use item metadata)
|
||||
@@ -2123,8 +2123,8 @@ to games.
|
||||
```lua
|
||||
damage =
|
||||
collision speed
|
||||
* ((node_fall_damage_add_percent + 100) / 100) -- node group
|
||||
* ((player_fall_damage_add_percent + 100) / 100) -- player armor group
|
||||
* ((node_fall_damage_add_percent + 100) / 100) -- node group
|
||||
* ((player_fall_damage_add_percent + 100) / 100) -- player armor group
|
||||
- (14) -- constant tolerance
|
||||
```
|
||||
Negative damage values are discarded as no damage.
|
||||
@@ -2347,8 +2347,8 @@ for group in cap.damage_groups do
|
||||
armor = object.armor_groups[group] or 0
|
||||
damage = damage
|
||||
+ cap.damage_groups[group]
|
||||
* limit(actual_interval / cap.full_punch_interval, 0.0, 1.0)
|
||||
* (armor / 100.0)
|
||||
* limit(actual_interval / cap.full_punch_interval, 0.0, 1.0)
|
||||
* (armor / 100.0)
|
||||
end
|
||||
return damage
|
||||
```
|
||||
@@ -2588,24 +2588,24 @@ background elements are drawn before all other elements.
|
||||
## Version History
|
||||
|
||||
* Formspec version 1 (pre-5.1.0):
|
||||
* (too much)
|
||||
* (too much)
|
||||
* Formspec version 2 (5.1.0):
|
||||
* Forced real coordinates
|
||||
* `background9[]`: 9-slice scaling parameters
|
||||
* Forced real coordinates
|
||||
* `background9[]`: 9-slice scaling parameters
|
||||
* Formspec version 3 (5.2.0):
|
||||
* Formspec elements are drawn in the order of definition
|
||||
* `bgcolor[]`: use 3 parameters (`bgcolor`, `formspec` (now an enum), `fbgcolor`)
|
||||
* `box[]` and `image[]` elements enable clipping by default
|
||||
* new element: `scroll_container[]`
|
||||
* Formspec elements are drawn in the order of definition
|
||||
* `bgcolor[]`: use 3 parameters (`bgcolor`, `formspec` (now an enum), `fbgcolor`)
|
||||
* `box[]` and `image[]` elements enable clipping by default
|
||||
* new element: `scroll_container[]`
|
||||
* Formspec version 4 (5.4.0):
|
||||
* Allow dropdown indexing events
|
||||
* Allow dropdown indexing events
|
||||
* Formspec version 5 (5.5.0):
|
||||
* Added `padding[]` element
|
||||
* Added `padding[]` element
|
||||
* Formspec version 6 (5.6.0):
|
||||
* Add nine-slice images, `animated_image`, and `fgimg_middle`
|
||||
* Add nine-slice images, `animated_image`, and `fgimg_middle`
|
||||
* Formspec version 7 (5.8.0):
|
||||
* `style[]`: Add focused state for buttons
|
||||
* Add `field_enter_after_edit[]` (experimental)
|
||||
* `style[]`: Add focused state for buttons
|
||||
* Add `field_enter_after_edit[]` (experimental)
|
||||
|
||||
## Elements
|
||||
|
||||
@@ -2692,10 +2692,10 @@ background elements are drawn before all other elements.
|
||||
### `scroll_container[<X>,<Y>;<W>,<H>;<scrollbar name>;<orientation>;<scroll factor>]`
|
||||
|
||||
* Start of a scroll_container block. All contained elements will:
|
||||
* Take the scroll_container coordinate as position origin,
|
||||
* Be additionally moved by the current value of the scrollbar with the name
|
||||
* Take the scroll_container coordinate as position origin,
|
||||
* Be additionally moved by the current value of the scrollbar with the name
|
||||
`scrollbar name` times `scroll factor` along the orientation `orientation` and
|
||||
* Be clipped to the rectangle defined by `X`, `Y`, `W` and `H`.
|
||||
* Be clipped to the rectangle defined by `X`, `Y`, `W` and `H`.
|
||||
* `orientation`: possible values are `vertical` and `horizontal`.
|
||||
* `scroll factor`: optional, defaults to `0.1`.
|
||||
* Nesting is possible.
|
||||
@@ -2817,10 +2817,10 @@ background elements are drawn before all other elements.
|
||||
* `bgcolor` and `fbgcolor` (optional) are `ColorString`s, they define the color
|
||||
of the non-fullscreen and the fullscreen background.
|
||||
* `fullscreen` (optional) can be one of the following:
|
||||
* `false`: Default, only the non-fullscreen background color is drawn.
|
||||
* `true`: Only the fullscreen background color is drawn.
|
||||
* `both`: The non-fullscreen and the fullscreen background color are drawn.
|
||||
* `neither`: No background color is drawn.
|
||||
* `false`: Default, only the non-fullscreen background color is drawn.
|
||||
* `true`: Only the fullscreen background color is drawn.
|
||||
* `both`: The non-fullscreen and the fullscreen background color are drawn.
|
||||
* `neither`: No background color is drawn.
|
||||
* Note: Leave a parameter empty to not modify the value.
|
||||
* Note: `fbgcolor`, leaving parameters empty and values for `fullscreen` that
|
||||
are not bools are only available since formspec version 3.
|
||||
@@ -3358,17 +3358,17 @@ Some types may inherit styles from parent types.
|
||||
* `bgimg_pressed` - background image when pressed. Defaults to `bgimg` when not provided.
|
||||
* This is deprecated, use states instead.
|
||||
* `font` - Sets font type. This is a comma separated list of options. Valid options:
|
||||
* Main font type options. These cannot be combined with each other:
|
||||
* Main font type options. These cannot be combined with each other:
|
||||
* `normal`: Default font
|
||||
* `mono`: Monospaced font
|
||||
* Font modification options. If used without a main font type, `normal` is used:
|
||||
* Font modification options. If used without a main font type, `normal` is used:
|
||||
* `bold`: Makes font bold.
|
||||
* `italic`: Makes font italic.
|
||||
Default `normal`.
|
||||
* `font_size` - Sets font size. Default is user-set. Can have multiple values:
|
||||
* `<number>`: Sets absolute font size to `number`.
|
||||
* `+<number>`/`-<number>`: Offsets default font size by `number` points.
|
||||
* `*<number>`: Multiplies default font size by `number`, similar to CSS `em`.
|
||||
* `<number>`: Sets absolute font size to `number`.
|
||||
* `+<number>`/`-<number>`: Offsets default font size by `number` points.
|
||||
* `*<number>`: Multiplies default font size by `number`, similar to CSS `em`.
|
||||
* `border` - boolean, draw border. Set to `false` to hide the bevelled button pane. Default `true`.
|
||||
* `content_offset` - 2d vector, shifts the position of the button's content without resizing it.
|
||||
* `noclip` - boolean, set to true to allow the element to exceed formspec bounds.
|
||||
@@ -5045,49 +5045,46 @@ and `minetest.register_on_priv_revoke` functions.
|
||||
Minetest includes a set of built-in privileges that control capabilities
|
||||
provided by the Minetest engine and can be used by mods:
|
||||
|
||||
* Basic privileges are normally granted to all players:
|
||||
* `shout`: can communicate using the in-game chat.
|
||||
* `interact`: can modify the world by digging, building and interacting
|
||||
with the nodes, entities and other players. Players without the `interact`
|
||||
privilege can only travel and observe the world.
|
||||
|
||||
* Advanced privileges allow bypassing certain aspects of the gameplay:
|
||||
* `fast`: can use "fast mode" to move with maximum speed.
|
||||
* `fly`: can use "fly mode" to move freely above the ground without falling.
|
||||
* `noclip`: can use "noclip mode" to fly through solid nodes (e.g. walls).
|
||||
* `teleport`: can use `/teleport` command to move to any point in the world.
|
||||
* `creative`: can access creative inventory.
|
||||
* `bring`: can teleport other players to oneself.
|
||||
* `give`: can use `/give` and `/giveme` commands to give any item
|
||||
in the game to oneself or others.
|
||||
* `settime`: can use `/time` command to change current in-game time.
|
||||
* `debug`: can enable wireframe rendering mode.
|
||||
|
||||
* Security-related privileges:
|
||||
* `privs`: can modify privileges of the players using `/grant[me]` and
|
||||
`/revoke[me]` commands.
|
||||
* `basic_privs`: can grant and revoke basic privileges as defined by
|
||||
the `basic_privs` setting.
|
||||
* `kick`: can kick other players from the server using `/kick` command.
|
||||
* `ban`: can ban other players using `/ban` command.
|
||||
* `password`: can use `/setpassword` and `/clearpassword` commands
|
||||
to manage players' passwords.
|
||||
* `protection_bypass`: can bypass node protection. Note that the engine does not act upon this privilege,
|
||||
it is only an implementation suggestion for games.
|
||||
|
||||
* Administrative privileges:
|
||||
* `server`: can use `/fixlight`, `/deleteblocks` and `/deleteobjects`
|
||||
commands. Can clear inventory of other players using `/clearinv` command.
|
||||
* `rollback`: can use `/rollback_check` and `/rollback` commands.
|
||||
* Basic privileges are normally granted to all players:
|
||||
* `shout`: can communicate using the in-game chat.
|
||||
* `interact`: can modify the world by digging, building and interacting
|
||||
with the nodes, entities and other players. Players without the `interact`
|
||||
privilege can only travel and observe the world.
|
||||
* Advanced privileges allow bypassing certain aspects of the gameplay:
|
||||
* `fast`: can use "fast mode" to move with maximum speed.
|
||||
* `fly`: can use "fly mode" to move freely above the ground without falling.
|
||||
* `noclip`: can use "noclip mode" to fly through solid nodes (e.g. walls).
|
||||
* `teleport`: can use `/teleport` command to move to any point in the world.
|
||||
* `creative`: can access creative inventory.
|
||||
* `bring`: can teleport other players to oneself.
|
||||
* `give`: can use `/give` and `/giveme` commands to give any item
|
||||
in the game to oneself or others.
|
||||
* `settime`: can use `/time` command to change current in-game time.
|
||||
* `debug`: can enable wireframe rendering mode.
|
||||
* Security-related privileges:
|
||||
* `privs`: can modify privileges of the players using `/grant[me]` and
|
||||
`/revoke[me]` commands.
|
||||
* `basic_privs`: can grant and revoke basic privileges as defined by
|
||||
the `basic_privs` setting.
|
||||
* `kick`: can kick other players from the server using `/kick` command.
|
||||
* `ban`: can ban other players using `/ban` command.
|
||||
* `password`: can use `/setpassword` and `/clearpassword` commands
|
||||
to manage players' passwords.
|
||||
* `protection_bypass`: can bypass node protection. Note that the engine does not act upon this privilege,
|
||||
it is only an implementation suggestion for games.
|
||||
* Administrative privileges:
|
||||
* `server`: can use `/fixlight`, `/deleteblocks` and `/deleteobjects`
|
||||
commands. Can clear inventory of other players using `/clearinv` command.
|
||||
* `rollback`: can use `/rollback_check` and `/rollback` commands.
|
||||
|
||||
## Related Settings
|
||||
|
||||
Minetest includes the following settings to control behavior of privileges:
|
||||
|
||||
* `default_privs`: defines privileges granted to new players.
|
||||
* `basic_privs`: defines privileges that can be granted/revoked by players having
|
||||
the `basic_privs` privilege. This can be used, for example, to give
|
||||
limited moderation powers to selected users.
|
||||
* `default_privs`: defines privileges granted to new players.
|
||||
* `basic_privs`: defines privileges that can be granted/revoked by players having
|
||||
the `basic_privs` privilege. This can be used, for example, to give
|
||||
limited moderation powers to selected users.
|
||||
|
||||
|
||||
|
||||
@@ -5337,7 +5334,7 @@ Minetest includes the following settings to control behavior of privileges:
|
||||
* `colorspec`: The ColorSpec to convert
|
||||
* `minetest.colorspec_to_bytes(colorspec)`: Converts a ColorSpec to a raw
|
||||
string of four bytes in an RGBA layout, returned as a string.
|
||||
* `colorspec`: The ColorSpec to convert
|
||||
* `colorspec`: The ColorSpec to convert
|
||||
* `minetest.encode_png(width, height, data, [compression])`: Encode a PNG
|
||||
image and return it in string form.
|
||||
* `width`: Width of the image
|
||||
@@ -6162,7 +6159,7 @@ You can find mod channels communication scheme in `doc/mod_channels.png`.
|
||||
expression.
|
||||
* to close a formspec regardless of the formname, call
|
||||
`minetest.close_formspec(playername, "")`.
|
||||
**USE THIS ONLY WHEN ABSOLUTELY NECESSARY!**
|
||||
**USE THIS ONLY WHEN ABSOLUTELY NECESSARY!**
|
||||
* `minetest.formspec_escape(string)`: returns a string
|
||||
* escapes the characters "[", "]", "\", "," and ";", which cannot be used
|
||||
in formspecs.
|
||||
@@ -6314,7 +6311,7 @@ You can find mod channels communication scheme in `doc/mod_channels.png`.
|
||||
* `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, position`
|
||||
* `position`: the location the node was placed to. `nil` if nothing was placed.
|
||||
* `position`: the location the node was placed to. `nil` if nothing was placed.
|
||||
* `minetest.item_place_object(itemstack, placer, pointed_thing)`
|
||||
* Place item as-is
|
||||
* returns the leftover itemstack
|
||||
@@ -6325,7 +6322,7 @@ You can find mod channels communication scheme in `doc/mod_channels.png`.
|
||||
* Calls `on_rightclick` of `pointed_thing.under` if defined instead
|
||||
* `param2` overrides facedir and wallmounted `param2`
|
||||
* returns `itemstack, position`
|
||||
* `position`: the location the node was placed to. `nil` if nothing was placed.
|
||||
* `position`: the location the node was placed to. `nil` if nothing was placed.
|
||||
> [!NOTE]
|
||||
> `on_rightclick` is not called when wielded item overrides `on_place`
|
||||
* `minetest.item_pickup(itemstack, picker, pointed_thing, time_from_last_punch, ...)`
|
||||
@@ -6485,12 +6482,12 @@ Variables:
|
||||
* The given callback will be called for every player as soon as the
|
||||
media is available on the client.
|
||||
* Details/Notes:
|
||||
* If `ephemeral`=false and `to_player` is unset the file is added to the media
|
||||
* If `ephemeral`=false and `to_player` is unset the file is added to the media
|
||||
sent to clients on startup, this means the media will appear even on
|
||||
old clients if they rejoin the server.
|
||||
* If `ephemeral`=false the file must not be modified, deleted, moved or
|
||||
* If `ephemeral`=false the file must not be modified, deleted, moved or
|
||||
renamed after calling this function.
|
||||
* Regardless of any use of `ephemeral`, adding media files with the same
|
||||
* Regardless of any use of `ephemeral`, adding media files with the same
|
||||
name twice is not possible/guaranteed to work. An exception to this is the
|
||||
use of `to_player` to send the same, already existent file to multiple
|
||||
chosen players.
|
||||
@@ -7931,13 +7928,13 @@ child will follow movement and rotation of that bone.
|
||||
* `set_lighting(light_definition)`: sets lighting for the player
|
||||
* Passing no arguments resets lighting to its default values.
|
||||
* `light_definition` is a table with the following optional fields:
|
||||
* `saturation` sets the saturation (vividness; default: `1.0`).
|
||||
* `saturation` sets the saturation (vividness; default: `1.0`).
|
||||
values > 1 increase the saturation
|
||||
values in [0,1) decrease the saturation
|
||||
* `shadows` is a table that controls ambient shadows
|
||||
* `shadows` is a table that controls ambient shadows
|
||||
* `intensity` sets the intensity of the shadows from 0 (no shadows, default) to 1 (blackness)
|
||||
* This value has no effect on clients who have the "Dynamic Shadows" shader disabled.
|
||||
* `exposure` is a table that controls automatic exposure.
|
||||
* `exposure` is a table that controls automatic exposure.
|
||||
The basic exposure factor equation is `e = 2^exposure_correction / clamp(luminance, 2^luminance_min, 2^luminance_max)`
|
||||
* `luminance_min` set the lower luminance boundary to use in the calculation (default: `-3.0`)
|
||||
* `luminance_max` set the upper luminance boundary to use in the calculation (default: `-3.0`)
|
||||
@@ -7945,7 +7942,7 @@ child will follow movement and rotation of that bone.
|
||||
* `speed_dark_bright` set the speed of adapting to bright light (default: `1000.0`)
|
||||
* `speed_bright_dark` set the speed of adapting to dark scene (default: `1000.0`)
|
||||
* `center_weight_power` set the power factor for center-weighted luminance measurement (default: `1.0`)
|
||||
* `volumetric_light`: is a table that controls volumetric light (a.k.a. "godrays")
|
||||
* `volumetric_light`: is a table that controls volumetric light (a.k.a. "godrays")
|
||||
* `strength`: sets the strength of the volumetric light effect from 0 (off, default) to 1 (strongest)
|
||||
* This value has no effect on clients who have the "Volumetric Lighting" or "Bloom" shaders disabled.
|
||||
|
||||
@@ -8065,7 +8062,7 @@ Otherwise, use `PcgRandom`.
|
||||
### Constructor
|
||||
|
||||
`PseudoRandom(seed)`
|
||||
* `seed`: 32-bit signed number
|
||||
* `seed`: 32-bit signed number
|
||||
|
||||
### Methods
|
||||
|
||||
@@ -10355,7 +10352,7 @@ Types used are defined in the previous section.
|
||||
velocity values within a range. the velocity calculated by this method will
|
||||
be **added** to that specified by `vel` if `vel` is also set, so in most
|
||||
cases **`vel` should be set to 0**. `attract` has the fields:
|
||||
* string `kind`: selects the kind of shape towards which the particles will
|
||||
* string `kind`: selects the kind of shape towards which the particles will
|
||||
be oriented. it must have one of the following values:
|
||||
* `"none"`: no attractor is set and the `attractor` table is ignored
|
||||
* `"point"`: the particles are attracted to a specific point in space.
|
||||
@@ -10367,22 +10364,22 @@ Types used are defined in the previous section.
|
||||
* `"plane"`: the particles are attracted to an (infinite) plane on whose
|
||||
surface `origin` designates a point in world coordinate space. use this
|
||||
for e.g. particles entering or emerging from a portal.
|
||||
* float range `strength`: the speed with which particles will move towards
|
||||
* float range `strength`: the speed with which particles will move towards
|
||||
`attractor`. If negative, the particles will instead move away from that
|
||||
point.
|
||||
* vec3 `origin`: the origin point of the shape towards which particles will
|
||||
* vec3 `origin`: the origin point of the shape towards which particles will
|
||||
initially be oriented. functions as an offset if `origin_attached` is also
|
||||
set.
|
||||
* vec3 `direction`: sets the direction in which the attractor shape faces. for
|
||||
* vec3 `direction`: sets the direction in which the attractor shape faces. for
|
||||
lines, this sets the angle of the line; e.g. a vector of (0,1,0) will
|
||||
create a vertical line that passes through `origin`. for planes, `direction`
|
||||
is the surface normal of an infinite plane on whose surface `origin` is
|
||||
a point. functions as an offset if `direction_attached` is also set.
|
||||
* entity `origin_attached`: allows the origin to be specified as an offset
|
||||
* entity `origin_attached`: allows the origin to be specified as an offset
|
||||
from the position of an entity rather than a coordinate in world space.
|
||||
* entity `direction_attached`: allows the direction to be specified as an offset
|
||||
* entity `direction_attached`: allows the direction to be specified as an offset
|
||||
from the position of an entity rather than a coordinate in world space.
|
||||
* bool `die_on_contact`: if true, the particles' lifetimes are adjusted so
|
||||
* bool `die_on_contact`: if true, the particles' lifetimes are adjusted so
|
||||
that they will die as they cross the attractor threshold. this behavior
|
||||
is the default but is undesirable for some kinds of animations; set it to
|
||||
false to allow particles to live out their natural lives.
|
||||
|
||||
@@ -9,9 +9,9 @@ Description of formspec language to show your menu is in `lua_api.md`
|
||||
# Callbacks
|
||||
|
||||
* `core.button_handler(fields)`: called when a button is pressed.
|
||||
* `fields` = `{name1 = value1, name2 = value2, ...}`
|
||||
* `fields` = `{name1 = value1, name2 = value2, ...}`
|
||||
* `core.event_handler(event)`
|
||||
* `event`: `"MenuQuit"`, `"KeyEnter"`, `"ExitButton"` or `"EditBoxEnter"`
|
||||
* `event`: `"MenuQuit"`, `"KeyEnter"`, `"ExitButton"` or `"EditBoxEnter"`
|
||||
|
||||
|
||||
|
||||
@@ -35,65 +35,65 @@ The "gamedata" table is read when calling `core.start()`. It should contain:
|
||||
# Functions
|
||||
|
||||
* `core.start()`
|
||||
* start game session
|
||||
* start game session
|
||||
* `core.close()`
|
||||
* exit engine
|
||||
* exit engine
|
||||
* `core.get_min_supp_proto()`
|
||||
* returns the minimum supported network protocol version
|
||||
* returns the minimum supported network protocol version
|
||||
* `core.get_max_supp_proto()`
|
||||
* returns the maximum supported network protocol version
|
||||
* returns the maximum supported network protocol version
|
||||
* `core.open_url(url)`
|
||||
* opens the URL in a web browser, returns false on failure.
|
||||
* Must begin with http:// or https://
|
||||
* opens the URL in a web browser, returns false on failure.
|
||||
* Must begin with http:// or https://
|
||||
* `core.open_dir(path)`
|
||||
* opens the path in the system file browser/explorer, returns false on failure.
|
||||
* Must be an existing directory.
|
||||
* opens the path in the system file browser/explorer, returns false on failure.
|
||||
* Must be an existing directory.
|
||||
* `core.share_file(path)`
|
||||
* Android only. Shares file using the share popup
|
||||
* Android only. Shares file using the share popup
|
||||
* `core.get_version()` (possible in async calls)
|
||||
* returns current core version
|
||||
* returns current core version
|
||||
* `core.set_once(key, value)`:
|
||||
* save a string value that persists even if menu is closed
|
||||
* save a string value that persists even if menu is closed
|
||||
* `core.get_once(key)`:
|
||||
* get a string value saved by above function, or `nil`
|
||||
* get a string value saved by above function, or `nil`
|
||||
|
||||
|
||||
|
||||
# Filesystem
|
||||
|
||||
* `core.get_builtin_path()`
|
||||
* returns path to builtin root
|
||||
* returns path to builtin root
|
||||
* `core.create_dir(absolute_path)` (possible in async calls)
|
||||
* `absolute_path` to directory to create (needs to be absolute)
|
||||
* returns true/false
|
||||
* `absolute_path` to directory to create (needs to be absolute)
|
||||
* returns true/false
|
||||
* `core.delete_dir(absolute_path)` (possible in async calls)
|
||||
* `absolute_path` to directory to delete (needs to be absolute)
|
||||
* returns true/false
|
||||
* `absolute_path` to directory to delete (needs to be absolute)
|
||||
* returns true/false
|
||||
* `core.copy_dir(source,destination,keep_source)` (possible in async calls)
|
||||
* `source` folder
|
||||
* `destination` folder
|
||||
* `keep_source` DEFAULT true --> if set to false `source` is deleted after copying
|
||||
* returns true/false
|
||||
* `source` folder
|
||||
* `destination` folder
|
||||
* `keep_source` DEFAULT true --> if set to false `source` is deleted after copying
|
||||
* returns true/false
|
||||
* `core.is_dir(path)` (possible in async calls)
|
||||
* returns true if `path` is a valid dir
|
||||
* returns true if `path` is a valid dir
|
||||
* `core.extract_zip(zipfile,destination)` [unzip within path required]
|
||||
* `zipfile` to extract
|
||||
* `destination` folder to extract to
|
||||
* returns true/false
|
||||
* `zipfile` to extract
|
||||
* `destination` folder to extract to
|
||||
* returns true/false
|
||||
* `core.sound_play(spec, looped)` -> handle
|
||||
* `spec` = `SimpleSoundSpec` (see `lua_api.md`)
|
||||
* `looped` = bool
|
||||
* `spec` = `SimpleSoundSpec` (see `lua_api.md`)
|
||||
* `looped` = bool
|
||||
* `handle:stop()` or `core.sound_stop(handle)`
|
||||
* `core.get_video_drivers()`
|
||||
* get list of video drivers supported by engine (not all modes are guaranteed to work)
|
||||
* returns list of available video drivers' settings name and 'friendly' display name
|
||||
* get list of video drivers supported by engine (not all modes are guaranteed to work)
|
||||
* returns list of available video drivers' settings name and 'friendly' display name
|
||||
e.g. `{{name="opengl", friendly_name="OpenGL"}, {name="software", friendly_name="Software Renderer"}}`
|
||||
* first element of returned list is guaranteed to be the NULL driver
|
||||
* first element of returned list is guaranteed to be the NULL driver
|
||||
* `core.get_mapgen_names([include_hidden=false])` -> table of map generator algorithms
|
||||
registered in the core (possible in async calls)
|
||||
* `core.get_cache_path()` -> path of cache
|
||||
* `core.get_temp_path([param])` (possible in async calls)
|
||||
* `param`=true: returns path to a temporary file
|
||||
* `param`=true: returns path to a temporary file
|
||||
otherwise: returns path to the temporary folder
|
||||
|
||||
|
||||
@@ -178,45 +178,45 @@ Passed to `HTTPApiTable.fetch` callback. Returned by
|
||||
|
||||
* `core.update_formspec(formspec)`
|
||||
* `core.get_table_index(tablename)` -> index
|
||||
* can also handle textlists
|
||||
* can also handle textlists
|
||||
* `core.formspec_escape(string)` -> string
|
||||
* escapes characters [ ] \ , ; that cannot be used in formspecs
|
||||
* escapes characters [ ] \ , ; that cannot be used in formspecs
|
||||
* `core.explode_table_event(string)` -> table
|
||||
* returns e.g. `{type="CHG", row=1, column=2}`
|
||||
* `type`: "INV" (no row selected), "CHG" (selected) or "DCL" (double-click)
|
||||
* returns e.g. `{type="CHG", row=1, column=2}`
|
||||
* `type`: "INV" (no row selected), "CHG" (selected) or "DCL" (double-click)
|
||||
* `core.explode_textlist_event(string)` -> table
|
||||
* returns e.g. `{type="CHG", index=1}`
|
||||
* `type`: "INV" (no row selected), "CHG" (selected) or "DCL" (double-click)
|
||||
* returns e.g. `{type="CHG", index=1}`
|
||||
* `type`: "INV" (no row selected), "CHG" (selected) or "DCL" (double-click)
|
||||
* `core.set_formspec_prepend(formspec)`
|
||||
* `formspec`: string to be added to every mainmenu formspec, to be used for theming.
|
||||
* `formspec`: string to be added to every mainmenu formspec, to be used for theming.
|
||||
|
||||
|
||||
|
||||
# GUI
|
||||
|
||||
* `core.set_background(type,texturepath,[tile],[minsize])`
|
||||
* `type`: "background", "overlay", "header" or "footer"
|
||||
* `tile`: tile the image instead of scaling (background only)
|
||||
* `minsize`: minimum tile size, images are scaled to at least this size prior
|
||||
* `type`: "background", "overlay", "header" or "footer"
|
||||
* `tile`: tile the image instead of scaling (background only)
|
||||
* `minsize`: minimum tile size, images are scaled to at least this size prior
|
||||
doing tiling (background only)
|
||||
* `core.set_clouds(<true/false>)`
|
||||
* `core.set_topleft_text(text)`
|
||||
* `core.show_keys_menu()`
|
||||
* `core.show_path_select_dialog(formname, caption, is_file_select)`
|
||||
* shows a path select dialog
|
||||
* `formname` is base name of dialog response returned in fields
|
||||
* shows a path select dialog
|
||||
* `formname` is base name of dialog response returned in fields
|
||||
- if dialog was accepted `"_accepted"`
|
||||
will be added to fieldname containing the path
|
||||
- if dialog was canceled `"_cancelled"`
|
||||
will be added to fieldname value is set to formname itself
|
||||
* if `is_file_select` is `true`, a file and not a folder will be selected
|
||||
* returns nil or selected file/folder
|
||||
* if `is_file_select` is `true`, a file and not a folder will be selected
|
||||
* returns nil or selected file/folder
|
||||
* `core.get_active_driver()`:
|
||||
* technical name of active video driver, e.g. "opengl"
|
||||
* technical name of active video driver, e.g. "opengl"
|
||||
* `core.get_active_renderer()`:
|
||||
* name of current renderer, e.g. "OpenGL 4.6"
|
||||
* name of current renderer, e.g. "OpenGL 4.6"
|
||||
* `core.get_active_irrlicht_device()`:
|
||||
* name of current irrlicht device, e.g. "SDL"
|
||||
* name of current irrlicht device, e.g. "SDL"
|
||||
* `core.get_window_info()`: Same as server-side `get_player_window_information` API.
|
||||
```lua
|
||||
-- Note that none of these things are constant, they are likely to change
|
||||
@@ -340,10 +340,10 @@ Package - content which is downloadable from the content db, may or may not be i
|
||||
# Logging
|
||||
|
||||
* `core.debug(line)` (possible in async calls)
|
||||
* Always printed to `stderr` and logfile (`print()` is redirected here)
|
||||
* Always printed to `stderr` and logfile (`print()` is redirected here)
|
||||
* `core.log(line)` (possible in async calls)
|
||||
* `core.log(loglevel, line)` (possible in async calls)
|
||||
* `loglevel` one of "error", "action", "info", "verbose"
|
||||
* `loglevel` one of "error", "action", "info", "verbose"
|
||||
|
||||
|
||||
|
||||
@@ -363,7 +363,7 @@ For a complete list of methods of the `Settings` object see
|
||||
# Worlds
|
||||
|
||||
* `core.get_worlds()` -> list of worlds (possible in async calls)
|
||||
* returns
|
||||
* returns
|
||||
```lua
|
||||
{
|
||||
[1] = {
|
||||
@@ -381,28 +381,28 @@ For a complete list of methods of the `Settings` object see
|
||||
# Helpers
|
||||
|
||||
* `core.get_us_time()`
|
||||
* returns time with microsecond precision
|
||||
* returns time with microsecond precision
|
||||
* `core.gettext(string)` -> string
|
||||
* look up the translation of a string in the gettext message catalog
|
||||
* look up the translation of a string in the gettext message catalog
|
||||
* `fgettext_ne(string, ...)`
|
||||
* call `core.gettext(string)`, replace "$1"..."$9" with the given
|
||||
* call `core.gettext(string)`, replace "$1"..."$9" with the given
|
||||
extra arguments and return the result
|
||||
* `fgettext(string, ...)` -> string
|
||||
* same as `fgettext_ne()`, but calls `core.formspec_escape` before returning result
|
||||
* same as `fgettext_ne()`, but calls `core.formspec_escape` before returning result
|
||||
* `core.parse_json(string[, nullvalue])` -> something (possible in async calls)
|
||||
* see `core.parse_json` (`lua_api.md`)
|
||||
* see `core.parse_json` (`lua_api.md`)
|
||||
* `dump(obj, dumped={})`
|
||||
* Return object serialized as a string
|
||||
* Return object serialized as a string
|
||||
* `string:split(separator)`
|
||||
* eg. `string:split("a,b", ",")` == `{"a","b"}`
|
||||
* eg. `string:split("a,b", ",")` == `{"a","b"}`
|
||||
* `string:trim()`
|
||||
* eg. `string.trim("\n \t\tfoo bar\t ")` == `"foo bar"`
|
||||
* eg. `string.trim("\n \t\tfoo bar\t ")` == `"foo bar"`
|
||||
* `core.is_yes(arg)` (possible in async calls)
|
||||
* returns whether `arg` can be interpreted as yes
|
||||
* returns whether `arg` can be interpreted as yes
|
||||
* `core.encode_base64(string)` (possible in async calls)
|
||||
* Encodes a string in base64.
|
||||
* Encodes a string in base64.
|
||||
* `core.decode_base64(string)` (possible in async calls)
|
||||
* Decodes a string encoded in base64.
|
||||
* Decodes a string encoded in base64.
|
||||
* `core.urlencode(str)`: Encodes non-unreserved URI characters by a
|
||||
percent sign followed by two hex digits. See
|
||||
[RFC 3986, section 2.3](https://datatracker.ietf.org/doc/html/rfc3986#section-2.3).
|
||||
@@ -412,10 +412,10 @@ For a complete list of methods of the `Settings` object see
|
||||
# Async
|
||||
|
||||
* `core.handle_async(async_job,parameters,finished)`
|
||||
* execute a function asynchronously
|
||||
* `async_job` is a function receiving one parameter and returning one parameter
|
||||
* `parameters` parameter table passed to `async_job`
|
||||
* `finished` function to be called once `async_job` has finished
|
||||
* execute a function asynchronously
|
||||
* `async_job` is a function receiving one parameter and returning one parameter
|
||||
* `parameters` parameter table passed to `async_job`
|
||||
* `finished` function to be called once `async_job` has finished
|
||||
the result of `async_job` is passed to this function
|
||||
|
||||
## Limitations of Async Operations
|
||||
|
||||
Reference in New Issue
Block a user