summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorBrandon <brandon@bremaweb.com>2014-05-16 23:47:12 -0500
committerest31 <MTest31@outlook.com>2015-05-15 11:09:55 +0200
commitc5b4e541749c50805519ce040d98a0a8e5e0ec03 (patch)
treebbc735720d6ac2e3b27c07c0b6d01ef586d61211 /doc
parent86a963caca9604ad57904e9acd9bef7c46ca47d8 (diff)
downloadminetest-c5b4e541749c50805519ce040d98a0a8e5e0ec03.tar.gz
minetest-c5b4e541749c50805519ce040d98a0a8e5e0ec03.tar.bz2
minetest-c5b4e541749c50805519ce040d98a0a8e5e0ec03.zip
Add minetest.register_on_punchplayer
Diffstat (limited to 'doc')
-rw-r--r--doc/lua_api.txt11
1 files changed, 10 insertions, 1 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index 4c0baa5bc..8ade48b7b 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -1760,6 +1760,16 @@ Call these functions only at load time!
* Called after a new player has been created
* `minetest.register_on_dieplayer(func(ObjectRef))`
* Called when a player dies
+* `minetest.register_on_punchplayer(func(player, hitter, time_from_last_punch, tool_capabilities, dir, damage))`
+ * Called when a player is punched
+ * `player` - ObjectRef - Player that was punched
+ * `hitter` - ObjectRef - Player that hit
+ * `time_from_last_punch`: Meant for disallowing spamming of clicks (can be nil)
+ * `tool_capabilities`: capability table of used tool (can be nil)
+ * `dir`: unit vector of direction of punch. Always defined. Points from
+ 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_respawnplayer(func(ObjectRef))`
* Called when player is to be respawned
* Called _before_ repositioning of player occurs
@@ -2282,7 +2292,6 @@ These functions return the leftover itemstack.
* `minetest.forceload_free_block(pos)`
* stops forceloading the position `pos`
-
Please note that forceloaded areas are saved when the server restarts.
minetest.global_exists(name)