philipbenr wrote:I'm 14 and just starting to make mods.
on_rightclick = func(pos, node, clicker, itemstack),
^ default: nil
^ if defined, itemstack will hold clicker's wielded item
Shall return the leftover itemstack
minetest.register_node("",{
description = "Test",
(.....)
on_rightclick = function(pos,node,clicker,itemstack)
end,
})
itemstack = {":"}
node = {"mod:example_node"}
philipbenr wrote:So, If i want to use the wield_hand to right_click with, would I putYour 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
itemstack = {":"}
because that is what your hand is defined as in the default init.lua?
And the node asYour 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
node = {"mod:example_node"}
Or is that wrong?
The only reason I said I was 14 is because I'm not very experienced in programming, but I making mods, because the mod request sticky gets roughly 20% to 30% mod requests made. :^/
-- The hand
minetest.register_item(":", {
type = "none",
wield_image = "wieldhand.png",
wield_scale = {x=1,y=1,z=2.5},
tool_capabilities = {
full_punch_interval = 0.9,
max_drop_level = 0,
groupcaps = {
crumbly = {times={[2]=3.00, [3]=0.70}, uses=0, maxlevel=1},
snappy = {times={[3]=0.40}, uses=0, maxlevel=1},
oddly_breakable_by_hand = {times={[1]=7.00,[2]=4.00,[3]=1.40}, uses=0, maxlevel=3}
},
damage_groups = {fleshy=1},
}
})
philipbenr wrote:I looked in the init.lua in defaultYour 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
-- The hand
minetest.register_item(":", {
type = "none",
wield_image = "wieldhand.png",
wield_scale = {x=1,y=1,z=2.5},
tool_capabilities = {
full_punch_interval = 0.9,
max_drop_level = 0,
groupcaps = {
crumbly = {times={[2]=3.00, [3]=0.70}, uses=0, maxlevel=1},
snappy = {times={[3]=0.40}, uses=0, maxlevel=1},
oddly_breakable_by_hand = {times={[1]=7.00,[2]=4.00,[3]=1.40}, uses=0, maxlevel=3}
},
damage_groups = {fleshy=1},
}
})
minetest.register_node("audio:player_red", {
drawtype = "normal",
tiles = {"color_player_red.png"},
paramtype = "light",
light_source = 6 ,
groups = {choppy=3, oddly_breakable_by_hand=3},
sound = Sound_Red,
after_place_node = function (pos,placer)
minetest.sound_play("Sound_Red",
{pos = pos, gain = 1.0, max_hear_distance = 40,})
end
after_dig_node = function (pos, oldnode, oldmetadata, digger)
minetest.sound_play("Sound_Blank",
{pos = pos, gain = 1.0, max_hear_distance = 2,})
end
})
after_place_node
after_dig_node
13:58:55: ERROR[main]: Failed to load and run script from
13:58:55: ERROR[main]: C:\Users\robinson\Game Data\Minetest - Copy\bin\..\games\minetest_game\mods\audio\init.lua:
13:58:55: ERROR[main]: ...st - Copy\bin\..\games\minetest_game\mods\audio\init.lua:13: '}' expected (to close '{' at line 1) near 'after_dig_node'
sound = minetest.sound_play(....)
minetest.sound_stop(sound)
philipbenr wrote:Right now, I'm working on a small mod about audio, because the radio mod doesn't work on my computer, or my version of Minetest (latest version, always). I am hoping to use the player's wield_hand to right click on of the nodes (there are eight different nodes, one of a different shade/color, and one per song.), but I just don't know how to use the "on_rightclick", even though I looked it up on the dev. wiki. I'm 14 and just starting to make mods.
Help!
20:31:12: ERROR[main]: ServerError: LuaError: error: ...st - Copy\bin\..\games\minetest_game\mods\audio\init.lua:42: bad argument #1 to 'sound_stop' (number expected, got string)
after_place_node = function (pos,placer)
mysound = minetest.sound_play("Sound_Yellow",
{pos = pos, gain = 1.0, max_hear_distance = 40,})
end,
after_dig_node = function (pos, oldnode, oldmetadata, digger)
minetest.sound_stop(mysound)
end,
if mysound then
minetest.sound_stop(mysound)
end
philipbenr wrote:thanks so much webdesigner I think I've got the rest. I think I'll release it under GPLv3.
Users browsing this forum: No registered users and 7 guests