Lua_api.txt: Improve Player HUD flags documentation (#7588)

master
ClobberXD 2018-07-31 17:30:02 +05:30 committed by Paramat
parent bf45644041
commit 654f57333f
1 changed files with 17 additions and 14 deletions

View File

@ -4774,7 +4774,7 @@ This is basically a reference to a C++ `ServerActiveObject`
* `remove()`: remove object (after returning from Lua) * `remove()`: remove object (after returning from Lua)
* Note: Doesn't work on players, use `minetest.kick_player` instead * Note: Doesn't work on players, use `minetest.kick_player` instead
* `get_pos()`: returns `{x=num, y=num, z=num}` * `get_pos()`: returns `{x=num, y=num, z=num}`
* `set_pos(pos)`; `pos`=`{x=num, y=num, z=num}` * `set_pos(pos)`: `pos`=`{x=num, y=num, z=num}`
* `move_to(pos, continuous=false)`: interpolated move * `move_to(pos, continuous=false)`: interpolated move
* `punch(puncher, time_from_last_punch, tool_capabilities, direction)` * `punch(puncher, time_from_last_punch, tool_capabilities, direction)`
* `puncher` = another `ObjectRef`, * `puncher` = another `ObjectRef`,
@ -4938,18 +4938,21 @@ This is basically a reference to a C++ `ServerActiveObject`
* element `stat` values: * element `stat` values:
`position`, `name`, `scale`, `text`, `number`, `item`, `dir` `position`, `name`, `scale`, `text`, `number`, `item`, `dir`
* `hud_get(id)`: gets the HUD element definition structure of the specified ID * `hud_get(id)`: gets the HUD element definition structure of the specified ID
* `hud_set_flags(flags)`: sets specified HUD flags to `true`/`false` * `hud_set_flags(flags)`: sets specified HUD flags of player.
* `flags`: (is visible) `hotbar`, `healthbar`, `crosshair`, `wielditem`, * `flags`: A table with the following fields set to boolean values
`breathbar`, `minimap`, `minimap_radar` * hotbar
* pass a table containing a `true`/`false` value of each flag to be set or * healthbar
unset. * crosshair
* if a flag equals `nil`, the flag is not modified * wielditem
* note that setting `minimap` modifies the client's permission to view the * breathbar
minimap - the client may locally elect to not view the minimap. * minimap
* minimap `radar` is only usable when `minimap` is true * minimap_radar
* `hud_get_flags()`: returns a table containing status of hud flags * If a flag equals `nil`, the flag is not modified
* returns `{hotbar=true, healthbar=true, crosshair=true, wielditem=true, * `minimap`: Modifies the client's permission to view the minimap.
breathbar=true, minimap=true, minimap_radar=true}` The client may locally elect to not view the minimap.
* `minimap_radar` is only usable when `minimap` is true
* `hud_get_flags()`: returns a table of player HUD flags with boolean values.
* See `hud_set_flags` for a list of flags that can be toggled.
* `hud_set_hotbar_itemcount(count)`: sets number of items in builtin hotbar * `hud_set_hotbar_itemcount(count)`: sets number of items in builtin hotbar
* `count`: number of items, must be between `1` and `23` * `count`: number of items, must be between `1` and `23`
* `hud_get_hotbar_itemcount`: returns number of visible items * `hud_get_hotbar_itemcount`: returns number of visible items
@ -6183,7 +6186,7 @@ Used by `minetest.create_detached_inventory`.
HUD Definition HUD Definition
-------------- --------------
Used by `minetest.hud_add`. Returned by `minetest.hud_get`. Used by `Player:hud_add`. Returned by `Player:hud_get`.
{ {
hud_elem_type = "image", -- see HUD element types hud_elem_type = "image", -- see HUD element types