IDE-helper: ObjectRef.lua

This commit is contained in:
alek13
2023-05-11 16:51:29 +03:00
parent 93e1ac6976
commit a27595b097

View File

@@ -7,91 +7,117 @@ function ObjectRef:get_pos() end
function ObjectRef:set_pos(pos) end function ObjectRef:set_pos(pos) end
--TODO: --TODO:
--* `get_velocity()`: returns the velocity, a vector. --- @return vector|Position returns the velocity, a vector.
--* `add_velocity(vel)` function ObjectRef:get_velocity() end
--* `vel` is a vector, e.g. `{x=0.0, y=2.3, z=1.0}` --- @param vel vector|Position e.g. `{x=0.0, y=2.3, z=1.0}`
--* In comparison to using get_velocity, adding the velocity and then using --- * In comparison to using get_velocity, adding the velocity and then using
--set_velocity, add_velocity is supposed to avoid synchronization problems. --- set_velocity, add_velocity is supposed to avoid synchronization problems.
--Additionally, players also do not support set_velocity. --- Additionally, players also do not support set_velocity.
--* If a player: --- * If a player:
--* Does not apply during free_move. --- * Does not apply during free_move.
--* Note that since the player speed is normalized at each move step, --- * Note that since the player speed is normalized at each move step,
--increasing e.g. Y velocity beyond what would usually be achieved --- increasing e.g. Y velocity beyond what would usually be achieved
--(see: physics overrides) will cause existing X/Z velocity to be reduced. --- (see: physics overrides) will cause existing X/Z velocity to be reduced.
--* Example: `add_velocity({x=0, y=6.5, z=0})` is equivalent to --- * Example: `add_velocity({x=0, y=6.5, z=0})` is equivalent to
--pressing the jump key (assuming default settings) --- pressing the jump key (assuming default settings)
--* `move_to(pos, continuous=false)` function ObjectRef:add_velocity(vel) end
--* Does an interpolated move for Lua entities for visually smooth transitions. --- @overload fun(pos)
--* If `continuous` is true, the Lua entity will not be moved to the current --- * Does an interpolated move for Lua entities for visually smooth transitions.
--position before starting the interpolated move. --- * If `continuous` is true (default: false), the Lua entity will not be moved to the current
--* For players this does the same as `set_pos`,`continuous` is ignored. --- position before starting the interpolated move.
--* `punch(puncher, time_from_last_punch, tool_capabilities, direction)` --- * For players this does the same as `set_pos`,`continuous` is ignored.
--* `puncher` = another `ObjectRef`, --- @param pos Position
--* `time_from_last_punch` = time since last punch action of the puncher --- @param continuous boolean
--* `direction`: can be `nil` function ObjectRef:move_to(pos, continuous) end
--* `right_click(clicker)`; `clicker` is another `ObjectRef` --- @param puncher ObjectRef another `ObjectRef`,
--* `get_hp()`: returns number of health points --- @param time_from_last_punch number? time since last punch action of the puncher
--* `set_hp(hp, reason)`: set number of health points --- @param direction`: can be `nil`
--* See reason in register_on_player_hpchange function ObjectRef:punch(puncher, time_from_last_punch, tool_capabilities, direction) end
--* Is limited to the range of 0 ... 65535 (2^16 - 1) --- @param clicker ObjectRef
--* For players: HP are also limited by `hp_max` specified in object properties function ObjectRef:right_click(clicker) end
--* `get_inventory()`: returns an `InvRef` for players, otherwise returns `nil` --- returns number of health points
--* `get_wield_list()`: returns the name of the inventory list the wielded item function ObjectRef:get_hp() end
--is in. --- set number of health points
--* `get_wield_index()`: returns the index of the wielded item --- * See reason in register_on_player_hpchange
--* `get_wielded_item()`: returns an `ItemStack` --- * Is limited to the range of 0 ... 65535 (2^16 - 1)
--* `set_wielded_item(item)`: replaces the wielded item, returns `true` if --- * For players: HP are also limited by `hp_max` specified in object properties
--successful. --- @param hp number
--* `set_armor_groups({group1=rating, group2=rating, ...})` --- @param reason string?
--* `get_armor_groups()`: returns a table with the armor group ratings function ObjectRef:set_hp(hp, reason) end
--* `set_animation(frame_range, frame_speed, frame_blend, frame_loop)` --- @return InvRef|nil for players, otherwise returns `nil`
--* `frame_range`: table {x=num, y=num}, default: `{x=1, y=1}` function ObjectRef:get_inventory() end
--* `frame_speed`: number, default: `15.0` --- @return string the name of the inventory list the wielded item is in.
--* `frame_blend`: number, default: `0.0` function ObjectRef:get_wield_list() end
--* `frame_loop`: boolean, default: `true` --- @return number the index of the wielded item
--* `get_animation()`: returns `range`, `frame_speed`, `frame_blend` and function ObjectRef:get_wield_index() end
--`frame_loop`. --- @return ItemStack
--* `set_animation_frame_speed(frame_speed)` function ObjectRef:get_wielded_item() end
--* `frame_speed`: number, default: `15.0` --- replaces the wielded item, returns `true` if successful.
--* `set_attach(parent[, bone, position, rotation, forced_visible])` --- @param item ItemStack
--* `parent`: `ObjectRef` to attach to --- @return boolean
--* `bone`: default `""` (the root bone) function ObjectRef:set_wielded_item(item) end
--* `position`: relative position, default `{x=0, y=0, z=0}` --- @param groups table {group1=rating, group2=rating, ...}
--* `rotation`: relative rotation in degrees, default `{x=0, y=0, z=0}` function ObjectRef:set_armor_groups(groups) end
--* `forced_visible`: Boolean to control whether the attached entity --- @return table with the armor group ratings
--should appear in first person, default `false`. function ObjectRef:get_armor_groups() end
--* Please also read the [Attachments] section above. --- @param frame_range table {x=num, y=num}, default: `{x=1, y=1}`
--* This command may fail silently (do nothing) when it would result --- @param frame_speed number default: `15.0`
--in circular attachments. --- @param frame_blend number default: `0.0`
--* `get_attach()`: returns parent, bone, position, rotation, forced_visible, --- @param frame_loop boolean default: `true`
--or nil if it isn't attached. function ObjectRef:set_animation(frame_range, frame_speed, frame_blend, frame_loop) end
--* `get_children()`: returns a list of ObjectRefs that are attached to the --- @return table,number,number,boolean `range`, `frame_speed`, `frame_blend` and `frame_loop`.
-- object. function ObjectRef:get_animation() end
--* `set_detach()` --- @param frame_speed number default: `15.0`
--* `set_bone_position([bone, position, rotation])` function ObjectRef:set_animation_frame_speed(frame_speed) end
-- * `bone`: string. Default is `""`, the root bone --- @overload fun(parent:ObjectRef)
-- * `position`: `{x=num, y=num, z=num}`, relative, `default {x=0, y=0, z=0}` --- @param parent ObjectRef to attach to
-- * `rotation`: `{x=num, y=num, z=num}`, default `{x=0, y=0, z=0}` --- @param bone string default `""` (the root bone)
--* `get_bone_position(bone)`: returns position and rotation of the bone --- @param position Position relative position, default `{x=0, y=0, z=0}`
--* `set_properties(object property table)` --- @param rotation Position|vector relative rotation in degrees, default `{x=0, y=0, z=0}`
--* `get_properties()`: returns object property table --- @param forced_visible boolean to control whether the attached entity should appear in first person, default `false`.
--* `is_player()`: returns true for players, false otherwise --- * Please also read the [Attachments] section above.
--* `get_nametag_attributes()` --- * This command may fail silently (do nothing) when it would result
-- * returns a table with the attributes of the nametag of an object --- in circular attachments.
-- * { function ObjectRef:set_attach(parent, bone, position, rotation, forced_visible) end
-- text = "", --- @return ObjectRef,string,Position,Position,boolean parent, bone, position, rotation, forced_visible, or nil if it isn't attached.
-- color = {a=0..255, r=0..255, g=0..255, b=0..255}, function ObjectRef:get_attach() end
-- bgcolor = {a=0..255, r=0..255, g=0..255, b=0..255}, --- @return ObjectRef[]|table<number,ObjectRef> a list of ObjectRefs that are attached to the object.
-- } function ObjectRef:get_children() end
--* `set_nametag_attributes(attributes)` function ObjectRef:set_detach() end
-- * sets the attributes of the nametag of an object --- @overload fun()
-- * `attributes`: --- @param bone string Default is `""`, the root bone
-- { --- @param position Position `{x=num, y=num, z=num}`, relative, `default {x=0, y=0, z=0}`
-- text = "My Nametag", --- @param rotation Position `{x=num, y=num, z=num}`, default `{x=0, y=0, z=0}`
-- color = ColorSpec, function ObjectRef:set_bone_position(bone, position, rotation) end
-- -- ^ Text color --- @return Position,Position position and rotation of the bone
-- bgcolor = ColorSpec or false, function ObjectRef:get_bone_position(bone) end
-- -- ^ Sets background color of nametag --- @param object_property_table table<string,any>
-- -- `false` will cause the background to be set automatically based on user settings function ObjectRef:set_properties(object_property_table) end
-- -- Default: false --- @return table object property table
-- } function ObjectRef:get_properties() end
--- @return boolean true for players, false otherwise
function ObjectRef:is_player() end
--- Example:
--- ```
--- {
--- text = "",
--- color = {a=0..255, r=0..255, g=0..255, b=0..255},
--- bgcolor = {a=0..255, r=0..255, g=0..255, b=0..255},
--- }
--- ```
--- @return table a table with the attributes of the nametag of an object
function ObjectRef:get_nametag_attributes() end
--- sets the attributes of the nametag of an object.
--- @param attributes table
--- ```
--- {
--- text = "My Nametag",
--- color = ColorSpec,
--- -- ^ Text color
--- bgcolor = ColorSpec or false,
--- -- ^ Sets background color of nametag
--- -- `false` will cause the background to be set automatically based on user settings
--- -- Default: false
--- }
--- ```
function ObjectRef:set_nametag_attributes(attributes) end