From 128b3f703d454506e2957abe39148686eb1113d7 Mon Sep 17 00:00:00 2001 From: alek13 Date: Sat, 24 Aug 2024 18:01:02 +0300 Subject: [PATCH] IDE-helper: add `PlayerHPChangeReason` description. --- minetest_ns.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/minetest_ns.lua b/minetest_ns.lua index 9dc157f..a9100b6 100644 --- a/minetest_ns.lua +++ b/minetest_ns.lua @@ -474,6 +474,11 @@ function minetest.register_on_punchplayer(callback) end --- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L4603-L4606) --- @param callback fun(player, clicker) function minetest.register_on_rightclickplayer(callback) end + +--- @class PlayerHPChangeReason +--- @field type string one of `"set_hp"`, `"punch"`, ... See `register_on_player_hpchange` description. +--- @field from string will be `"mod"` or `"engine"` + --- * Called when the player gets damaged or healed --- * `player`: ObjectRef of the player --- * `hp_change`: the amount of change. Negative when it is damage. @@ -495,7 +500,8 @@ function minetest.register_on_rightclickplayer(callback) end --- Non-modifiers receive the final HP change calculated by the modifiers. --- --- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L4607-L4626) ---- @param callback fun(player, hp_change, reason) +--- @param callback fun(player:Player, hp_change:number, reason:PlayerHPChangeReason) +--- @param modifier boolean function minetest.register_on_player_hpchange(callback, modifier) end --- * Called when a player dies --- * `reason`: a PlayerHPChangeReason table, see register_on_player_hpchange