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 --- @param clicker ObjectRef
function ObjectRef:right_click(clicker) end function ObjectRef:right_click(clicker) end
--- returns number of health points --- returns number of health points
--- @return number
function ObjectRef:get_hp() end function ObjectRef:get_hp() end
--- set number of health points --- set number of health points
--- * See reason in register_on_player_hpchange --- * See reason in register_on_player_hpchange

View File

@@ -514,10 +514,21 @@ function minetest.register_on_punchplayer(callback) end
--- @param callback fun(player:Player, clicker:Player) --- @param callback fun(player:Player, clicker:Player)
function minetest.register_on_rightclickplayer(callback) end 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 --- @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 from string will be `"mod"` or `"engine"`
--- @field object ObjectRef|Player|Entity --- @field object ObjectRef|Player|Entity
--- @field node string|nil
--- @field node_pos Position|nil
--- * Called when the player gets damaged or healed --- * Called when the player gets damaged or healed
--- * `player`: ObjectRef of the player --- * `player`: ObjectRef of the player