Modern Lua Plugins: fix errors in mods/lord/Core/damage. LG-1980

This commit is contained in:
alek13
2025-09-22 03:30:28 +03:00
parent 9243cd17cf
commit 1f9ec26033
2 changed files with 16 additions and 4 deletions

View File

@@ -40,6 +40,7 @@ function ObjectRef:punch(puncher, time_from_last_punch, tool_capabilities, direc
--- @param clicker ObjectRef
function ObjectRef:right_click(clicker) end
--- returns number of health points
--- @return number
function ObjectRef:get_hp() end
--- set number of health points
--- * See reason in register_on_player_hpchange
@@ -74,8 +75,8 @@ function ObjectRef:get_animation() end
--- @param frame_speed number default: `15.0`
function ObjectRef:set_animation_frame_speed(frame_speed) end
--- Attaches object to `parent`.
--- See 'Attachments' section for details.
--- Attaches object to `parent`.
--- See 'Attachments' section for details.
--- This command may fail silently (do nothing) when it would result in circular attachments.
--- @overload fun(parent:ObjectRef)
--- @param parent ObjectRef to attach to
@@ -84,7 +85,7 @@ function ObjectRef:set_animation_frame_speed(frame_speed) end
--- @param rotation Position|vector relative rotation in degrees, default `{x=0, y=0, z=0}`
--- @param forced_visible boolean to control whether the attached entity should appear in first person, default `false`.
function ObjectRef:set_attach(parent, bone, position, rotation, forced_visible) end
--- Returns current attachment parameters or nil if it isn't attached.
--- Returns current attachment parameters or nil if it isn't attached.
--- If attached, returns `parent`, `bone`, `position`, `rotation`, `forced_visible`.
--- @return ObjectRef,string,Position,Position,boolean|nil
function ObjectRef:get_attach() end

View File

@@ -514,10 +514,21 @@ function minetest.register_on_punchplayer(callback) end
--- @param callback fun(player:Player, clicker:Player)
function minetest.register_on_rightclickplayer(callback) end
--- @alias PlayerHPChangeReasonType
--- | "set_hp" # A mod or the engine called `set_hp` without giving a type - use this for custom damage types.
--- | "punch" # Was punched. `reason.object` will hold the puncher, or nil if none.
--- | "fall" # A fall.
--- | "node_damage" # `damage_per_second` from a neighbouring node. `reason.node` will hold the node name or nil.
--- | "drown" # Drowning damage.
--- | "respawn" # Respawning.
--- @class PlayerHPChangeReason
--- @field type string one of `"set_hp"`, `"punch"`, ... See `register_on_player_hpchange` description.
--- @field type PlayerHPChangeReasonType one of `"set_hp"`, `"punch"`, ... See `register_on_player_hpchange` description.
--- @field from string will be `"mod"` or `"engine"`
--- @field object ObjectRef|Player|Entity
--- @field node string|nil
--- @field node_pos Position|nil
--- * Called when the player gets damaged or healed
--- * `player`: ObjectRef of the player