summaryrefslogtreecommitdiff
path: root/deployer.lua
diff options
context:
space:
mode:
authorPilcrow <pilcrowjesus@gmail.com>2013-09-13 11:09:57 -0400
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2013-09-13 11:09:57 -0400
commitcedb49d887b3a6782c4472813dc7b6ebeeedc2ea (patch)
treea51c10311b5b358a0ed43bf7ec0d08e5bdc1d34d /deployer.lua
parent59362e3d205941144d30439471aeb786a69f5e5d (diff)
downloadpipeworks-cedb49d887b3a6782c4472813dc7b6ebeeedc2ea.tar
pipeworks-cedb49d887b3a6782c4472813dc7b6ebeeedc2ea.tar.gz
pipeworks-cedb49d887b3a6782c4472813dc7b6ebeeedc2ea.tar.bz2
pipeworks-cedb49d887b3a6782c4472813dc7b6ebeeedc2ea.tar.xz
pipeworks-cedb49d887b3a6782c4472813dc7b6ebeeedc2ea.zip
Fix hacky_swap_node to not repeatedly swap the same node in over and over
Diffstat (limited to 'deployer.lua')
-rw-r--r--deployer.lua17
1 files changed, 10 insertions, 7 deletions
diff --git a/deployer.lua b/deployer.lua
index 4a17ddf..1e8ae17 100644
--- a/deployer.lua
+++ b/deployer.lua
@@ -88,13 +88,16 @@ minetest.register_craft({
})
function hacky_swap_node(pos,name)
- local node=minetest.get_node(pos)
- local meta=minetest.get_meta(pos)
- local meta0=meta:to_table()
- node.name=name
- minetest.add_node(pos, node)
- local meta=minetest.get_meta(pos)
- meta:from_table(meta0)
+ local node=minetest.get_node(pos)
+ local meta=minetest.get_meta(pos)
+ local meta0=meta:to_table()
+ if node.name == name then
+ return
+ end
+ node.name=name
+ minetest.add_node(pos, node)
+ local meta=minetest.get_meta(pos)
+ meta:from_table(meta0)
end
deployer_on = function(pos, node)