diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 0bbf9c79b..65e1a4eac 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1353,8 +1353,8 @@ HUD element types ----------------- The position field is used for all element types. -To account for differing resolutions, the position coordinates are the percentage -of the screen, ranging in value from `0` to `1`. +To account for differing resolutions, the position coordinates are the +percentage of the screen, ranging in value from `0` to `1`. The name field is not yet used, but should contain a description of what the HUD element represents. The direction field is the direction in which something @@ -1363,20 +1363,22 @@ is drawn. `0` draws from left to right, `1` draws from right to left, `2` draws from top to bottom, and `3` draws from bottom to top. -The `alignment` field specifies how the item will be aligned. It ranges from `-1` to `1`, -with `0` being the center, `-1` is moved to the left/up, and `1` is to the right/down. -Fractional values can be used. +The `alignment` field specifies how the item will be aligned. It ranges from +`-1` to `1`, with `0` being the center. `-1` is moved to the left/up, and `1` +is to the right/down. Fractional values can be used. -The `offset` field specifies a pixel offset from the position. Contrary to position, -the offset is not scaled to screen size. This allows for some precisely-positioned -items in the HUD. +The `offset` field specifies a pixel offset from the position. Contrary to +position, the offset is not scaled to screen size. This allows for some +precisely positioned items in the HUD. -**Note**: `offset` _will_ adapt to screen DPI as well as user defined scaling factor! +**Note**: `offset` _will_ adapt to screen DPI as well as user defined scaling +factor! -Below are the specific uses for fields in each type; fields not listed for that type are ignored. +Below are the specific uses for fields in each type; fields not listed for that +type are ignored. -**Note**: Future revisions to the HUD API may be incompatible; the HUD API is still -in the experimental stages. +**Note**: Future revisions to the HUD API may be incompatible; the HUD API is +still in the experimental stages. ### `image` Displays an image on the HUD. @@ -1395,8 +1397,8 @@ Displays text on the HUD. * `scale`: Defines the bounding rectangle of the text. A value such as `{x=100, y=100}` should work. * `text`: The text to be displayed in the HUD element. -* `number`: An integer containing the RGB value of the color used to draw the text. - Specify `0xFFFFFF` for white text, `0xFF0000` for red, and so on. +* `number`: An integer containing the RGB value of the color used to draw the + text. Specify `0xFFFFFF` for white text, `0xFF0000` for red, and so on. * `alignment`: The alignment of the text. * `offset`: offset in pixels from position. @@ -1408,7 +1410,8 @@ Displays a horizontal bar made up of half-images. If odd, will end with a vertically center-split texture. * `direction` * `offset`: offset in pixels from position. -* `size`: If used, will force full-image size to this value (override texture pack image size) +* `size`: If used, will force full-image size to this value (override texture + pack image size) ### `inventory` * `text`: The name of the inventory list to be displayed. @@ -1422,7 +1425,8 @@ Displays distance to selected world position. * `name`: The name of the waypoint. * `text`: Distance suffix. Can be blank. -* `number:` An integer containing the RGB value of the color used to draw the text. +* `number:` An integer containing the RGB value of the color used to draw the + text. * `world_pos`: World position of the waypoint. Representations of simple things @@ -1441,8 +1445,8 @@ 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. +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 @@ -1791,7 +1795,7 @@ a non-tool item, so that it can do something else than take damage. On the Lua side, every punch calls: - entity:on_punch(puncher, time_from_last_punch, tool_capabilities, direction, damage) + entity:on_punch(puncher, time_from_last_punch, tool_capabilities, direction, damage) This should never be called directly, because damage is usually not handled by the entity itself. @@ -1808,12 +1812,12 @@ Return value of this function will determine if damage is done by this function To punch an entity/object in Lua, call: - object:punch(puncher, time_from_last_punch, tool_capabilities, direction) + object:punch(puncher, time_from_last_punch, tool_capabilities, direction) * Return value is tool wear. * Parameters are equal to the above callback. -* If `direction` equals `nil` and `puncher` does not equal `nil`, - `direction` will be automatically filled in based on the location of `puncher`. +* If `direction` equals `nil` and `puncher` does not equal `nil`, `direction` + will be automatically filled in based on the location of `puncher`. Node Metadata ------------- @@ -1867,7 +1871,8 @@ Item metadata only contains a key-value store. 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. * `palette_index`: If the item has a palette, this is used to get the current color from the palette. @@ -1920,7 +1925,8 @@ examples. #### `position[,]` * Must be used after `size` element. * Defines the position on the game window of the formspec's `anchor` point. -* For X and Y, 0.0 and 1.0 represent opposite edges of the game window, for example: +* For X and Y, 0.0 and 1.0 represent opposite edges of the game window, + for example: * [0.0, 0.0] sets the position to the top left corner of the game window. * [1.0, 1.0] sets the position to the bottom right of the game window. * Defaults to the center of the game window [0.5, 0.5]. @@ -1928,7 +1934,8 @@ examples. #### `anchor[,]` * Must be used after both `size` and `position` (if present) elements. * Defines the location of the anchor point within the formspec. -* For X and Y, 0.0 and 1.0 represent opposite edges of the formspec, for example: +* For X and Y, 0.0 and 1.0 represent opposite edges of the formspec, + for example: * [0.0, 1.0] sets the anchor to the bottom left corner of the formspec. * [1.0, 0.0] sets the anchor to the top right of the formspec. * Defaults to the center of the formspec [0.5, 0.5]. @@ -1937,13 +1944,15 @@ examples. extending off the game window due to particular game window sizes. #### `container[,]` -* Start of a container block, moves all physical elements in the container by (X, Y) +* 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 +* End of a container, following elements are no longer relative to this + container. #### `list[;;,;,;]` * Show an inventory list @@ -1993,7 +2002,8 @@ examples. #### `bgcolor[;]` * Sets background color of formspec as `ColorString` -* If `true`, the background color is drawn fullscreen (does not effect the size of the formspec) +* If `true`, the background color is drawn fullscreen (does not effect the size + of the formspec). #### `background[,;,;]` * Use a background. Inventory rectangles are not drawn then. @@ -2011,8 +2021,8 @@ examples. #### `pwdfield[,;,;;