1.6 KiB
1.6 KiB
reason or PlayerHPChangeReason
PlayerHPChangeReason table kind of, the minetest api is so crap that does not specified that has properties.. neither refers to the PlayerHPChangeReason
object, the most important things here are:
since 5.0
from
with values ofmod
engine
type
values when specific hp actions, and also any of those will have additional fields from mods.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
: the player dies from a high fall or something forcednode_damage
:damage_per_second
from a neighboring node. for older 5.2 use the position of player to getnode_pos
drown
: since 5.5respawn
:
node
since 5.3 will hold the node name or nil iftype
isnode_damage
.node_pos
since 5.3 will hold the position of the node iftype
isnode_damage
.
register_on_dieplayer and register_on_player_hpchange
Those functions for player dead were enhanced since version 5, using new reason or PlayerHPChangeReason
minetest.register_on_dieplayer(function(ObjectRef))
since 0.4.15, 4.0minetest.register_on_dieplayer(function(ObjectRef, reason))
since 5.0
Those functions ofr player hp change where enhanced since version 5
minetest.register_on_player_hpchange(func(player, hp_change), modifier)
since 0.4.15, 4.0minetest.register_on_player_hpchange(function(player, hp_change, reason), modifier)
since 5.0