How can I capture what tool was used to dig a block, or in my hand?

Posted:
Sun Dec 23, 2012 13:34
by Neuromancer
Is there a way to tell what tool is being used to dig a block, or what tool is in my hand? I need to then use some logic that if a certain tool is being used, then run different code.

Posted:
Sun Dec 23, 2012 14:50
by Neuromancer
Thanks much! get_wielded_item and get_wear did the trick!
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
minetest.register_on_punchnode( function(pos, node, puncher)
hit_with = puncher:get_wielded_item()
wear=hit_with:get_wear()
--print (temp["wear"])
if node.name == "phonics:c"
then
if wear == 0 then