[Question] global version of on use

Post Reply
User avatar
Extex
Member
Posts: 190
Joined: Wed Mar 14, 2018 23:14
GitHub: Extex101
In-game: Extex

[Question] global version of on use

by Extex » Post

Is there some way to detect when a player is using an item and stop it. (Under certain conditions)
Player of PK, RIP. Creator of the light_tool and motorbike mods. Working on another mod which should be coming soon!

User avatar
sorcerykid
Member
Posts: 1462
Joined: Fri Aug 26, 2016 15:36
GitHub: sorcerykid
In-game: Nemo
Location: Illinois, USA

Re: [Question] global version of on use

by sorcerykid » Post

You could override the minetest.register_craftitem() function, and hook into the on_use callback. Take a look at my Antigrief mod for a basic example of the methodology:

https://bitbucket.org/sorcerykid/antigrief/src/master/init.lua

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests