summaryrefslogtreecommitdiff
path: root/autoplace_tubes.lua
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2013-12-15 05:35:11 -0500
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2013-12-15 05:40:26 -0500
commit53f6e67399154c5b104bdd583668fdaf7bb110d1 (patch)
tree83d3bdb8d522519c25651c9e653b73b82f00e8f7 /autoplace_tubes.lua
parent2481c06bf0214c3a0723e31c05166ac9983eef77 (diff)
downloadpipeworks-53f6e67399154c5b104bdd583668fdaf7bb110d1.tar
pipeworks-53f6e67399154c5b104bdd583668fdaf7bb110d1.tar.gz
pipeworks-53f6e67399154c5b104bdd583668fdaf7bb110d1.tar.bz2
pipeworks-53f6e67399154c5b104bdd583668fdaf7bb110d1.tar.xz
pipeworks-53f6e67399154c5b104bdd583668fdaf7bb110d1.zip
local-ize a few more functions
Diffstat (limited to 'autoplace_tubes.lua')
-rw-r--r--autoplace_tubes.lua28
1 files changed, 14 insertions, 14 deletions
diff --git a/autoplace_tubes.lua b/autoplace_tubes.lua
index cbca2ba..7f47488 100644
--- a/autoplace_tubes.lua
+++ b/autoplace_tubes.lua
@@ -1,24 +1,13 @@
-- autorouting for pneumatic tubes
-function pipeworks.scan_for_tube_objects(pos)
- if pos == nil then return end
- tube_autoroute({ x=pos.x-1, y=pos.y , z=pos.z })
- tube_autoroute({ x=pos.x+1, y=pos.y , z=pos.z })
- tube_autoroute({ x=pos.x , y=pos.y-1, z=pos.z })
- tube_autoroute({ x=pos.x , y=pos.y+1, z=pos.z })
- tube_autoroute({ x=pos.x , y=pos.y , z=pos.z-1 })
- tube_autoroute({ x=pos.x , y=pos.y , z=pos.z+1 })
- tube_autoroute(pos)
-end
-
-function in_table(table,element)
+local function in_table(table,element)
for _,el in ipairs(table) do
if el==element then return true end
end
return false
end
-function is_tube(nodename)
+local function is_tube(nodename)
return in_table(tubenodes,nodename)
end
@@ -84,7 +73,7 @@ local function nodeside(node, tubedir)
minetest.log("error", "nodeside has been confused by its parameters; see pipeworks autoplace_tubes.lua, line 78")
end
-function tube_autoroute(pos)
+local function tube_autoroute(pos)
local active = {0, 0, 0, 0, 0, 0}
local nctr = minetest.get_node(pos)
if not is_tube(nctr.name) then return end
@@ -135,6 +124,17 @@ function tube_autoroute(pos)
local nctr = minetest.get_node(pos)
end
+function pipeworks.scan_for_tube_objects(pos)
+ if pos == nil then return end
+ tube_autoroute({ x=pos.x-1, y=pos.y , z=pos.z })
+ tube_autoroute({ x=pos.x+1, y=pos.y , z=pos.z })
+ tube_autoroute({ x=pos.x , y=pos.y-1, z=pos.z })
+ tube_autoroute({ x=pos.x , y=pos.y+1, z=pos.z })
+ tube_autoroute({ x=pos.x , y=pos.y , z=pos.z-1 })
+ tube_autoroute({ x=pos.x , y=pos.y , z=pos.z+1 })
+ tube_autoroute(pos)
+end
+
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
if minetest.registered_items[newnode.name]
and minetest.registered_items[newnode.name].tube