forked from mtcontrib/pipeworks
Fix hacky_swap_node to not repeatedly swap the same node in over and over
This commit is contained in:
parent
59362e3d20
commit
cedb49d887
17
deployer.lua
17
deployer.lua
@ -88,13 +88,16 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
function hacky_swap_node(pos,name)
|
function hacky_swap_node(pos,name)
|
||||||
local node=minetest.get_node(pos)
|
local node=minetest.get_node(pos)
|
||||||
local meta=minetest.get_meta(pos)
|
local meta=minetest.get_meta(pos)
|
||||||
local meta0=meta:to_table()
|
local meta0=meta:to_table()
|
||||||
node.name=name
|
if node.name == name then
|
||||||
minetest.add_node(pos, node)
|
return
|
||||||
local meta=minetest.get_meta(pos)
|
end
|
||||||
meta:from_table(meta0)
|
node.name=name
|
||||||
|
minetest.add_node(pos, node)
|
||||||
|
local meta=minetest.get_meta(pos)
|
||||||
|
meta:from_table(meta0)
|
||||||
end
|
end
|
||||||
|
|
||||||
deployer_on = function(pos, node)
|
deployer_on = function(pos, node)
|
||||||
|
@ -15,13 +15,16 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
function hacky_swap_node(pos,name)
|
function hacky_swap_node(pos,name)
|
||||||
local node=minetest.get_node(pos)
|
local node=minetest.get_node(pos)
|
||||||
local meta=minetest.get_meta(pos)
|
local meta=minetest.get_meta(pos)
|
||||||
local meta0=meta:to_table()
|
local meta0=meta:to_table()
|
||||||
node.name=name
|
if node.name == name then
|
||||||
minetest.add_node(pos, node)
|
return
|
||||||
local meta=minetest.get_meta(pos)
|
end
|
||||||
meta:from_table(meta0)
|
node.name=name
|
||||||
|
minetest.add_node(pos, node)
|
||||||
|
local meta=minetest.get_meta(pos)
|
||||||
|
meta:from_table(meta0)
|
||||||
end
|
end
|
||||||
|
|
||||||
--define the functions from https://github.com/minetest/minetest/pull/834 while waiting for the devs to notice it
|
--define the functions from https://github.com/minetest/minetest/pull/834 while waiting for the devs to notice it
|
||||||
|
Loading…
Reference in New Issue
Block a user