philipbenr wrote:I'm 14 and just starting to make mods.
Your age isn't important for modding! I'm 15 and I can create nice mods (at least I think they're nice). So, let's try to solve your problem together:
You need help on "on_rightclick", so you should visit the
Minetest API.
Then you look for some explanations for "on_rightclick" => Ctrl + F(ind) and type "on_rightclick" => The 4th result is what you're looking for:
on_rightclick = func(pos, node, clicker, itemstack),
^ default: nil
^ if defined, itemstack will hold clicker's wielded item
Shall return the leftover itemstack
It explains that you must set the value of "on_rightclick" as a function with the parameters:
- pos (position of clicked node => table)
- node (info about the clicked node => table)
- clicker (the player who clicked the node => ObjectRef)
- itemstack (info about the item in player's hand => ItemStack)
What you have to do now, is adding on_rightclick to your node definition:
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_node("",{
description = "Test",
(.....)
on_rightclick = function(pos,node,clicker,itemstack)
end,
})
And all needed code into his function. You should also visit
Dev Wiki for more information about nodes, objectrefs etc.