Trying to replace a node with another node

Red_King_Cyclops
Member
 
Posts: 266
Joined: Sun Jun 16, 2019 20:17
Location: Earth

Trying to replace a node with another node

by Red_King_Cyclops » Sat Aug 10, 2019 11:56

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.
My best mods: space_travel, time_travel, and rocket.
 

Sokomine
Member
 
Posts: 3886
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: Trying to replace a node with another node

by Sokomine » Sat Aug 10, 2019 13:37

Why not use my replacer mod?
A list of my mods can be found here.
 

User avatar
AiTechEye
Member
 
Posts: 744
Joined: Fri May 29, 2015 21:14
Location: Unknown
GitHub: AiTechEye

Re: Trying to replace a node with another node

by AiTechEye » Sat Aug 10, 2019 14:07

local p = minetest.get_node(pos).param2

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

Red_King_Cyclops
Member
 
Posts: 266
Joined: Sun Jun 16, 2019 20:17
Location: Earth

Re: Trying to replace a node with another node

by Red_King_Cyclops » Sat Aug 10, 2019 20:11

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.
My best mods: space_travel, time_travel, and rocket.
 

TechRancher
New member
 
Posts: 3
Joined: Mon Jul 22, 2019 12:53
GitHub: TechRancher
IRC: TechRancher
In-game: TechRancher

Re: Trying to replace a node with another node

by TechRancher » Thu Aug 15, 2019 15:38

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.
 


Return to Modding Discussion



Who is online

Users browsing this forum: No registered users and 2 guests