Compare commits
10 Commits
22ade2858c
...
44e8f05df8
| Author | SHA1 | Date | |
|---|---|---|---|
| 44e8f05df8 | |||
| b924170d10 | |||
| e0862e8170 | |||
| 08af76c702 | |||
| 186f56a8b3 | |||
| 60c9fbd5de | |||
| 453718fa83 | |||
| c4e69bae77 | |||
| 8b995b5176 | |||
| 19803a076d |
@@ -29,7 +29,7 @@ function ItemStack:add_wear(amount) end
|
|||||||
function ItemStack:clear() end
|
function ItemStack:clear() end
|
||||||
|
|
||||||
--- Returns number of items on the stack
|
--- Returns number of items on the stack
|
||||||
--- @return number
|
--- @return integer
|
||||||
function ItemStack:get_count() end
|
function ItemStack:get_count() end
|
||||||
|
|
||||||
--- Returns true/false (success), clears item on failure
|
--- Returns true/false (success), clears item on failure
|
||||||
@@ -44,7 +44,7 @@ function ItemStack:get_definition() end
|
|||||||
--- @return number
|
--- @return number
|
||||||
function ItemStack:get_free_space() end
|
function ItemStack:get_free_space() end
|
||||||
|
|
||||||
--- @return MetaDataRef
|
--- @return ItemStackMetaRef
|
||||||
function ItemStack:get_meta() end
|
function ItemStack:get_meta() end
|
||||||
|
|
||||||
--- Returns a string, for compatibility reasons this is equal to get_meta():get_string("")
|
--- Returns a string, for compatibility reasons this is equal to get_meta():get_string("")
|
||||||
@@ -52,7 +52,7 @@ function ItemStack:get_meta() end
|
|||||||
function ItemStack:get_metadata() end
|
function ItemStack:get_metadata() end
|
||||||
|
|
||||||
--- Returns item name (e.g. "default:stone")
|
--- Returns item name (e.g. "default:stone")
|
||||||
--- @return string
|
--- @return ItemStackString
|
||||||
function ItemStack:get_name() end
|
function ItemStack:get_name() end
|
||||||
|
|
||||||
--- Returns true/false (success), clears item on failure
|
--- Returns true/false (success), clears item on failure
|
||||||
|
|||||||
@@ -9,3 +9,7 @@ ItemStackMetaRef = {}
|
|||||||
--- * Overrides the item's tool capabilities
|
--- * Overrides the item's tool capabilities
|
||||||
--- * A nil value will clear the override data and restore the original behavior.
|
--- * A nil value will clear the override data and restore the original behavior.
|
||||||
function ItemStackMetaRef:set_tool_capabilities(tool_capabilities) end
|
function ItemStackMetaRef:set_tool_capabilities(tool_capabilities) end
|
||||||
|
|
||||||
|
--- * Overrides the item's wear bar parameters (see "Wear Bar Color" section)
|
||||||
|
--- * A nil value will clear the override data and restore the original behavior.
|
||||||
|
function ItemStackMetaRef:set_wear_bar_params(wear_bar_params) end
|
||||||
|
|||||||
@@ -1,245 +1,331 @@
|
|||||||
--- @meta
|
--- @meta
|
||||||
|
|
||||||
|
|
||||||
--- @class Player: ObjectRef
|
--- @class Player: ObjectRef
|
||||||
Player = {}
|
Player = {}
|
||||||
|
|
||||||
--- @return InvRef
|
--- @return InvRef
|
||||||
function Player:get_inventory() end
|
function Player:get_inventory() end
|
||||||
|
|
||||||
--- returns `""` if is not a player
|
--- Returns player name or `""` if is not a player.
|
||||||
--- @return string
|
--- @return string
|
||||||
function Player:get_player_name() end
|
function Player:get_player_name() end
|
||||||
|
|
||||||
--- **DEPRECATED**, use get_velocity() instead.
|
--- **DEPRECATED**, use `get_velocity()` instead.
|
||||||
--- table {x, y, z} representing the player's instantaneous velocity in nodes/s
|
--- table {x, y, z} representing the player's instantaneous velocity in nodes/s
|
||||||
--- @deprecated
|
--- @deprecated
|
||||||
function Player:get_player_velocity() end
|
function Player:get_player_velocity() end
|
||||||
|
|
||||||
--- **DEPRECATED**, use add_velocity(vel) instead.
|
--- **DEPRECATED**, use `add_velocity(vel)` instead.
|
||||||
--- @deprecated
|
--- @deprecated
|
||||||
function Player:add_player_velocity(vel) end
|
function Player:add_player_velocity(vel) end
|
||||||
|
|
||||||
--- get camera direction as a unit vector
|
--- Get camera direction as a unit vector.
|
||||||
|
--- @return vector
|
||||||
function Player:get_look_dir() end
|
function Player:get_look_dir() end
|
||||||
|
|
||||||
--- pitch in radians
|
--- Pitch in radians.
|
||||||
--- * Angle ranges between -pi/2 and pi/2, which are straight up and down
|
---
|
||||||
--- respectively.
|
--- Angle ranges between -pi/2 and pi/2, which are straight up and down respectively.
|
||||||
|
--- @return number
|
||||||
function Player:get_look_vertical() end
|
function Player:get_look_vertical() end
|
||||||
|
|
||||||
--- yaw in radians
|
--- Yaw in radians.
|
||||||
--- * Angle is counter-clockwise from the +z direction.
|
---
|
||||||
|
--- Angle is counter-clockwise from the +z direction.
|
||||||
--- @return number
|
--- @return number
|
||||||
function Player:get_look_horizontal() end
|
function Player:get_look_horizontal() end
|
||||||
|
|
||||||
--- sets look pitch
|
--- Sets look pitch.
|
||||||
--- * radians: Angle from looking forward, where positive is downwards.
|
--- @param radians number Angle from looking forward, where positive is downwards.
|
||||||
function Player:set_look_vertical(radians) end
|
function Player:set_look_vertical(radians) end
|
||||||
|
|
||||||
--- sets look yaw
|
--- Sets look yaw.
|
||||||
--- * radians: Angle from the +z direction, where positive is counter-clockwise.
|
--- @param radians number Angle from the +z direction, where positive is counter-clockwise.
|
||||||
function Player:set_look_horizontal(radians) end
|
function Player:set_look_horizontal(radians) end
|
||||||
|
|
||||||
--- pitch in radians - Deprecated as broken. Use
|
--- Pitch in radians - Deprecated as broken. Use `get_look_vertical`.
|
||||||
--- `get_look_vertical`.
|
--- @deprecated
|
||||||
--- * Angle ranges between -pi/2 and pi/2, which are straight down and up
|
|
||||||
--- respectively.
|
|
||||||
function Player:get_look_pitch() end
|
function Player:get_look_pitch() end
|
||||||
|
|
||||||
--- yaw in radians - Deprecated as broken. Use
|
--- Yaw in radians - Deprecated as broken. Use `get_look_horizontal`.
|
||||||
--- `get_look_horizontal`.
|
|
||||||
--- * Angle is counter-clockwise from the +x direction.
|
|
||||||
--- @deprecated
|
--- @deprecated
|
||||||
function Player:get_look_yaw() end
|
function Player:get_look_yaw() end
|
||||||
|
|
||||||
--- sets look pitch - Deprecated. Use `set_look_vertical`.
|
--- Sets look pitch - Deprecated. Use `set_look_vertical`.
|
||||||
|
--- @deprecated
|
||||||
function Player:set_look_pitch(radians) end
|
function Player:set_look_pitch(radians) end
|
||||||
|
|
||||||
--- sets look yaw - Deprecated. Use
|
--- Sets look yaw - Deprecated. Use `set_look_horizontal`.
|
||||||
--- `set_look_horizontal`.
|
--- @deprecated
|
||||||
function Player:set_look_yaw(radians) end
|
function Player:set_look_yaw(radians) end
|
||||||
|
|
||||||
--- returns player's breath
|
--- Returns player's breath.
|
||||||
|
--- @return integer
|
||||||
function Player:get_breath() end
|
function Player:get_breath() end
|
||||||
|
|
||||||
--- sets player's breath
|
--- Sets player's breath
|
||||||
--- * values:
|
---
|
||||||
--- * `0`: player is drowning
|
--- values:
|
||||||
--- * max: bubbles bar is not shown
|
--- * `0`: player is drowning
|
||||||
--- * See [Object properties] for more information
|
--- * max: bubbles bar is not shown
|
||||||
--- * Is limited to range 0 ... 65535 (2^16 - 1)
|
--- * See [Object properties](https://api.luanti.org/class-reference/#object-properties) for more information
|
||||||
|
---
|
||||||
|
--- Is limited to range 0 ... 65535 (2^16 - 1)
|
||||||
|
--- @param value integer
|
||||||
function Player:set_breath(value) end
|
function Player:set_breath(value) end
|
||||||
|
|
||||||
--- Sets player's FOV
|
--- Sets player's FOV.
|
||||||
--- * `fov`: FOV value.
|
---
|
||||||
--- * `is_multiplier`: Set to `true` if the FOV value is a multiplier.
|
--- Set `fov` to 0 to clear FOV override.
|
||||||
--- Defaults to `false`.
|
--- @param fov integer FOV value.
|
||||||
--- * `transition_time`: If defined, enables smooth FOV transition.
|
--- @param is_multiplier boolean Set to `true` if the FOV value is a multiplier. Defaults to `false`.
|
||||||
--- Interpreted as the time (in seconds) to reach target FOV.
|
--- @param transition_time number `transition_time`: If defined, enables smooth FOV transition.
|
||||||
--- If set to 0, FOV change is instantaneous. Defaults to 0.
|
--- Interpreted as the time (in seconds) to reach target FOV.
|
||||||
--- * Set `fov` to 0 to clear FOV override.
|
--- If set to 0, FOV change is instantaneous. Defaults to 0.
|
||||||
function Player:set_fov(fov, is_multiplier, transition_time) end
|
function Player:set_fov(fov, is_multiplier, transition_time) end
|
||||||
|
|
||||||
--- Returns the following:
|
--- Returns the FOV.
|
||||||
--- * Server-sent FOV value. Returns 0 if an FOV override doesn't exist.
|
--- @return integer fov Server-sent FOV value. Returns 0 if an FOV override doesn't exist.
|
||||||
--- * Boolean indicating whether the FOV value is a multiplier.
|
--- @return boolean is_multiplier Boolean indicating whether the FOV value is a multiplier.
|
||||||
--- * Time (in seconds) taken for the FOV transition. Set by `set_fov`.
|
--- @return number transition_time Time (in seconds) taken for the FOV transition. Set by `set_fov`.
|
||||||
function Player:get_fov() end
|
function Player:get_fov() end
|
||||||
|
|
||||||
--- DEPRECATED, use get_meta() instead
|
--- DEPRECATED, use `get_meta()` instead
|
||||||
--- * Sets an extra attribute with value on player.
|
--- * Sets an extra attribute with value on player.
|
||||||
--- * `value` must be a string, or a number which will be converted to a
|
--- * `value` must be a string, or a number which will be converted to a
|
||||||
--- string.
|
--- string.
|
||||||
--- * If `value` is `nil`, remove attribute from player.
|
--- * If `value` is `nil`, remove attribute from player.
|
||||||
|
--- @deprecated
|
||||||
function Player:set_attribute(attribute, value) end
|
function Player:set_attribute(attribute, value) end
|
||||||
|
|
||||||
--- DEPRECATED, use get_meta() instead
|
--- DEPRECATED, use `get_meta()` instead
|
||||||
--- * Returns value (a string) for extra attribute.
|
--- * Returns value (a string) for extra attribute.
|
||||||
--- * Returns `nil` if no attribute found.
|
--- * Returns `nil` if no attribute found.
|
||||||
|
--- @deprecated
|
||||||
function Player:get_attribute(attribute) end
|
function Player:get_attribute(attribute) end
|
||||||
|
|
||||||
--- Returns a PlayerMetaRef.
|
--- Returns metadata associated with the player (a PlayerMetaRef).
|
||||||
--- @return PlayerMetaRef
|
--- @return PlayerMetaRef
|
||||||
function Player:get_meta() end
|
function Player:get_meta() end
|
||||||
|
|
||||||
--- * Redefine player's inventory form
|
--- Redefines the player's inventory formspec.
|
||||||
--- * Should usually be called in `on_joinplayer`
|
---
|
||||||
--- * If `formspec` is `""`, the player's inventory is disabled.
|
--- Should usually be called at least once in the `on_joinplayer` callback.
|
||||||
|
---
|
||||||
|
--- If `formspec` is `""`, the player's inventory is disabled.
|
||||||
|
---
|
||||||
|
--- If the inventory formspec is currently open on the client, it is updated immediately.
|
||||||
|
---
|
||||||
|
--- See also: `core.register_on_player_receive_fields`
|
||||||
|
--- @param formspec string
|
||||||
function Player:set_inventory_formspec(formspec) end
|
function Player:set_inventory_formspec(formspec) end
|
||||||
|
|
||||||
--- returns a formspec string
|
--- Returns a formspec string.
|
||||||
|
--- @return string
|
||||||
function Player:get_inventory_formspec() end
|
function Player:get_inventory_formspec() end
|
||||||
|
|
||||||
--- * the formspec string will be added to every formspec shown to the user,
|
--- The formspec string will be added to every formspec shown to the user,
|
||||||
--- except for those with a no_prepend[] tag.
|
--- except for those with a no_prepend[] tag.
|
||||||
--- * This should be used to set style elements such as background[] and
|
---
|
||||||
--- bgcolor[], any non-style elements (eg: label) may result in weird behavior.
|
--- This should be used to set style elements such as background[] and
|
||||||
--- * Only affects formspecs shown after this is called.
|
--- bgcolor[], any non-style elements (eg: label) may result in weird behavior.
|
||||||
|
---
|
||||||
|
--- Only affects formspecs shown after this is called.
|
||||||
|
--- @param formspec string
|
||||||
function Player:set_formspec_prepend(formspec) end
|
function Player:set_formspec_prepend(formspec) end
|
||||||
|
|
||||||
--- returns a formspec string.
|
--- Returns a formspec string.
|
||||||
|
--- @return string
|
||||||
function Player:get_formspec_prepend(formspec) end
|
function Player:get_formspec_prepend(formspec) end
|
||||||
|
|
||||||
--- returns table with player pressed keys
|
--- @alias Player.controls_key 'up'|'down'|'left'|'right'|'jump'|'aux1'|'sneak'|'dig'|'place'|'LMB'|'RBM'|'zoom'|'movement_x'|'movement_y'
|
||||||
--- * The table consists of fields with the following boolean values
|
|
||||||
--- representing the pressed keys: `up`, `down`, `left`, `right`, `jump`,
|
--- Returns table with player pressed keys
|
||||||
--- `aux1`, `sneak`, `dig`, `place`, `LMB`, `RMB`, and `zoom`.
|
|
||||||
--- * The fields `LMB` and `RMB` are equal to `dig` and `place` respectively,
|
|
||||||
--- and exist only to preserve backwards compatibility.
|
|
||||||
--- * Returns an empty table `{}` if the object is not a player.
|
|
||||||
---
|
---
|
||||||
--- @return table<string, boolean>
|
--- The table consists of fields with the following boolean values
|
||||||
|
--- representing the pressed keys: `up`, `down`, `left`, `right`, `jump`,
|
||||||
|
--- `aux1`, `sneak`, `dig`, `place`, `LMB`, `RMB`, and `zoom`.
|
||||||
|
---
|
||||||
|
--- The fields `LMB` and `RMB` are equal to `dig` and `place` respectively,
|
||||||
|
--- and exist only to preserve backwards compatibility.
|
||||||
|
---
|
||||||
|
--- Returns an empty table `{}` if the object is not a player.
|
||||||
|
--- @return table<Player.controls_key, boolean>
|
||||||
function Player:get_player_control() end
|
function Player:get_player_control() end
|
||||||
|
|
||||||
--- returns integer with bit packed player pressed
|
--- Returns integer with bit packed player pressed keys.
|
||||||
--- keys.
|
---
|
||||||
--- * Bits:
|
--- Bits:
|
||||||
--- * 0 - up
|
--- * 0 - up
|
||||||
--- * 1 - down
|
--- * 1 - down
|
||||||
--- * 2 - left
|
--- * 2 - left
|
||||||
--- * 3 - right
|
--- * 3 - right
|
||||||
--- * 4 - jump
|
--- * 4 - jump
|
||||||
--- * 5 - aux1
|
--- * 5 - aux1
|
||||||
--- * 6 - sneak
|
--- * 6 - sneak
|
||||||
--- * 7 - dig
|
--- * 7 - dig
|
||||||
--- * 8 - place
|
--- * 8 - place
|
||||||
--- * 9 - zoom
|
--- * 9 - zoom
|
||||||
--- * Returns `0` (no bits set) if the object is not a player.
|
---
|
||||||
|
--- Returns `0` (no bits set) if the object is not a player.
|
||||||
--- @return number
|
--- @return number
|
||||||
function Player:get_player_control_bits() end
|
function Player:get_player_control_bits() end
|
||||||
|
|
||||||
--- @class physics_override_table
|
--- @class Player.physics_override_table
|
||||||
--- @field speed? number multiplier to default walking speed value (default: `1`)
|
--- Multiplier to all movement speed (`speed_*`)
|
||||||
--- @field speed_walk? number multiplier to default walk speed value (default: `1`). Note: The actual walk speed is the product of `speed` and `speed_walk`
|
--- and acceleration (`acceleration_*`) values (default: `1`)
|
||||||
--- @field speed_climb? number multiplier to default climb speed value (default: `1`). Note: The actual climb speed is the product of `speed` and `speed_climb`
|
--- @field speed number?
|
||||||
--- @field speed_crouch? number multiplier to default crouch speed value (default: `1`). Note: The actual crouch speed is the product of `speed` and `speed_crouch`
|
---
|
||||||
--- @field speed_fast? number multiplier to default fast (sprint) speed value (default: `1`). Note: The actual fast speed is the product of `speed` and `speed_fast`
|
--- Multiplier to default walk speed value (default: `1`).
|
||||||
--- @field jump? number multiplier to default jump value (default: `1`)
|
--- Note: The actual walk speed is the product of `speed` and `speed_walk`
|
||||||
--- @field gravity? number multiplier to default gravity value (default: `1`)
|
--- @field speed_walk number?
|
||||||
--- @field liquid_fluidity? number multiplier to liquid movement resistance value (for nodes with `liquid_move_physics`); the higher this value, the lower the resistance to movement. At math.huge, the resistance is zero and you can move through any liquid like air. (default: `1`). Warning: Values below 1 are currently unsupported.
|
---
|
||||||
--- @field liquid_fluidity_smooth? number multiplier to default maximum liquid resistance value (for nodes with `liquid_move_physics`); controls deceleration when entering node at high speed. At higher values you come to a halt more quickly (default: `1`)
|
--- Multiplier to default climb speed value (default: `1`).
|
||||||
--- @field liquid_sink? number multiplier to default liquid sinking speed value; (for nodes with `liquid_move_physics`), (default: `1`)
|
--- Note: The actual climb speed is the product of `speed` and `speed_climb`
|
||||||
--- @field acceleration_default? number multiplier to default acceleration value (default: `1`). Note: The actual acceleration is the product of `speed` and `acceleration_default`
|
--- @field speed_climb number?
|
||||||
--- @field acceleration_air? number multiplier to default air acceleration value (default: `1`). Note: The actual air acceleration is the product of `speed` and `acceleration_air`
|
---
|
||||||
--- @field acceleration_fast? number multiplier to default fast (sprint) acceleration (default: `1`). Note: The actual fast acceleration is the product of `speed` and `acceleration_fast`
|
--- Multiplier to default crouch speed value (default: `1`).
|
||||||
--- @field sneak? boolean whether player can sneak (default: `true`)
|
--- Note: The actual crouch speed is the product of `speed` and `speed_crouch`
|
||||||
--- @field sneak_glitch? boolean whether player can use the new move code replications of the old sneak side-effects: sneak ladders and 2 node sneak jump (default: `false`)
|
--- @field speed_crouch number?
|
||||||
--- @field new_move? boolean use new move/sneak code. When `false` the exact old code is used for the specific old sneak behavior (default: `true`)
|
---
|
||||||
|
--- Multiplier to default fast (sprint) speed value (default: `1`).
|
||||||
|
--- Note: The actual fast speed is the product of `speed` and `speed_fast`
|
||||||
|
--- @field speed_fast number?
|
||||||
|
---
|
||||||
|
--- Multiplier to default jump value (default: `1`)
|
||||||
|
--- @field jump number?
|
||||||
|
---
|
||||||
|
--- Multiplier to default gravity value (default: `1`)
|
||||||
|
--- @field gravity number?
|
||||||
|
---
|
||||||
|
--- Multiplier to liquid movement resistance value (for nodes with `liquid_move_physics`);
|
||||||
|
--- the higher this value, the lower the resistance to movement.
|
||||||
|
--- At `math.huge`, the resistance is zero and you can move through any liquid like air. (default: `1`).
|
||||||
|
--- Warning: Values below 1 are currently unsupported.
|
||||||
|
--- @field liquid_fluidity number?
|
||||||
|
---
|
||||||
|
--- Multiplier to default maximum liquid resistance value (for nodes with `liquid_move_physics`);
|
||||||
|
--- controls deceleration when entering node at high speed.
|
||||||
|
--- At higher values you come to a halt more quickly (default: `1`)
|
||||||
|
--- @field liquid_fluidity_smooth number?
|
||||||
|
---
|
||||||
|
--- Multiplier to default liquid sinking speed value; (for nodes with `liquid_move_physics`), (default: `1`)
|
||||||
|
--- @field liquid_sink number?
|
||||||
|
---
|
||||||
|
--- Multiplier to default acceleration value (default: `1`).
|
||||||
|
--- Note: The actual acceleration is the product of `speed` and `acceleration_default`
|
||||||
|
--- @field acceleration_default number?
|
||||||
|
---
|
||||||
|
--- Multiplier to default air acceleration value (default: `1`).
|
||||||
|
--- Note: The actual air acceleration is the product of `speed` and `acceleration_air`
|
||||||
|
--- @field acceleration_air number?
|
||||||
|
---
|
||||||
|
--- Multiplier to default fast (sprint) acceleration (default: `1`).
|
||||||
|
--- Note: The actual fast acceleration is the product of `speed` and `acceleration_fast`
|
||||||
|
--- @field acceleration_fast number?
|
||||||
|
---
|
||||||
|
--- Whether player can sneak (default: `true`)
|
||||||
|
--- @field sneak boolean?
|
||||||
|
---
|
||||||
|
--- Whether player can use the new move code replications of the old sneak side-effects: sneak ladders and 2 node sneak jump (default: `false`)
|
||||||
|
--- @field sneak_glitch boolean?
|
||||||
|
---
|
||||||
|
--- Use new move/sneak code. When `false` the exact old code is used for the specific old sneak behavior (default: `true`)
|
||||||
|
--- @field new_move boolean?
|
||||||
|
|
||||||
--- set physics override for player
|
--- Overrides the physics attributes of the player
|
||||||
--- * `override_table` is a table with the following fields:
|
--- Note: All numeric fields above modify a corresponding movement_* setting.
|
||||||
--- * `speed`: multiplier to default walking speed value (default: `1`)
|
--- @param override_table Player.physics_override_table
|
||||||
--- * `jump`: multiplier to default jump value (default: `1`)
|
|
||||||
--- * `gravity`: multiplier to default gravity value (default: `1`)
|
|
||||||
--- * `sneak`: whether player can sneak (default: `true`)
|
|
||||||
--- * `sneak_glitch`: whether player can use the new move code replications
|
|
||||||
--- of the old sneak side-effects: sneak ladders and 2 node sneak jump
|
|
||||||
--- (default: `false`)
|
|
||||||
--- * `new_move`: use new move/sneak code. When `false` the exact old code
|
|
||||||
--- is used for the specific old sneak behavior (default: `true`)
|
|
||||||
--- @param override_table physics_override_table
|
|
||||||
function Player:set_physics_override(override_table) end
|
function Player:set_physics_override(override_table) end
|
||||||
|
|
||||||
--- returns the table given to `set_physics_override`
|
--- Returns the table given to `set_physics_override`.
|
||||||
--- @return physics_override_table
|
--- @return Player.physics_override_table
|
||||||
function Player:get_physics_override() end
|
function Player:get_physics_override() end
|
||||||
|
|
||||||
--- add a HUD element described by HUD def, returns ID
|
--- Add a HUD element described by HUD def, returns ID number on success.
|
||||||
--- number on success
|
--- @param hud_definition HudDefinition
|
||||||
|
--- @return integer
|
||||||
function Player:hud_add(hud_definition) end
|
function Player:hud_add(hud_definition) end
|
||||||
|
|
||||||
--- remove the HUD element of the specified id
|
--- Remove the HUD element of the specified id.
|
||||||
|
--- @param id integer
|
||||||
function Player:hud_remove(id) end
|
function Player:hud_remove(id) end
|
||||||
|
|
||||||
--- change a value of a previously added HUD
|
--- Change a value of a previously added HUD element.
|
||||||
--- element.
|
--- @param id integer
|
||||||
--- * `stat` supports the same keys as in the hud definition table except for
|
--- @param stat string supports the same keys as in the hud definition table except for `"type"` (or the deprecated `"hud_elem_type"`).
|
||||||
--- `"hud_elem_type"`.
|
--- @param value any
|
||||||
function Player:hud_change(id, stat, value) end
|
function Player:hud_change(id, stat, value) end
|
||||||
|
|
||||||
--- gets the HUD element definition structure of the specified ID
|
--- Gets the HUD element definition structure of the specified ID.
|
||||||
|
--- @param id integer
|
||||||
|
--- @return HudDefinition
|
||||||
function Player:hud_get(id) end
|
function Player:hud_get(id) end
|
||||||
|
|
||||||
--- sets specified HUD flags of player.
|
--- @class Player.hud_flags
|
||||||
--- * `flags`: A table with the following fields set to boolean values
|
--- @field hotbar boolean?
|
||||||
--- * `hotbar`
|
--- @field healthbar boolean?
|
||||||
--- * `healthbar`
|
--- @field crosshair boolean?
|
||||||
--- * `crosshair`
|
--- @field wielditem boolean?
|
||||||
--- * `wielditem`
|
--- @field breathbar boolean?
|
||||||
--- * `breathbar`
|
---
|
||||||
--- * `minimap`: Modifies the client's permission to view the minimap.
|
--- Modifies the client's permission to view the minimap.
|
||||||
--- The client may locally elect to not view the minimap.
|
--- The client may locally elect to not view the minimap
|
||||||
--- * `minimap_radar`: is only usable when `minimap` is true
|
--- @field minimap boolean?
|
||||||
--- * `basic_debug`: Allow showing basic debug info that might give a gameplay advantage.
|
---
|
||||||
--- This includes map seed, player position, look direction, the pointed node and block bounds.
|
--- Is only usable when `minimap` is true
|
||||||
--- Does not affect players with the `debug` privilege.
|
--- @field minimap_radar boolean?
|
||||||
--- * If a flag equals `nil`, the flag is not modified
|
---
|
||||||
|
--- Allow showing basic debug info that might give a gameplay advantage.
|
||||||
|
--- This includes map seed, player position, look direction, the pointed node and block bounds.
|
||||||
|
--- Does not affect players with the `debug` privilege.
|
||||||
|
--- @field basic_debug boolean?
|
||||||
|
---
|
||||||
|
--- Modifies the client's permission to view chat on the HUD.
|
||||||
|
--- The client may locally elect to not view chat. Does not affect the console.
|
||||||
|
--- @field chat boolean?
|
||||||
|
|
||||||
|
--- Sets specified HUD flags of player.
|
||||||
|
---
|
||||||
|
--- If a flag equals `nil`, the flag is not modified
|
||||||
|
--- @param flags Player.hud_flags
|
||||||
function Player:hud_set_flags(flags) end
|
function Player:hud_set_flags(flags) end
|
||||||
|
|
||||||
--- returns a table of player HUD flags with boolean values.
|
--- Returns a table of player HUD flags with boolean values.
|
||||||
--- * See `hud_set_flags` for a list of flags that can be toggled.
|
--- @return Player.hud_flags
|
||||||
function Player:hud_get_flags() end
|
function Player:hud_get_flags() end
|
||||||
|
|
||||||
--- sets number of items in builtin hotbar
|
--- Sets number of items in builtin hotbar.
|
||||||
---- * `count`: number of items, must be between `1` and `32`
|
---
|
||||||
|
--- If count exceeds the `"main"` list size, the list size will be used instead.
|
||||||
|
--- @param count integer number of items, must be an integer in range [1, 32]
|
||||||
function Player:hud_set_hotbar_itemcount(count) end
|
function Player:hud_set_hotbar_itemcount(count) end
|
||||||
|
|
||||||
--- returns number of visible items
|
--- Returns number of visible items.
|
||||||
|
---
|
||||||
|
--- This value is also clamped by the `"main"` list size.
|
||||||
|
--- @return integer
|
||||||
function Player:hud_get_hotbar_itemcount() end
|
function Player:hud_get_hotbar_itemcount() end
|
||||||
|
|
||||||
--- * sets background image for hotbar
|
--- Sets background image for hotbar.
|
||||||
|
--- @param string
|
||||||
function Player:hud_set_hotbar_image(texturename) end
|
function Player:hud_set_hotbar_image(texturename) end
|
||||||
|
|
||||||
--- returns texturename
|
--- Returns texturename.
|
||||||
|
--- @return string
|
||||||
function Player:hud_get_hotbar_image() end
|
function Player:hud_get_hotbar_image() end
|
||||||
|
|
||||||
--- * sets image for selected item of hotbar
|
--- Sets image for selected item of hotbar.
|
||||||
|
--- @param string
|
||||||
function Player:hud_set_hotbar_selected_image(texturename) end
|
function Player:hud_set_hotbar_selected_image(texturename) end
|
||||||
|
|
||||||
--- returns texturename
|
--- Returns texturename.
|
||||||
|
--- @return string
|
||||||
function Player:hud_get_hotbar_selected_image() end
|
function Player:hud_get_hotbar_selected_image() end
|
||||||
|
|
||||||
|
--- TODO
|
||||||
|
--- @class Player.minimap_mode
|
||||||
|
|
||||||
--- modes_list: {mode, mode, ...}
|
--- modes_list: {mode, mode, ...}
|
||||||
--- * Overrides the available minimap modes (and toggle order), and changes the
|
--- * Overrides the available minimap modes (and toggle order), and changes the
|
||||||
--- selected mode.
|
--- selected mode.
|
||||||
@@ -259,10 +345,13 @@ function Player:hud_get_hotbar_selected_image() end
|
|||||||
--- * `scale`: Only for texture type, scale of the texture map in nodes per
|
--- * `scale`: Only for texture type, scale of the texture map in nodes per
|
||||||
--- pixel (for example a `scale` of 2 means each pixel represents a 2x2
|
--- pixel (for example a `scale` of 2 means each pixel represents a 2x2
|
||||||
--- nodes square)
|
--- nodes square)
|
||||||
--- * `selected_mode` is the mode index to be selected after modes have been changed
|
--- @param modes_list Player.minimap_mode[]
|
||||||
--- (0 is the first mode).
|
--- @param selected_mode integer is the mode index to be selected after modes have been changed (0 is the first mode).
|
||||||
function Player:set_minimap_modes(modes_list, selected_mode) end
|
function Player:set_minimap_modes(modes_list, selected_mode) end
|
||||||
|
|
||||||
|
--- TODO
|
||||||
|
--- @class Player.sky_parameters
|
||||||
|
|
||||||
--- * The presence of the function `set_sun`, `set_moon` or `set_stars` indicates
|
--- * The presence of the function `set_sun`, `set_moon` or `set_stars` indicates
|
||||||
--- whether `set_sky` accepts this format. Check the legacy format otherwise.
|
--- whether `set_sky` accepts this format. Check the legacy format otherwise.
|
||||||
--- * Passing no arguments resets the sky to its default values.
|
--- * Passing no arguments resets the sky to its default values.
|
||||||
@@ -323,10 +412,10 @@ function Player:set_minimap_modes(modes_list, selected_mode) end
|
|||||||
--- * `fog_color`: ColorSpec, override the color of the fog.
|
--- * `fog_color`: ColorSpec, override the color of the fog.
|
||||||
--- Unlike `base_color` above this will apply regardless of the skybox type.
|
--- Unlike `base_color` above this will apply regardless of the skybox type.
|
||||||
--- (default: `"#00000000"`, which means no override)
|
--- (default: `"#00000000"`, which means no override)
|
||||||
--- @param sky_parameters table
|
--- @param sky_parameters Player.sky_parameters
|
||||||
function Player:set_sky(sky_parameters) end
|
function Player:set_sky(sky_parameters) end
|
||||||
|
|
||||||
--- * Deprecated. Use `set_sky(sky_parameters)`
|
--- Deprecated. Use `set_sky(sky_parameters)`
|
||||||
--- * `base_color`: ColorSpec, defaults to white
|
--- * `base_color`: ColorSpec, defaults to white
|
||||||
--- * `type`: Available types:
|
--- * `type`: Available types:
|
||||||
--- * `"regular"`: Uses 0 textures, `bgcolor` ignored
|
--- * `"regular"`: Uses 0 textures, `bgcolor` ignored
|
||||||
@@ -334,20 +423,24 @@ function Player:set_sky(sky_parameters) end
|
|||||||
--- * `"plain"`: Uses 0 textures, `bgcolor` used
|
--- * `"plain"`: Uses 0 textures, `bgcolor` used
|
||||||
--- * `clouds`: Boolean for whether clouds appear in front of `"skybox"` or
|
--- * `clouds`: Boolean for whether clouds appear in front of `"skybox"` or
|
||||||
--- `"plain"` custom skyboxes (default: `true`)
|
--- `"plain"` custom skyboxes (default: `true`)
|
||||||
|
--- @deprecated
|
||||||
function Player:set_sky(base_color, type, texture_names, clouds) end
|
function Player:set_sky(base_color, type, texture_names, clouds) end
|
||||||
|
|
||||||
--- * `as_table`: boolean that determines whether the deprecated version of this
|
--- @param as_table boolean boolean that determines whether the deprecated version of this function is being used.
|
||||||
--- function is being used.
|
--- * `true` returns a table containing sky parameters as defined in `set_sky(sky_parameters)`.
|
||||||
--- * `true` returns a table containing sky parameters as defined in `set_sky(sky_parameters)`.
|
--- * Deprecated: `false` or `nil` returns base_color, type, table of textures, clouds.
|
||||||
--- * Deprecated: `false` or `nil` returns base_color, type, table of textures,
|
--- @return table Player.sky_parameters
|
||||||
--- clouds.
|
|
||||||
function Player:get_sky(as_table) end
|
function Player:get_sky(as_table) end
|
||||||
|
|
||||||
--- * Deprecated: Use `get_sky(as_table)` instead.
|
--- Deprecated: Use `get_sky(as_table)` instead.
|
||||||
--- * returns a table with the `sky_color` parameters as in `set_sky`.
|
---
|
||||||
|
--- Returns a table with the `sky_color` parameters as in `set_sky`.
|
||||||
--- @deprecated
|
--- @deprecated
|
||||||
function Player:get_sky_color() end
|
function Player:get_sky_color() end
|
||||||
|
|
||||||
|
--- TODO
|
||||||
|
---@class Player.sun_parameters
|
||||||
|
|
||||||
--- * Passing no arguments resets the sun to its default values.
|
--- * Passing no arguments resets the sun to its default values.
|
||||||
--- * `sun_parameters` is a table with the following optional fields:
|
--- * `sun_parameters` is a table with the following optional fields:
|
||||||
--- * `visible`: Boolean for whether the sun is visible.
|
--- * `visible`: Boolean for whether the sun is visible.
|
||||||
@@ -365,12 +458,16 @@ function Player:get_sky_color() end
|
|||||||
--- * `scale`: Float controlling the overall size of the sun. (default: `1`)
|
--- * `scale`: Float controlling the overall size of the sun. (default: `1`)
|
||||||
--- Note: For legacy reasons, the sun is bigger than the moon by a factor
|
--- Note: For legacy reasons, the sun is bigger than the moon by a factor
|
||||||
--- of about `1.57` for equal `scale` values.
|
--- of about `1.57` for equal `scale` values.
|
||||||
|
--- @param sun_parameters Player.sun_parameters
|
||||||
function Player:set_sun(sun_parameters) end
|
function Player:set_sun(sun_parameters) end
|
||||||
|
|
||||||
--- returns a table with the current sun parameters as in
|
--- Returns a table with the current sun parameters as in `set_sun`.
|
||||||
--- `set_sun`.
|
--- @return Player.sun_parameters
|
||||||
function Player:get_sun() end
|
function Player:get_sun() end
|
||||||
|
|
||||||
|
--- TODO
|
||||||
|
--- @class Player.moon_parameters
|
||||||
|
|
||||||
--- * Passing no arguments resets the moon to its default values.
|
--- * Passing no arguments resets the moon to its default values.
|
||||||
--- * `moon_parameters` is a table with the following optional fields:
|
--- * `moon_parameters` is a table with the following optional fields:
|
||||||
--- * `visible`: Boolean for whether the moon is visible.
|
--- * `visible`: Boolean for whether the moon is visible.
|
||||||
@@ -386,12 +483,16 @@ function Player:get_sun() end
|
|||||||
--- * `scale`: Float controlling the overall size of the moon (default: `1`)
|
--- * `scale`: Float controlling the overall size of the moon (default: `1`)
|
||||||
--- Note: For legacy reasons, the sun is bigger than the moon by a factor
|
--- Note: For legacy reasons, the sun is bigger than the moon by a factor
|
||||||
--- of about `1.57` for equal `scale` values.
|
--- of about `1.57` for equal `scale` values.
|
||||||
|
--- @param moon_parameters Player.moon_parameters
|
||||||
function Player:set_moon(moon_parameters) end
|
function Player:set_moon(moon_parameters) end
|
||||||
|
|
||||||
--- returns a table with the current moon parameters as in
|
--- Returns a table with the current moon parameters as in `set_moon`.
|
||||||
--- `set_moon`.
|
--- @return Player.moon_parameters
|
||||||
function Player:get_moon() end
|
function Player:get_moon() end
|
||||||
|
|
||||||
|
--- TODO
|
||||||
|
--- @class Player.star_parameters
|
||||||
|
|
||||||
--- * Passing no arguments resets stars to their default values.
|
--- * Passing no arguments resets stars to their default values.
|
||||||
--- * `star_parameters` is a table with the following optional fields:
|
--- * `star_parameters` is a table with the following optional fields:
|
||||||
--- * `visible`: Boolean for whether the stars are visible.
|
--- * `visible`: Boolean for whether the stars are visible.
|
||||||
@@ -406,12 +507,16 @@ function Player:get_moon() end
|
|||||||
--- alpha channel is used to set overall star brightness.
|
--- alpha channel is used to set overall star brightness.
|
||||||
--- (default: `#ebebff69`)
|
--- (default: `#ebebff69`)
|
||||||
--- * `scale`: Float controlling the overall size of the stars (default: `1`)
|
--- * `scale`: Float controlling the overall size of the stars (default: `1`)
|
||||||
|
--- @param star_parameters Player.star_parameters
|
||||||
function Player:set_stars(star_parameters) end
|
function Player:set_stars(star_parameters) end
|
||||||
|
|
||||||
--- returns a table with the current stars parameters as in
|
--- Returns a table with the current stars parameters as in `set_stars`.
|
||||||
--- `set_stars`.
|
--- @return Player.star_parameters
|
||||||
function Player:get_stars() end
|
function Player:get_stars() end
|
||||||
|
|
||||||
|
--- TODO
|
||||||
|
--- @class Player.cloud_parameters
|
||||||
|
|
||||||
--- set cloud parameters
|
--- set cloud parameters
|
||||||
--- * Passing no arguments resets clouds to their default values.
|
--- * Passing no arguments resets clouds to their default values.
|
||||||
--- * `cloud_parameters` is a table with the following optional fields:
|
--- * `cloud_parameters` is a table with the following optional fields:
|
||||||
@@ -425,46 +530,80 @@ function Player:get_stars() end
|
|||||||
--- * `thickness`: cloud thickness in nodes (default `16`)
|
--- * `thickness`: cloud thickness in nodes (default `16`)
|
||||||
--- * `speed`: 2D cloud speed + direction in nodes per second
|
--- * `speed`: 2D cloud speed + direction in nodes per second
|
||||||
--- (default `{x=0, z=-2}`).
|
--- (default `{x=0, z=-2}`).
|
||||||
|
--- @param cloud_parameters Player.cloud_parameters
|
||||||
function Player:set_clouds(cloud_parameters) end
|
function Player:set_clouds(cloud_parameters) end
|
||||||
|
|
||||||
--- returns a table with the current cloud parameters as in
|
--- Returns a table with the current cloud parameters as in `set_clouds`.
|
||||||
--- `set_clouds`.
|
--- @return Player.cloud_parameters
|
||||||
function Player:get_clouds() end
|
function Player:get_clouds() end
|
||||||
|
|
||||||
|
--- @param ratio number? Value:
|
||||||
--- * `0`...`1`: Overrides day-night ratio, controlling sunlight to a specific
|
--- * `0`...`1`: Overrides day-night ratio, controlling sunlight to a specific
|
||||||
--- amount.
|
--- amount.
|
||||||
--- * `nil`: Disables override, defaulting to sunlight based on day-night cycle
|
--- * `nil`: Disables override, defaulting to sunlight based on day-night cycle
|
||||||
function Player:override_day_night_ratio(ratio) end
|
function Player:override_day_night_ratio(ratio) end
|
||||||
|
|
||||||
--- returns the ratio or nil if it isn't overridden
|
--- Returns the ratio or nil if it isn't overridden.
|
||||||
|
--- @return number?
|
||||||
function Player:get_day_night_ratio() end
|
function Player:get_day_night_ratio() end
|
||||||
|
|
||||||
--- set animation for player model in third person view.
|
--- @alias Player.local_animation {x:integer, y:integer}
|
||||||
--- * Every animation equals to a `{x=starting frame, y=ending frame}` table.
|
|
||||||
--- * `frame_speed` sets the animations frame speed. Default is 30.
|
--- Set animation for player model in third person view.
|
||||||
|
--- @param idle Player.local_animation
|
||||||
|
--- @param walk Player.local_animation
|
||||||
|
--- @param dig Player.local_animation
|
||||||
|
--- @param walk_while_dig Player.local_animation
|
||||||
|
--- @param frame_speed integer sets the animations frame speed. Default is 30.
|
||||||
function Player:set_local_animation(idle, walk, dig, walk_while_dig, frame_speed) end
|
function Player:set_local_animation(idle, walk, dig, walk_while_dig, frame_speed) end
|
||||||
|
|
||||||
--- returns idle, walk, dig, walk_while_dig tables and
|
--- Returns idle, walk, dig, walk_while_dig tables and `frame_speed`.
|
||||||
--- `frame_speed`.
|
--- @return Player.local_animation idle
|
||||||
|
--- @return Player.local_animation walk
|
||||||
|
--- @return Player.local_animation dig
|
||||||
|
--- @return Player.local_animation walk_while_dig
|
||||||
|
--- @return integer frame_speed
|
||||||
function Player:get_local_animation() end
|
function Player:get_local_animation() end
|
||||||
|
|
||||||
--- defines offset vectors for
|
--- Sets camera offset vectors.
|
||||||
--- camera per player. An argument defaults to `{x=0, y=0, z=0}` if unspecified.
|
|
||||||
--- * in first person view
|
--- * in first person view
|
||||||
--- * in third person view (max. values `{x=-10/10,y=-10,15,z=-5/5}`)
|
--- * in third person view (max. values `{x=-10/10,y=-10,15,z=-5/5}`)
|
||||||
--- v -- [firstperson, thirdperson]
|
--- v -- [firstperson, thirdperson]
|
||||||
function Player:set_eye_offset(v) end
|
--- @param firstperson vector? Offset in first person view. Defaults to vector.zero() if unspecified
|
||||||
|
--- @param thirdperson_back vector? Offset in third person back view. Clamped between `vector.new(-10, -10, -5)` and `vector.new(10, 15, 5)`. Defaults to `vector.zero()` if unspecified.
|
||||||
|
--- @param thirdperson_front vector? Offset in third person front view. Same limits as for `thirdperson_back` apply. Defaults to `thirdperson_back` if unspecified.
|
||||||
|
function Player:set_eye_offset(firstperson, thirdperson_back, thirdperson_front) end
|
||||||
|
|
||||||
--- returns first and third person offsets.
|
--- Returns first and third person offsets.
|
||||||
|
--- @return vector firstperson
|
||||||
|
--- @return vector thirdperson_back
|
||||||
|
--- @return vector thirdperson_front
|
||||||
function Player:get_eye_offset() end
|
function Player:get_eye_offset() end
|
||||||
|
|
||||||
--- * Sends an already loaded mapblock to the player.
|
--- TODO
|
||||||
--- * Returns `false` if nothing was sent (note that this can also mean that
|
--- @class Player.camera_params
|
||||||
--- the client already has the block)
|
|
||||||
--- * Resource intensive - use sparsely
|
--- Sets camera parameters.
|
||||||
|
--- @param params Player.camera_params
|
||||||
|
function Player:set_camera(params) end
|
||||||
|
|
||||||
|
--- Returns the camera parameters.
|
||||||
|
--- @return Player.camera_params
|
||||||
|
function Player:get_camera() end
|
||||||
|
|
||||||
|
--- Sends an already loaded mapblock to the player.
|
||||||
|
---
|
||||||
|
--- Returns `false` if nothing was sent (note that this can also mean that
|
||||||
|
--- the client already has the block)
|
||||||
|
---
|
||||||
|
--- Resource intensive - use sparsely
|
||||||
|
--- @return boolean
|
||||||
function Player:send_mapblock(blockpos) end
|
function Player:send_mapblock(blockpos) end
|
||||||
|
|
||||||
--- sets lighting for the player
|
--- TODO
|
||||||
|
--- @class Player.light_definition
|
||||||
|
|
||||||
|
--- Sets lighting for the player.
|
||||||
--- * `light_definition` is a table with the following optional fields:
|
--- * `light_definition` is a table with the following optional fields:
|
||||||
--- * `saturation` sets the saturation (vividness).
|
--- * `saturation` sets the saturation (vividness).
|
||||||
--- values > 1 increase the saturation
|
--- values > 1 increase the saturation
|
||||||
@@ -473,12 +612,34 @@ function Player:send_mapblock(blockpos) end
|
|||||||
--- * `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)
|
--- * `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.
|
--- * This value has no effect on clients who have the "Dynamic Shadows" shader disabled.
|
||||||
|
--- @param light_definition Player.light_definition
|
||||||
function Player:set_lighting(light_definition) end
|
function Player:set_lighting(light_definition) end
|
||||||
|
|
||||||
--- returns the current state of lighting for the player.
|
--- Returns the current state of lighting for the player.
|
||||||
--- * Result is a table with the same fields as `light_definition` in `set_lighting`.
|
--- * Result is a table with the same fields as `light_definition` in `set_lighting`.
|
||||||
|
--- @return Player.light_definition
|
||||||
function Player:get_lighting() end
|
function Player:get_lighting() end
|
||||||
|
|
||||||
--- Respawns the player using the same mechanism as the death screen,
|
--- Respawns the player using the same mechanism as the death screen,
|
||||||
--- including calling on_respawnplayer callbacks.
|
--- including calling `on_respawnplayer` callbacks.
|
||||||
function Player:respawn() end
|
function Player:respawn() end
|
||||||
|
|
||||||
|
--- @class Player.flags
|
||||||
|
--- Whether breathing (regaining air) is enabled, default `true`.
|
||||||
|
--- @field breathing boolean?
|
||||||
|
---
|
||||||
|
--- Whether drowning (losing air) is enabled, default `true`.
|
||||||
|
--- @field drowning boolean?
|
||||||
|
---
|
||||||
|
--- Whether the player takes damage from nodes, default true.
|
||||||
|
--- @field node_damage boolean?
|
||||||
|
|
||||||
|
--- Sets player flags.
|
||||||
|
---
|
||||||
|
--- Absent fields are left unchanged.
|
||||||
|
--- @param flags Player.flags
|
||||||
|
function Player:set_flags(flags) end
|
||||||
|
|
||||||
|
--- Returns a table of player flags.
|
||||||
|
--- @return Player.flags
|
||||||
|
function Player:get_flags() end
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
vector = {}
|
vector = {}
|
||||||
|
|
||||||
--- Same as `vector`, but all fields are integers.
|
--- Same as `vector`, but all fields are integers.
|
||||||
--- @class IntegerVector: vector
|
--- @class IntegerVector: vector, IntegerPosition
|
||||||
--- @operator eq : boolean
|
--- @operator eq : boolean
|
||||||
--- @operator unm : IntegerVector
|
--- @operator unm : IntegerVector
|
||||||
--- @operator add(Position): IntegerVector
|
--- @operator add(Position): IntegerVector
|
||||||
|
|||||||
@@ -571,14 +571,14 @@ function core.register_craft_predict(callback) end
|
|||||||
--- moved. A value of `-1` for `take` will make the source stack infinite.
|
--- moved. A value of `-1` for `take` will make the source stack infinite.
|
||||||
---
|
---
|
||||||
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L4720-L4731)
|
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L4720-L4731)
|
||||||
--- @param callback fun(player:ObjectRef, action:"move"|"put"|"take", inventory:InvRef, inventory_info:table)
|
--- @param callback fun(player:ObjectRef|Player, action:"move"|"put"|"take", inventory:InvRef, inventory_info:table):integer?
|
||||||
function core.register_allow_player_inventory_action(callback) end
|
function core.register_allow_player_inventory_action(callback) end
|
||||||
--- * Called after a take, put or move event from/to/in a player inventory
|
--- * Called after a take, put or move event from/to/in a player inventory
|
||||||
--- * Function arguments: see `core.register_allow_player_inventory_action`
|
--- * Function arguments: see `core.register_allow_player_inventory_action`
|
||||||
--- * Does not accept or handle any return value.
|
--- * Does not accept or handle any return value.
|
||||||
---
|
---
|
||||||
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L4732-L4735)
|
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L4732-L4735)
|
||||||
--- @param callback fun(player:ObjectRef, action:"move"|"put"|"take", inventory:InvRef, inventory_info:table)
|
--- @param callback fun(player:ObjectRef|Player, action:"move"|"put"|"take", inventory:InvRef, inventory_info:table):integer?
|
||||||
function core.register_on_player_inventory_action(callback) end
|
function core.register_on_player_inventory_action(callback) end
|
||||||
--- * Called by `builtin` and mods when a player violates protection at a
|
--- * Called by `builtin` and mods when a player violates protection at a
|
||||||
--- position (eg, digs a node or punches a protected entity).
|
--- position (eg, digs a node or punches a protected entity).
|
||||||
@@ -2039,6 +2039,9 @@ function core.get_position_from_hash(hash) end
|
|||||||
--- * Get rating of a group of an item. (`0` means: not in group)
|
--- * Get rating of a group of an item. (`0` means: not in group)
|
||||||
---
|
---
|
||||||
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L5654-L5655)
|
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L5654-L5655)
|
||||||
|
--- @param name string
|
||||||
|
--- @param group string
|
||||||
|
--- @return integer
|
||||||
function core.get_item_group(name, group) end
|
function core.get_item_group(name, group) end
|
||||||
--- Returns a rating
|
--- Returns a rating
|
||||||
--- * Deprecated: An alias for the former.
|
--- * Deprecated: An alias for the former.
|
||||||
|
|||||||
@@ -1,54 +1,54 @@
|
|||||||
--- @meta
|
--- @meta
|
||||||
|
|
||||||
|
|
||||||
--- @class ABMDefinition
|
--- @class ABMDefinition
|
||||||
local ABMDefinition = {
|
local ABMDefinition = {
|
||||||
--- Descriptive label for profiling purposes (optional).
|
--- Descriptive label for profiling purposes (optional).
|
||||||
--- Definitions with identical labels will be listed as one.
|
--- Definitions with identical labels will be listed as one.
|
||||||
--- @type string
|
--- @type string?
|
||||||
label = "Lava cooling",
|
label = "Lava cooling",
|
||||||
|
|
||||||
--- Apply `action` function to these nodes.
|
--- Apply `action` function to these nodes.
|
||||||
--- `group:groupname` can also be used here.
|
--- `group:groupname` can also be used here.
|
||||||
--- @type string[]
|
--- @type string[]
|
||||||
nodenames = { "default:lava_source" },
|
nodenames = { "default:lava_source" },
|
||||||
|
|
||||||
--- Only apply `action` to nodes that have one of, or any
|
--- Only apply `action` to nodes that have one of, or any
|
||||||
--- combination of, these neighbors.
|
--- combination of, these neighbors.
|
||||||
--- If left out or empty, any neighbor will do.
|
--- If left out or empty, any neighbor will do.
|
||||||
--- `group:groupname` can also be used here.
|
--- `group:groupname` can also be used here.
|
||||||
--- @type string[]
|
--- @type string[]?
|
||||||
neighbors = { "default:water_source", "default:water_flowing" },
|
neighbors = { "default:water_source", "default:water_flowing" },
|
||||||
|
|
||||||
--- Only apply `action` to nodes that have no one of these neighbors.
|
--- Only apply `action` to nodes that have no one of these neighbors.
|
||||||
--- If left out or empty, it has no effect.
|
--- If left out or empty, it has no effect.
|
||||||
--- `group:groupname` can also be used here.
|
--- `group:groupname` can also be used here.
|
||||||
--- @type string[]
|
--- @type string[]?
|
||||||
without_neighbors = { "default:lava_source", "default:lava_flowing" },
|
without_neighbors = { "default:lava_source", "default:lava_flowing" },
|
||||||
|
|
||||||
--- Operation interval in seconds
|
--- Operation interval in seconds
|
||||||
--- @type number
|
--- @type number
|
||||||
interval = 10.0,
|
interval = 10.0,
|
||||||
|
|
||||||
--- Probability of triggering `action` per-node per-interval is 1.0 / chance (integers only)
|
--- Probability of triggering `action` per-node per-interval is 1.0 / chance
|
||||||
--- @type number
|
--- integer [u32] (value 0 is treated as 1)
|
||||||
chance = 50,
|
--- @type integer
|
||||||
|
chance = 50,
|
||||||
|
|
||||||
--- min and max height levels where ABM will be processed (inclusive)
|
--- min and max height levels where ABM will be processed (inclusive)
|
||||||
--- can be used to reduce CPU usage
|
--- can be used to reduce CPU usage
|
||||||
--- @type number
|
--- @type integer?
|
||||||
min_y = -32768,
|
min_y = -32768,
|
||||||
--- min and max height levels where ABM will be processed (inclusive)
|
--- min and max height levels where ABM will be processed (inclusive)
|
||||||
--- can be used to reduce CPU usage
|
--- can be used to reduce CPU usage
|
||||||
--- @type number
|
--- @type integer?
|
||||||
max_y = 32767,
|
max_y = 32767,
|
||||||
|
|
||||||
--- If true, catch-up behavior is enabled: The `chance` value is
|
--- If true, catch-up behavior is enabled: The `chance` value is
|
||||||
--- temporarily reduced when returning to an area to simulate time lost
|
--- temporarily reduced when returning to an area to simulate time lost
|
||||||
--- by the area being unattended. Note that the `chance` value can often
|
--- by the area being unattended. Note that the `chance` value can often
|
||||||
--- be reduced to 1.
|
--- be reduced to 1.
|
||||||
--- @type boolean
|
--- @type boolean?
|
||||||
catch_up = true,
|
catch_up = true,
|
||||||
|
|
||||||
--- Function triggered for each qualifying node.
|
--- Function triggered for each qualifying node.
|
||||||
--- `active_object_count` is number of active objects in the node's
|
--- `active_object_count` is number of active objects in the node's
|
||||||
@@ -57,6 +57,6 @@ local ABMDefinition = {
|
|||||||
--- mapblock plus all 26 neighboring mapblocks. If any neighboring
|
--- mapblock plus all 26 neighboring mapblocks. If any neighboring
|
||||||
--- mapblocks are unloaded an estimate is calculated for them based on
|
--- mapblocks are unloaded an estimate is calculated for them based on
|
||||||
--- loaded mapblocks.
|
--- loaded mapblocks.
|
||||||
--- @type fun(pos:MapPosition, node:NodeTable, active_object_count:number, active_object_count_wider:number)
|
--- @type fun(pos:MapVector, node:NodeTable, active_object_count:integer, active_object_count_wider:integer)
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider) end,
|
action = function(pos, node, active_object_count, active_object_count_wider) end,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,42 +1,41 @@
|
|||||||
--- @meta
|
--- @meta
|
||||||
|
|
||||||
|
|
||||||
--- @class LBMDefinition
|
--- @class LBMDefinition
|
||||||
local LBMDefinition = {
|
local LBMDefinition = {
|
||||||
--- Descriptive label for profiling purposes (optional).
|
--- Descriptive label for profiling purposes (optional).
|
||||||
--- Definitions with identical labels will be listed as one.
|
--- Definitions with identical labels will be listed as one.
|
||||||
--- @type string
|
--- @type string?
|
||||||
label = "Upgrade legacy doors",
|
label = "Upgrade legacy doors",
|
||||||
|
|
||||||
--- Identifier of the LBM, should follow the modname:<whatever> convention
|
--- Identifier of the LBM, should follow the modname:<whatever> convention
|
||||||
--- @type string
|
--- @type string
|
||||||
name = "modname:replace_legacy_door",
|
name = "modname:replace_legacy_door",
|
||||||
|
|
||||||
--- - List of node names to trigger the LBM on.
|
--- - List of node names to trigger the LBM on.
|
||||||
--- - Names of non-registered nodes and groups (as group:groupname) will work as well.
|
--- - Names of non-registered nodes and groups (as group:groupname) will work as well.
|
||||||
--- @type string[]
|
--- @type string[]
|
||||||
nodenames = {"default:lava_source"},
|
nodenames = {"default:lava_source"},
|
||||||
|
|
||||||
--- If `false`: The LBM only runs on mapblocks the first time they are
|
--- If `false`: The LBM only runs on mapblocks the first time they are
|
||||||
--- activated after the LBM was introduced.
|
--- activated after the LBM was introduced.
|
||||||
--- It never runs on mapblocks generated after the LBM's introduction.
|
--- It never runs on mapblocks generated after the LBM's introduction.
|
||||||
--- See above for details: https://api.luanti.org/definition-tables/#lbm-loadingblockmodifier-definition
|
--- See above for details: https://api.luanti.org/definition-tables/#lbm-loadingblockmodifier-definition
|
||||||
---
|
---
|
||||||
--- If `true`: The LBM runs every time a mapblock is activated.
|
--- If `true`: The LBM runs every time a mapblock is activated.
|
||||||
--- @type boolean?
|
--- @type boolean?
|
||||||
run_at_every_load = false,
|
run_at_every_load = false,
|
||||||
|
|
||||||
--- Function triggered for each qualifying node.
|
--- Function triggered for each qualifying node.
|
||||||
--- `dtime` is the in-game time (in seconds) elapsed since the mapblock
|
--- `dtime` is the in-game time (in seconds) elapsed since the mapblock
|
||||||
--- was last active (available since 5.7.0).
|
--- was last active (available since 5.7.0).
|
||||||
--- @type fun(pos:MapPosition, node:NodeTable, dtime:number)?
|
--- @type fun(pos:MapVector, node:NodeTable, dtime:number)?
|
||||||
action = function(pos, node, dtime) end,
|
action = function(pos, node, dtime) end,
|
||||||
|
|
||||||
--- Function triggered with a list of all applicable node positions at once.
|
--- Function triggered with a list of all applicable node positions at once.
|
||||||
--- - This can be provided as an alternative to `action` (not both).
|
--- - This can be provided as an alternative to `action` (not both).
|
||||||
--- - Available since `core.features.bulk_lbms` (5.10.0)
|
--- - Available since `core.features.bulk_lbms` (5.10.0)
|
||||||
--- - `dtime` is the in-game time (in seconds) elapsed since the mapblock
|
--- - `dtime` is the in-game time (in seconds) elapsed since the mapblock
|
||||||
--- was last active (available since 5.7.0).
|
--- was last active (available since 5.7.0).
|
||||||
--- @type fun(pos_list:MapPosition[], dtime:number)?
|
--- @type fun(pos_list:MapVector[], dtime:number)?
|
||||||
bulk_action = function(pos_list, dtime) end,
|
bulk_action = function(pos_list, dtime) end,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2022-present [Александр Чибрикин](https://github.com/alek13) & [Lord Team](https://github.com/lord-server/lord?tab=readme-ov-file#contributors--%D1%83%D1%87%D0%B0%D1%81%D1%82%D0%BD%D0%B8%D0%BA%D0%B8)
|
Copyright (c) 2022-2026 Apancore.Studio, Van (varttist), [Александр Чибрикин](https://github.com/alek13) & [Lord Team](https://github.com/lord-server/lord?tab=readme-ov-file#contributors--%D1%83%D1%87%D0%B0%D1%81%D1%82%D0%BD%D0%B8%D0%BA%D0%B8)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
|||||||
73
readme.md
73
readme.md
@@ -1,79 +1,24 @@
|
|||||||
# Luanti IDE Helper
|
# SMC Luanti IDE Helper
|
||||||
[](https://github.com/lord-server/lord?tab=readme-ov-file#contributors--%D1%83%D1%87%D0%B0%D1%81%D1%82%D0%BD%D0%B8%D0%BA%D0%B8)
|
|
||||||
[](https://boosty.to/lord-server)
|
|
||||||
[](./license.md)
|
|
||||||
|
|
||||||
|
[](https://github.com/lord-server/lord?tab=readme-ov-file#contributors--%D1%83%D1%87%D0%B0%D1%81%D1%82%D0%BD%D0%B8%D0%BA%D0%B8)
|
||||||
|
[](./license.md)
|
||||||
|
|
||||||
A helper package for [Luanti](https://www.luanti.org/) (Minetest) mod/game development that provides autocompletion and documentation for IDE integration.
|
A helper package for [Luanti](https://www.luanti.org/) (Minetest) mod/game development that provides autocompletion and documentation for IDE integration.
|
||||||
|
|
||||||

|
Please note **that this is a fork** of [luanti-ide-helper](https://github.com/Voxrame/luanti-ide-helper). The original repository was developed and is maintained by [Lord Team](https://github.com/lord-server/lord?tab=readme-ov-file#contributors--%D1%83%D1%87%D0%B0%D1%81%D1%82%D0%BD%D0%B8%D0%BA%D0%B8).
|
||||||
|
|
||||||
|
This ide-helper is specifically designed to support the [SMC game](https://git.apancore.ru/Apancore.Studio/simple-makes-complex), may interpret the Luanti API Reference in a biased manner, and may not be suitable for other projects. The developers provide no guarantees regarding the suitability of using the current version of ide-helper in third-party projects, including no guarantee of backward compatibility.
|
||||||
|
|
||||||
|
**We recommend using and supporting the [original ide-helper](https://github.com/Voxrame/luanti-ide-helper) repository.**
|
||||||
|
|
||||||
## Supported IDEs & Plugins
|
## Supported IDEs & Plugins
|
||||||
|
|
||||||
- IntelliJ IDEA (or compatible) with [EmmyLua2 Plugin](https://plugins.jetbrains.com/plugin/25076-emmylua2)
|
- IntelliJ IDEA (or compatible) with [EmmyLua2 Plugin](https://plugins.jetbrains.com/plugin/25076-emmylua2)
|
||||||
- VS Code with [EmmyLua Extension](https://marketplace.visualstudio.com/items?itemName=tangzx.emmylua) (recommended for VS Code)
|
- VS Code with [EmmyLua Extension](https://marketplace.visualstudio.com/items?itemName=tangzx.emmylua) (recommended for VS Code)
|
||||||
- VS Code with [Lua Language Server](https://marketplace.visualstudio.com/items?itemName=sumneko.lua)
|
- VS Code with [Lua Language Server](https://marketplace.visualstudio.com/items?itemName=sumneko.lua)
|
||||||
- Any editor with LSP support.
|
- Any editor with LSP support.
|
||||||
Install Lua LS: `cargo install emmylua_ls` (or see [instalation guide](https://github.com/EmmyLuaLs/emmylua-analyzer-rust?tab=readme-ov-file#-installation))
|
Install Lua LS: `cargo install emmylua_ls` (or see [instalation guide](https://github.com/EmmyLuaLs/emmylua-analyzer-rust?tab=readme-ov-file#-installation))
|
||||||
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
### For Mod Developers
|
|
||||||
|
|
||||||
1. Download or clone this repository to your local machine:
|
|
||||||
```bash
|
|
||||||
git clone https://github.com/Voxrame/luanti-ide-helper.git
|
|
||||||
```
|
|
||||||
2. Configure your IDE to use the library path:
|
|
||||||
- VS Code with [EmmyLua](https://marketplace.visualstudio.com/items?itemName=tangzx.emmylua) (recommended):
|
|
||||||
Add to your workspace settings (`.vscode/settings.json`):
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"emmylua.workspace.library": [
|
|
||||||
"path/to/luanti-ide-helper"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### For Game Developers
|
|
||||||
|
|
||||||
We recommend to keep this annotation package right in your repository as a Git submodule. This ensures all team members and contributors automatically get the same IDE assistance without additional configuration.
|
|
||||||
|
|
||||||
1. Add this repository as a submodule to your project:
|
|
||||||
```bash
|
|
||||||
git submodule add https://github.com/Voxrame/luanti-ide-helper.git util/ide-helper
|
|
||||||
```
|
|
||||||
1. Create configuration files for your team in repository:
|
|
||||||
`.emmyrc.json` (for all IDEs):
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"$schema": "https://raw.githubusercontent.com/EmmyLuaLs/emmylua-analyzer-rust/refs/heads/main/crates/emmylua_code_analysis/resources/schema.json",
|
|
||||||
"workspace.library": [
|
|
||||||
"util/ide-helper"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
`.vscode/extensions.json` (recommends EmmyLua for VS Code users):
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"recommendations": [
|
|
||||||
"tangzx.emmylua"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
1. Update the submodule when needed:
|
|
||||||
```bash
|
|
||||||
git submodule update --remote util/ide-helper
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## Development
|
|
||||||
|
|
||||||
Issues & PRs welcome.
|
|
||||||
> **Info:** This project was started as part of [Lord Game](https://github.com/lord-server/lord). And then was extracted with original commit history and issue references are preserved as `lord-server/lord#<issue_number>`.
|
|
||||||
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
This project is licensed under the MIT License - see [`license.md`](./license.md) file for details.
|
This project is licensed under the MIT License - see [`license.md`](./license.md) file for details.
|
||||||
Reference in New Issue
Block a user