1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Make entity on_punch have same signature and behaviour as player on_punch

This commit is contained in:
sapier 2017-01-21 15:58:07 +01:00
parent 953cbb3b15
commit 814ee971f7
4 changed files with 33 additions and 23 deletions

View file

@ -1392,7 +1392,7 @@ a non-tool item, so that it can do something else than take damage.
On the Lua side, every punch calls:
entity:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
entity:on_punch(puncher, time_from_last_punch, tool_capabilities, direction, damage)
This should never be called directly, because damage is usually not handled by
the entity itself.
@ -1403,6 +1403,9 @@ the entity itself.
* `tool_capabilities` can be `nil`.
* `direction` is a unit vector, pointing from the source of the punch to
the punched object.
* `damage` damage that will be done to entity
Return value of this function will determin if damage is done by this function
(retval true) or shall be done by engine (retval false)
To punch an entity/object in Lua, call: