diff --git a/doc/client_lua_api.md b/doc/client_lua_api.md index ef0d9e1d3..8cf9238a0 100644 --- a/doc/client_lua_api.md +++ b/doc/client_lua_api.md @@ -8,7 +8,7 @@ Introduction ** WARNING: The client API is currently unstable, and may break/change without warning. ** -Content and functionality can be added to Minetest 0.4.15-dev+ by using Lua +Content and functionality can be added to Minetest by using Lua scripting in run-time loaded mods. A mod is a self-contained bunch of scripts, textures and other related @@ -62,7 +62,7 @@ Generic: In a run-in-place version (e.g. the distributed windows version): -* `minetest-0.4.x/clientmods/` (User-installed mods) +* `minetest/clientmods/` (User-installed mods) On an installed version on Linux: @@ -185,15 +185,9 @@ Examples of sound parameter tables: pos = {x = 1, y = 2, z = 3}, gain = 1.0, -- default } --- Play connected to an object, looped -{ - object = , - gain = 1.0, -- default - loop = true, -} ``` -Looped sounds must either be connected to an object or played locationless. +Looped sounds must be played locationless. ### SimpleSoundSpec * e.g. `""` @@ -220,387 +214,20 @@ For helper functions see "Vector helpers". Flag Specifier Format --------------------- -Flags using the standardized flag specifier format can be specified in either of -two ways, by string or table. -The string format is a comma-delimited set of flag names; whitespace and -unrecognized flag fields are ignored. Specifying a flag in the string sets the -flag, and specifying a flag prefixed by the string `"no"` explicitly -clears the flag from whatever the default may be. - -In addition to the standard string flag format, the schematic flags field can -also be a table of flag names to boolean values representing whether or not the -flag is set. Additionally, if a field with the flag name prefixed with `"no"` -is present, mapped to a boolean of any value, the specified flag is unset. - -E.g. A flag field of value - -```lua -{place_center_x = true, place_center_y=false, place_center_z=true} -``` - -is equivalent to - -```lua -{place_center_x = true, noplace_center_y=true, place_center_z=true} -``` - -which is equivalent to - -```lua -"place_center_x, noplace_center_y, place_center_z" -``` - -or even - -```lua -"place_center_x, place_center_z" -``` - -since, by default, no schematic attributes are set. +Refer to `lua_api.md`. Formspec -------- + Formspec defines a menu. It is a string, with a somewhat strange format. -Spaces and newlines can be inserted between the blocks, as is used in the -examples. - -### Examples - -#### Chest - - size[8,9] - list[context;main;0,0;8,4;] - list[current_player;main;0,5;8,4;] - -#### Furnace - - size[8,9] - list[context;fuel;2,3;1,1;] - list[context;src;2,1;1,1;] - list[context;dst;5,1;2,2;] - list[current_player;main;0,5;8,4;] - -#### Minecraft-like player inventory - - size[8,7.5] - image[1,0.6;1,2;player.png] - list[current_player;main;0,3.5;8,4;] - list[current_player;craft;3,0;3,3;] - list[current_player;craftpreview;7,1;1,1;] - -### Elements - -#### `size[,,]` -* Define the size of the menu in inventory slots -* `fixed_size`: `true`/`false` (optional) -* deprecated: `invsize[,;]` - -#### `container[,]` -* Start of a container block, moves all physical elements in the container by (X, Y) -* Must have matching container_end -* Containers can be nested, in which case the offsets are added - (child containers are relative to parent containers) - -#### `container_end[]` -* End of a container, following elements are no longer relative to this container - -#### `list[;;,;,;]` -* Show an inventory list - -#### `list[;;,;,;]` -* Show an inventory list - -#### `listring[;]` -* Allows to create a ring of inventory lists -* Shift-clicking on items in one element of the ring - will send them to the next inventory list inside the ring -* The first occurrence of an element inside the ring will - determine the inventory where items will be sent to - -#### `listring[]` -* Shorthand for doing `listring[;]` - for the last two inventory lists added by list[...] - -#### `listcolors[;]` -* Sets background color of slots as `ColorString` -* Sets background color of slots on mouse hovering - -#### `listcolors[;;]` -* Sets background color of slots as `ColorString` -* Sets background color of slots on mouse hovering -* Sets color of slots border - -#### `listcolors[;;;;]` -* Sets background color of slots as `ColorString` -* Sets background color of slots on mouse hovering -* Sets color of slots border -* Sets default background color of tooltips -* Sets default font color of tooltips - -#### `tooltip[;;,]` -* Adds tooltip for an element -* `` tooltip background color as `ColorString` (optional) -* `` tooltip font color as `ColorString` (optional) - -#### `image[,;,;]` -* Show an image -* Position and size units are inventory slots - -#### `item_image[,;,;]` -* Show an inventory image of registered item/node -* Position and size units are inventory slots - -#### `bgcolor[;]` -* Sets background color of formspec as `ColorString` -* If `true`, the background color is drawn fullscreen (does not affect the size of the formspec) - -#### `background[,;,;]` -* Use a background. Inventory rectangles are not drawn then. -* Position and size units are inventory slots -* Example for formspec 8x4 in 16x resolution: image shall be sized - 8 times 16px times 4 times 16px. - -#### `background[,;,;;]` -* Use a background. Inventory rectangles are not drawn then. -* Position and size units are inventory slots -* Example for formspec 8x4 in 16x resolution: - image shall be sized 8 times 16px times 4 times 16px -* If `true` the background is clipped to formspec size - (`x` and `y` are used as offset values, `w` and `h` are ignored) - -#### `pwdfield[,;,;;