Anyways, yeah, kaeza is right. Also: I'm 3.042x better.PilzAdam wrote:kaeza wrote:EDIT: 1000th post!!!
Nice.
kaeza wrote:Use on_rightclick callback on the cauldron, and check the itemstack name.
EDIT: 1000th post!!!
Evergreen wrote:Exactly how do you check the itemstack name?
on_rightclick = function(pos, node, clicker, itemstack)
if itemstack:get_name() == "bucket:bucket_water" then
-- Switch nodes here
end
end
kaeza wrote:Evergreen wrote:Exactly how do you check the itemstack name?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
on_rightclick = function(pos, node, clicker, itemstack)
if itemstack:get_name() == "bucket:bucket_water" then
-- Switch nodes here
end
end
minetest.register_node("thaumtest:cauldron_empty",{
drawtype="nodebox",
description= "Cauldron",
paramtype = "light",
tiles = {"default_wood.png"},
groups = {choppy=2},
node_box = {
type = "fixed",
fixed = {
{-0.500000,-0.375000,-0.500000,-0.375000,0.500000,0.500000},
{0.375000,-0.375000,-0.500000,0.500000,0.500000,0.500000},
{-0.500000,-0.375000,-0.500000,0.500000,0.500000,-0.375000},
{-0.500000,-0.375000,0.375000,0.500000,0.500000,0.500000},
{-0.500000,-0.500000,-0.500000,-0.375000,0.500000,-0.375000},
{0.375000,-0.500000,-0.500000,0.500000,0.500000,-0.375000},
{0.375000,-0.500000,0.375000,0.500000,0.500000,0.500000},
{-0.500000,-0.500000,0.375000,-0.375000,0.500000,0.500000},
{-0.500000,-0.375000,-0.500000,0.500000,-0.312500,0.500000},
}
}
on_rightclick = function(pos, node, clicker, itemstack)
if itemstack:get_name() == "bucket:bucket_water" then
minetest.node_dig(pos, node, digger)
minetest.env:remove_node(pos)
end
end,
after_destruct = function(pos, oldnode)
oldnode.name = "thaumtest:cauldron_full"
minetest.env:set_node(pos, oldnode)
end
})
kaeza wrote:why don't you call set_node(...) directly in on_rightclick?
minetest.register_node("thaumtest:cauldron_empty",{
drawtype="nodebox",
description= "Cauldron",
paramtype = "light",
tiles = {"default_wood.png"},
groups = {choppy=2},
node_box = {
type = "fixed",
fixed = {
{-0.500000,-0.375000,-0.500000,-0.375000,0.500000,0.500000},
{0.375000,-0.375000,-0.500000,0.500000,0.500000,0.500000},
{-0.500000,-0.375000,-0.500000,0.500000,0.500000,-0.375000},
{-0.500000,-0.375000,0.375000,0.500000,0.500000,0.500000},
{-0.500000,-0.500000,-0.500000,-0.375000,0.500000,-0.375000},
{0.375000,-0.500000,-0.500000,0.500000,0.500000,-0.375000},
{0.375000,-0.500000,0.375000,0.500000,0.500000,0.500000},
{-0.500000,-0.500000,0.375000,-0.375000,0.500000,0.500000},
{-0.500000,-0.375000,-0.500000,0.500000,-0.312500,0.500000},
}
}
on_rightclick = function(pos, node, clicker, itemstack)
if itemstack:get_name() == "bucket:bucket_water" then
minetest.env:set_node(pos, "thaumtest:cauldron_full")
end
end
}
})
minetest.register_node("thaumtest:cauldron_empty",{
drawtype="nodebox",
description= "Cauldron",
paramtype = "light",
tiles = {"default_wood.png"},
groups = {choppy=2},
node_box = {
type = "fixed",
fixed = {
{-0.500000,-0.375000,-0.500000,-0.375000,0.500000,0.500000},
{0.375000,-0.375000,-0.500000,0.500000,0.500000,0.500000},
{-0.500000,-0.375000,-0.500000,0.500000,0.500000,-0.375000},
{-0.500000,-0.375000,0.375000,0.500000,0.500000,0.500000},
{-0.500000,-0.500000,-0.500000,-0.375000,0.500000,-0.375000},
{0.375000,-0.500000,-0.500000,0.500000,0.500000,-0.375000},
{0.375000,-0.500000,0.375000,0.500000,0.500000,0.500000},
{-0.500000,-0.500000,0.375000,-0.375000,0.500000,0.500000},
{-0.500000,-0.375000,-0.500000,0.500000,-0.312500,0.500000},
},
},
on_rightclick = function(pos, node, clicker, itemstack)
if itemstack:get_name() == "bucket:bucket_water" then
minetest.env:set_node(pos, "thaumtest:cauldron_full")
end
end
},
)doyousketch2 wrote:I think in your last line you have one too many closing brackets.
Take out the squiggly }
Just leave the )
I also think you need commas after the closing brackets that you do have.
There's 3 of these }
That should look like this instead:
},
not tested, but this looks more correct to me: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("thaumtest:cauldron_empty",{
drawtype="nodebox",
description= "Cauldron",
paramtype = "light",
tiles = {"default_wood.png"},
groups = {choppy=2},
node_box = {
type = "fixed",
fixed = {
{-0.500000,-0.375000,-0.500000,-0.375000,0.500000,0.500000},
{0.375000,-0.375000,-0.500000,0.500000,0.500000,0.500000},
{-0.500000,-0.375000,-0.500000,0.500000,0.500000,-0.375000},
{-0.500000,-0.375000,0.375000,0.500000,0.500000,0.500000},
{-0.500000,-0.500000,-0.500000,-0.375000,0.500000,-0.375000},
{0.375000,-0.500000,-0.500000,0.500000,0.500000,-0.375000},
{0.375000,-0.500000,0.375000,0.500000,0.500000,0.500000},
{-0.500000,-0.500000,0.375000,-0.375000,0.500000,0.500000},
{-0.500000,-0.375000,-0.500000,0.500000,-0.312500,0.500000},
},
},
on_rightclick = function(pos, node, clicker, itemstack)
if itemstack:get_name() == "bucket:bucket_water" then
minetest.env:set_node(pos, "thaumtest:cauldron_full")
end
end
},
)
Users browsing this forum: Bing [Bot] and 7 guests