1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-15 18:57:08 +00:00

Add minetest.register_on_punchplayer

This commit is contained in:
Brandon 2014-05-16 23:47:12 -05:00 committed by est31
parent 86a963caca
commit c5b4e54174
6 changed files with 71 additions and 10 deletions

View file

@ -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)