Move a node

Nekrofage
Member
 
Posts: 35
Joined: Mon Oct 17, 2016 21:12
GitHub: Nekrofage

Move a node

by Nekrofage » Fri Feb 03, 2017 21:36

Hi !! :D

Do you know if it is possible to move a node?

Thank you !
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: Move a node

by rubenwardy » Fri Feb 03, 2017 21:41

If the nodes don't have metadata (ie: they're not nodes like chests, signs, or furnaces)

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
local function move_node(oldpos, newpos)
   local node = minetest.get_node(oldpos)
   minetest.set_node(newpos, { name = "air" })
   minetest.set_node(newpos, node)
end


if you also need to copy the meta:

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
local function move_node_and_meta(oldpos, newpos)
   local node = minetest.get_node(oldpos)
   local meta = minetest.get_meta(oldpos):to_table()
   minetest.set_node(newpos, { name = "air" })
   minetest.set_node(newpos, node)
   minetest.get_meta(newpos):from_table(meta)
end
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 7 guests

cron