--- @meta --- @class Player: ObjectRef Player = {} --- @return InvRef function Player:get_inventory() end --- Returns player name or `""` if is not a player. --- @return string function Player:get_player_name() end --- **DEPRECATED**, use `get_velocity()` instead. --- table {x, y, z} representing the player's instantaneous velocity in nodes/s --- @deprecated function Player:get_player_velocity() end --- **DEPRECATED**, use `add_velocity(vel)` instead. --- @deprecated function Player:add_player_velocity(vel) end --- Get camera direction as a unit vector. --- @return vector function Player:get_look_dir() end --- Pitch in radians. --- --- Angle ranges between -pi/2 and pi/2, which are straight up and down respectively. --- @return number function Player:get_look_vertical() end --- Yaw in radians. --- --- Angle is counter-clockwise from the +z direction. --- @return number function Player:get_look_horizontal() end --- Sets look pitch. --- @param radians number Angle from looking forward, where positive is downwards. function Player:set_look_vertical(radians) end --- Sets look yaw. --- @param radians number Angle from the +z direction, where positive is counter-clockwise. function Player:set_look_horizontal(radians) end --- Pitch in radians - Deprecated as broken. Use `get_look_vertical`. --- @deprecated function Player:get_look_pitch() end --- Yaw in radians - Deprecated as broken. Use `get_look_horizontal`. --- @deprecated function Player:get_look_yaw() end --- Sets look pitch - Deprecated. Use `set_look_vertical`. --- @deprecated function Player:set_look_pitch(radians) end --- Sets look yaw - Deprecated. Use `set_look_horizontal`. --- @deprecated function Player:set_look_yaw(radians) end --- Returns player's breath. --- @return integer function Player:get_breath() end --- Sets player's breath --- --- values: --- * `0`: player is drowning --- * max: bubbles bar is not shown --- * 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 --- Sets player's FOV. --- --- Set `fov` to 0 to clear FOV override. --- @param fov integer FOV value. --- @param is_multiplier boolean Set to `true` if the FOV value is a multiplier. Defaults to `false`. --- @param transition_time number `transition_time`: If defined, enables smooth FOV transition. --- Interpreted as the time (in seconds) to reach target FOV. --- If set to 0, FOV change is instantaneous. Defaults to 0. function Player:set_fov(fov, is_multiplier, transition_time) end --- Returns the FOV. --- @return integer fov Server-sent FOV value. Returns 0 if an FOV override doesn't exist. --- @return boolean is_multiplier Boolean indicating whether the FOV value is a multiplier. --- @return number transition_time Time (in seconds) taken for the FOV transition. Set by `set_fov`. function Player:get_fov() end --- DEPRECATED, use `get_meta()` instead --- * Sets an extra attribute with value on player. --- * `value` must be a string, or a number which will be converted to a --- string. --- * If `value` is `nil`, remove attribute from player. --- @deprecated function Player:set_attribute(attribute, value) end --- DEPRECATED, use `get_meta()` instead --- * Returns value (a string) for extra attribute. --- * Returns `nil` if no attribute found. --- @deprecated function Player:get_attribute(attribute) end --- Returns metadata associated with the player (a PlayerMetaRef). --- @return PlayerMetaRef function Player:get_meta() end --- Redefines the player's inventory formspec. --- --- 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 --- Returns a formspec string. --- @return string function Player:get_inventory_formspec() end --- The formspec string will be added to every formspec shown to the user, --- 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. --- --- Only affects formspecs shown after this is called. --- @param formspec string function Player:set_formspec_prepend(formspec) end --- Returns a formspec string. --- @return string function Player:get_formspec_prepend(formspec) end --- @alias Player.controls_key 'up'|'down'|'left'|'right'|'jump'|'aux1'|'sneak'|'dig'|'place'|'LMB'|'RBM'|'zoom'|'movement_x'|'movement_y' --- Returns table with player pressed keys --- --- 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 function Player:get_player_control() end --- Returns integer with bit packed player pressed keys. --- --- Bits: --- * 0 - up --- * 1 - down --- * 2 - left --- * 3 - right --- * 4 - jump --- * 5 - aux1 --- * 6 - sneak --- * 7 - dig --- * 8 - place --- * 9 - zoom --- --- Returns `0` (no bits set) if the object is not a player. --- @return number function Player:get_player_control_bits() end --- @class Player.physics_override_table --- Multiplier to all movement speed (`speed_*`) --- and acceleration (`acceleration_*`) values (default: `1`) --- @field speed number? --- --- Multiplier to default walk speed value (default: `1`). --- Note: The actual walk speed is the product of `speed` and `speed_walk` --- @field speed_walk number? --- --- Multiplier to default climb speed value (default: `1`). --- Note: The actual climb speed is the product of `speed` and `speed_climb` --- @field speed_climb number? --- --- Multiplier to default crouch speed value (default: `1`). --- Note: The actual crouch speed is the product of `speed` and `speed_crouch` --- @field speed_crouch number? --- --- 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? --- Overrides the physics attributes of the player --- Note: All numeric fields above modify a corresponding movement_* setting. --- @param override_table Player.physics_override_table function Player:set_physics_override(override_table) end --- Returns the table given to `set_physics_override`. --- @return Player.physics_override_table function Player:get_physics_override() end --- Add a HUD element described by HUD def, returns ID number on success. --- @param hud_definition HudDefinition --- @return integer function Player:hud_add(hud_definition) end --- Remove the HUD element of the specified id. --- @param id integer function Player:hud_remove(id) end --- Change a value of a previously added HUD element. --- @param id integer --- @param stat string supports the same keys as in the hud definition table except for `"type"` (or the deprecated `"hud_elem_type"`). --- @param value any function Player:hud_change(id, stat, value) end --- Gets the HUD element definition structure of the specified ID. --- @param id integer --- @return HudDefinition function Player:hud_get(id) end --- @class Player.hud_flags --- @field hotbar boolean? --- @field healthbar boolean? --- @field crosshair boolean? --- @field wielditem boolean? --- @field breathbar boolean? --- --- Modifies the client's permission to view the minimap. --- The client may locally elect to not view the minimap --- @field minimap boolean? --- --- Is only usable when `minimap` is true --- @field minimap_radar boolean? --- --- 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 --- Returns a table of player HUD flags with boolean values. --- @return Player.hud_flags function Player:hud_get_flags() end --- Sets number of items in builtin hotbar. --- --- 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 --- Returns number of visible items. --- --- This value is also clamped by the `"main"` list size. --- @return integer function Player:hud_get_hotbar_itemcount() end --- Sets background image for hotbar. --- @param string function Player:hud_set_hotbar_image(texturename) end --- Returns texturename. --- @return string function Player:hud_get_hotbar_image() end --- Sets image for selected item of hotbar. --- @param string function Player:hud_set_hotbar_selected_image(texturename) end --- Returns texturename. --- @return string function Player:hud_get_hotbar_selected_image() end --- TODO --- @class Player.minimap_mode --- modes_list: {mode, mode, ...} --- * Overrides the available minimap modes (and toggle order), and changes the --- selected mode. --- * `mode` is a table consisting of up to four fields: --- * `type`: Available type: --- * `off`: Minimap off --- * `surface`: Minimap in surface mode --- * `radar`: Minimap in radar mode --- * `texture`: Texture to be displayed instead of terrain map --- (texture is centered around 0,0 and can be scaled). --- Texture size is limited to 512 x 512 pixel. --- * `label`: Optional label to display on minimap mode toggle --- The translation must be handled within the mod. --- * `size`: Sidelength or diameter, in number of nodes, of the terrain --- displayed in minimap --- * `texture`: Only for texture type, name of the texture to display --- * `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 --- nodes square) --- @param modes_list Player.minimap_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 --- TODO --- @class Player.sky_parameters --- * The presence of the function `set_sun`, `set_moon` or `set_stars` indicates --- whether `set_sky` accepts this format. Check the legacy format otherwise. --- * Passing no arguments resets the sky to its default values. --- * `sky_parameters` is a table with the following optional fields: --- * `base_color`: ColorSpec, changes fog in "skybox" and "plain". (default: `#ffffff`) --- * `body_orbit_tilt`: Float, rotation angle of sun/moon orbit in degrees. --- By default, orbit is controlled by a client-side setting, and this field is not set. --- After a value is assigned, it can only be changed to another float value. --- Valid range [-60.0,60.0] (default: not set) --- * `type`: Available types: --- * `"regular"`: Uses 0 textures, `base_color` ignored --- * `"skybox"`: Uses 6 textures, `base_color` used as fog. --- * `"plain"`: Uses 0 textures, `base_color` used as both fog and sky. --- (default: `"regular"`) --- * `textures`: A table containing up to six textures in the following --- order: Y+ (top), Y- (bottom), X- (west), X+ (east), Z+ (north), Z- (south). --- * `clouds`: Boolean for whether clouds appear. (default: `true`) --- * `sky_color`: A table used in `"regular"` type only, containing the --- following values (alpha is ignored): --- * `day_sky`: ColorSpec, for the top half of the sky during the day. --- (default: `#61b5f5`) --- * `day_horizon`: ColorSpec, for the bottom half of the sky during the day. --- (default: `#90d3f6`) --- * `dawn_sky`: ColorSpec, for the top half of the sky during dawn/sunset. --- (default: `#b4bafa`) --- The resulting sky color will be a darkened version of the ColorSpec. --- Warning: The darkening of the ColorSpec is subject to change. --- * `dawn_horizon`: ColorSpec, for the bottom half of the sky during dawn/sunset. --- (default: `#bac1f0`) --- The resulting sky color will be a darkened version of the ColorSpec. --- Warning: The darkening of the ColorSpec is subject to change. --- * `night_sky`: ColorSpec, for the top half of the sky during the night. --- (default: `#006bff`) --- The resulting sky color will be a dark version of the ColorSpec. --- Warning: The darkening of the ColorSpec is subject to change. --- * `night_horizon`: ColorSpec, for the bottom half of the sky during the night. --- (default: `#4090ff`) --- The resulting sky color will be a dark version of the ColorSpec. --- Warning: The darkening of the ColorSpec is subject to change. --- * `indoors`: ColorSpec, for when you're either indoors or underground. --- (default: `#646464`) --- * `fog_sun_tint`: ColorSpec, changes the fog tinting for the sun --- at sunrise and sunset. (default: `#f47d1d`) --- * `fog_moon_tint`: ColorSpec, changes the fog tinting for the moon --- at sunrise and sunset. (default: `#7f99cc`) --- * `fog_tint_type`: string, changes which mode the directional fog --- abides by, `"custom"` uses `sun_tint` and `moon_tint`, while --- `"default"` uses the classic Minetest sun and moon tinting. --- Will use tonemaps, if set to `"default"`. (default: `"default"`) --- * `fog`: A table containing the following values: --- * `fog_distance`: integer, set an upper bound for the client's viewing_range. --- Any value >= 0 sets the desired upper bound for viewing_range, disables range_all and prevents disabling fog (F3 key by default). --- Any value < 0 resets the behavior to being client-controlled. (default: -1) --- * `fog_start`: float, override the client's fog_start. --- Fraction of the visible distance at which fog starts to be rendered. --- Any value between [0.0, 0.99] set the fog_start as a fraction of the viewing_range. --- Any value < 0, resets the behavior to being client-controlled. (default: -1) --- * `fog_color`: ColorSpec, override the color of the fog. --- Unlike `base_color` above this will apply regardless of the skybox type. --- (default: `"#00000000"`, which means no override) --- @param sky_parameters Player.sky_parameters function Player:set_sky(sky_parameters) end --- Deprecated. Use `set_sky(sky_parameters)` --- * `base_color`: ColorSpec, defaults to white --- * `type`: Available types: --- * `"regular"`: Uses 0 textures, `bgcolor` ignored --- * `"skybox"`: Uses 6 textures, `bgcolor` used --- * `"plain"`: Uses 0 textures, `bgcolor` used --- * `clouds`: Boolean for whether clouds appear in front of `"skybox"` or --- `"plain"` custom skyboxes (default: `true`) --- @deprecated function Player:set_sky(base_color, type, texture_names, clouds) end --- @param as_table boolean boolean that determines whether the deprecated version of this function is being used. --- * `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. --- @return table Player.sky_parameters function Player:get_sky(as_table) end --- Deprecated: Use `get_sky(as_table)` instead. --- --- Returns a table with the `sky_color` parameters as in `set_sky`. --- @deprecated function Player:get_sky_color() end --- TODO ---@class Player.sun_parameters --- * Passing no arguments resets the sun to its default values. --- * `sun_parameters` is a table with the following optional fields: --- * `visible`: Boolean for whether the sun is visible. --- (default: `true`) --- * `texture`: A regular texture for the sun. Setting to `""` --- will re-enable the mesh sun. (default: "sun.png", if it exists) --- The texture appears non-rotated at sunrise and rotated 180 degrees --- (upside down) at sunset. --- * `tonemap`: A 512x1 texture containing the tonemap for the sun --- (default: `"sun_tonemap.png"`) --- * `sunrise`: A regular texture for the sunrise texture. --- (default: `"sunrisebg.png"`) --- * `sunrise_visible`: Boolean for whether the sunrise texture is visible. --- (default: `true`) --- * `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 --- of about `1.57` for equal `scale` values. --- @param sun_parameters Player.sun_parameters function Player:set_sun(sun_parameters) end --- Returns a table with the current sun parameters as in `set_sun`. --- @return Player.sun_parameters function Player:get_sun() end --- TODO --- @class Player.moon_parameters --- * Passing no arguments resets the moon to its default values. --- * `moon_parameters` is a table with the following optional fields: --- * `visible`: Boolean for whether the moon is visible. --- (default: `true`) --- * `texture`: A regular texture for the moon. Setting to `""` --- will re-enable the mesh moon. (default: `"moon.png"`, if it exists) --- The texture appears non-rotated at sunrise / moonset and rotated 180 --- degrees (upside down) at sunset / moonrise. --- Note: Relative to the sun, the moon texture is hence rotated by 180°. --- You can use the `^[transformR180` texture modifier to achieve the same orientation. --- * `tonemap`: A 512x1 texture containing the tonemap for the moon --- (default: `"moon_tonemap.png"`) --- * `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 --- of about `1.57` for equal `scale` values. --- @param moon_parameters Player.moon_parameters function Player:set_moon(moon_parameters) end --- Returns a table with the current moon parameters as in `set_moon`. --- @return Player.moon_parameters function Player:get_moon() end --- TODO --- @class Player.star_parameters --- * Passing no arguments resets stars to their default values. --- * `star_parameters` is a table with the following optional fields: --- * `visible`: Boolean for whether the stars are visible. --- (default: `true`) --- * `day_opacity`: Float for maximum opacity of stars at day. --- No effect if `visible` is false. --- (default: 0.0; maximum: 1.0; minimum: 0.0) --- * `count`: Integer number to set the number of stars in --- the skybox. Only applies to `"skybox"` and `"regular"` sky types. --- (default: `1000`) --- * `star_color`: ColorSpec, sets the colors of the stars, --- alpha channel is used to set overall star brightness. --- (default: `#ebebff69`) --- * `scale`: Float controlling the overall size of the stars (default: `1`) --- @param star_parameters Player.star_parameters function Player:set_stars(star_parameters) end --- Returns a table with the current stars parameters as in `set_stars`. --- @return Player.star_parameters function Player:get_stars() end --- TODO --- @class Player.cloud_parameters --- set cloud parameters --- * Passing no arguments resets clouds to their default values. --- * `cloud_parameters` is a table with the following optional fields: --- * `density`: from `0` (no clouds) to `1` (full clouds) (default `0.4`) --- * `color`: basic cloud color with alpha channel, ColorSpec --- (default `#fff0f0e5`). --- * `ambient`: cloud color lower bound, use for a "glow at night" effect. --- ColorSpec (alpha ignored, default `#000000`) --- * `height`: cloud height, i.e. y of cloud base (default per conf, --- usually `120`) --- * `thickness`: cloud thickness in nodes (default `16`) --- * `speed`: 2D cloud speed + direction in nodes per second --- (default `{x=0, z=-2}`). --- @param cloud_parameters Player.cloud_parameters function Player:set_clouds(cloud_parameters) end --- Returns a table with the current cloud parameters as in `set_clouds`. --- @return Player.cloud_parameters function Player:get_clouds() end --- @param ratio number? Value: --- * `0`...`1`: Overrides day-night ratio, controlling sunlight to a specific --- amount. --- * `nil`: Disables override, defaulting to sunlight based on day-night cycle function Player:override_day_night_ratio(ratio) end --- Returns the ratio or nil if it isn't overridden. --- @return number? function Player:get_day_night_ratio() end --- @alias Player.local_animation {x:integer, y:integer} --- 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 --- Returns idle, walk, dig, walk_while_dig tables and `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 --- Sets camera offset vectors. --- * in first person view --- * in third person view (max. values `{x=-10/10,y=-10,15,z=-5/5}`) --- v -- [firstperson, thirdperson] --- @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. --- @return vector firstperson --- @return vector thirdperson_back --- @return vector thirdperson_front function Player:get_eye_offset() end --- TODO --- @class Player.camera_params --- 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 --- TODO --- @class Player.light_definition --- Sets lighting for the player. --- * `light_definition` is a table with the following optional fields: --- * `saturation` sets the saturation (vividness). --- values > 1 increase the saturation --- values in [0,1) decrease the saturation --- * This value has no effect on clients who have the "Tone Mapping" shader disabled. --- * `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. --- @param light_definition Player.light_definition function Player:set_lighting(light_definition) end --- Returns the current state of lighting for the player. --- * Result is a table with the same fields as `light_definition` in `set_lighting`. --- @return Player.light_definition function Player:get_lighting() end --- Respawns the player using the same mechanism as the death screen, --- including calling `on_respawnplayer` callbacks. 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