wcwyes wrote:Mossmanikin wrote:wcwyes wrote:how do i get a tool to place a node then disappear?
I'd do it like this:
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_place = function(itemstack, placer, pointed_thing)
local pt = pointed_thing
minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="special:myblock"})
itemstack:take_item()
return itemstack
end,
I'm thinking someething like this will take care of my lost node/tools
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_place = function(itemstack, placer, pointed_thing)
local pt = pointed_thing
if pointed_thing.above = default:air then
minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="special:myblock"})
itemstack:take_item()
return itemstack
else nil
end,
I'm not sure if I fully understand what you're trying to do...
If you don't want the tool to disappear, you should remove the line
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
If you want to check for air, you could try replacing the line
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
if pointed_thing.above = default:air then
with
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
if minetest.get_node(pt.above).name=="air" then
(didn't test it)
furthermore I'd replace
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
with
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.