mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
Allow detection of damage greater than HP (#15160)
Co-authored-by: Gregor Parzefall <gregor.parzefall@posteo.de>
This commit is contained in:
parent
fbb0e82679
commit
610ddaba7c
3 changed files with 77 additions and 15 deletions
|
@ -5850,8 +5850,13 @@ Call these functions only at load time!
|
|||
* `clicker`: ObjectRef - Object that acted upon `player`, may or may not be a player
|
||||
* `minetest.register_on_player_hpchange(function(player, hp_change, reason), modifier)`
|
||||
* Called when the player gets damaged or healed
|
||||
* When `hp == 0`, damage doesn't trigger this callback.
|
||||
* When `hp == hp_max`, healing does still trigger this callback.
|
||||
* `player`: ObjectRef of the player
|
||||
* `hp_change`: the amount of change. Negative when it is damage.
|
||||
* Historically, the new HP value was clamped to [0, 65535] before
|
||||
calculating the HP change. This clamping has been removed as of
|
||||
Minetest 5.10.0
|
||||
* `reason`: a PlayerHPChangeReason table.
|
||||
* The `type` field will have one of the following values:
|
||||
* `set_hp`: A mod or the engine called `set_hp` without
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue