callback for punching a luaentity?

Post Reply
User avatar
ErrorNull
Member
Posts: 222
Joined: Thu Mar 03, 2016 00:43

callback for punching a luaentity?

by ErrorNull » Post

is there a callback function, or some way to act upon when the player punches an entity in the world?

for example, we have the very useful callback function minetest.register_on_punchnode to detect when a node is punched. is there something similar for entities?

my goal is to do some custom behavior when the player punches for example a dropped apple or tool. any ideas?
My Villagers Mod: [villagers]

User avatar
TenPlus1
Member
Posts: 2775
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: callback for punching a luaentity?

by TenPlus1 » Post

The entity itself has an on_punch function and any tool you register can have an on_punch setup to check for specific items: https://github.com/minetest/minetest/bl ... .txt#L1823

User avatar
ErrorNull
Member
Posts: 222
Joined: Thu Mar 03, 2016 00:43

Re: callback for punching a luaentity?

by ErrorNull » Post

ah perfect. thanks much tenplus1 :)
My Villagers Mod: [villagers]

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests