aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorTeTpaAka <TeTpaAka@users.noreply.github.com>2015-05-30 16:56:42 +0200
committerest31 <MTest31@outlook.com>2015-06-13 19:40:31 +0200
commitaa13baa30a45b0f834c23bd5c0407895eb8ec0ee (patch)
tree23fc218db4ad9fe4cb44f83fbaf40ac181335c8d /doc
parente50aa4ed06f36c74a892ec68d576c52ba9dc0b2c (diff)
downloadminetest-aa13baa30a45b0f834c23bd5c0407895eb8ec0ee.tar.gz
minetest-aa13baa30a45b0f834c23bd5c0407895eb8ec0ee.tar.bz2
minetest-aa13baa30a45b0f834c23bd5c0407895eb8ec0ee.zip
Add minetest.register_on_player_hpchange
Diffstat (limited to 'doc')
-rw-r--r--doc/lua_api.txt7
1 files changed, 7 insertions, 0 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index 4301762e2..012c6eae1 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -1785,6 +1785,13 @@ Call these functions only at load time!
the puncher to the punched.
* `damage` - number that represents the damage calculated by the engine
* should return `true` to prevent the default damage mechanism
+* `minetest.register_on_player_hpchange(func(player, hp_change), modifier)`
+ * Called when the player gets damaged or healed
+ * `player`: ObjectRef of the player
+ * `hp_change`: the amount of change. Negative when it is damage.
+ * `modifier`: when true, the function should return the actual hp_change.
+ Note: modifiers only get a temporary hp_change that can be modified by later modifiers.
+ modifiers can return true as a second argument to stop the execution of further functions.
* `minetest.register_on_respawnplayer(func(ObjectRef))`
* Called when player is to be respawned
* Called _before_ repositioning of player occurs