mirror of
https://files.creativekara.fr/git/poschangelib.git
synced 2024-12-04 21:13:50 +01:00
Keep param, param2 and other node values when replacing node by name.
This commit is contained in:
parent
ea8cd66edc
commit
70327770e1
@ -80,7 +80,9 @@ function poschangelib.do_stomp(player, pos, node, node_desc, stomp_desc)
|
||||
if not dest_node then return end
|
||||
minetest.set_node(pos, dest_node)
|
||||
else
|
||||
minetest.set_node(pos, {name = stomp_desc.dest_node_name})
|
||||
local new_node = minetest.get_node(pos)
|
||||
new_node.name = stomp_desc.dest_node_name
|
||||
minetest.set_node(pos, new_node)
|
||||
end
|
||||
end
|
||||
|
||||
@ -93,8 +95,9 @@ function poschangelib.change_node(pos, stomped_node_name, reverted_node_name)
|
||||
-- Check if the node is still the right one
|
||||
local node = minetest.get_node(pos)
|
||||
if (node.name ~= stomped_node_name) then return end
|
||||
-- Replace it
|
||||
minetest.set_node(pos, {name = reverted_node_name})
|
||||
-- Replace it while keeping param, param2 and other things
|
||||
node.name = reverted_node_name
|
||||
minetest.set_node(pos, node)
|
||||
end
|
||||
|
||||
--[[
|
||||
|
Loading…
Reference in New Issue
Block a user