register_on_punchnode does not work here, because only in itemdef. on_use is caled.
Example problem:
you have an node "mymod:barrel_water" placed somewhere in the landscape.
now you want to check if this "mymod:barrel_water" is punched with "bucket:bucket_empty", --> replace "bucket:bucket_empty" with "bucket:bucket_water"
using on_punchnode or register_on_punch does not work here, because its not caled.
the solution could be to override the bucket, but if another mod wants todo the same, they conflict together.
so there is need for an register_on_use function wich is also caled if an item is used.
example:
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_use(function(item [itemStack], node [node], user [Player], pointed_thing[pt])
if item:get_name() == "bucket:bucket_empty"
and node.name == "mymod:barrel_water" then
user:set_wielded_item("bucket:bucket_water")
end
end)
would be great to see something like that in 0.4.11