minetest.register on hpchange

From Minetest Developer Wiki
Jump to: navigation, search

Contents

Syntax

minetest.register_on_player_hpchange(func(player, hp_change), modifier)

Description

Register a callback to be called when player's health is changed.

recently added https://github.com/minetest/minetest/commit/aa13baa30a45b0f834c23bd5c0407895eb8ec0ee

Arguments

  1. func(player, hp_change) - function that accept 2 arguments, called on change of health
    1. player - ObjectRef of player
    2. hp_change - the amount of change. Negative when it is damage.
  2. modifier - when true, the function should return the actual hp_change.

Examples


This article is incomplete.


Personal tools
Namespaces

Variants
Actions
Navigation
API
Toolbox