Page 1 of 1

Trying to replace a node with another node

PostPosted: Sat Aug 10, 2019 11:56
by Red_King_Cyclops
I'm making a mod with two nodes that have "paramtype2=facedir". I'm trying to make a right-click function that replaces the first node with the second. The function works, but the the second node is placed facing south and does not face the same way as the first (unless the first was also placed south). This is a minor problem, since the player could just fix the second node by breaking it and placing it again or by using a screwdriver, but it would be good to fix. I tried using "minetest.swap_node", but that doesn't work.

Re: Trying to replace a node with another node

PostPosted: Sat Aug 10, 2019 13:37
by Sokomine
Why not use my replacer mod?

Re: Trying to replace a node with another node

PostPosted: Sat Aug 10, 2019 14:07
by AiTechEye
local p = minetest.get_node(pos).param2

minetest.swap_node(pos, {name = "",param2=p}) ?

Re: Trying to replace a node with another node

PostPosted: Sat Aug 10, 2019 20:11
by Red_King_Cyclops
Sokomine wrote:Why not use my replacer mod?

I did not know it existed.
AiTechEye wrote:local p = minetest.get_node(pos).param2

minetest.swap_node(pos, {name = "",param2=p}) ?

That works, thanks.

Re: Trying to replace a node with another node

PostPosted: Thu Aug 15, 2019 15:38
by TechRancher
Red_King_Cyclops wrote:
Sokomine wrote:Why not use my replacer mod?

I did not know it existed.
AiTechEye wrote:local p = minetest.get_node(pos).param2

minetest.swap_node(pos, {name = "",param2=p}) ?

That works, thanks.


You can also use worldedit.