summaryrefslogtreecommitdiff
path: root/pipes.lua
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2013-12-15 04:35:59 -0500
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2013-12-15 04:35:59 -0500
commit659b4e42b2bb6b55a4031554664b6f371f903f5e (patch)
treedf7d7cbbf3b9d19573e144c7d94a1cb9a6210861 /pipes.lua
parentbd80f18cfce1fb69e78f7d5ce63e7264718378e7 (diff)
downloadpipeworks-659b4e42b2bb6b55a4031554664b6f371f903f5e.tar
pipeworks-659b4e42b2bb6b55a4031554664b6f371f903f5e.tar.gz
pipeworks-659b4e42b2bb6b55a4031554664b6f371f903f5e.tar.bz2
pipeworks-659b4e42b2bb6b55a4031554664b6f371f903f5e.tar.xz
pipeworks-659b4e42b2bb6b55a4031554664b6f371f903f5e.zip
local-ize a few more variables, move all of the nodebox models
into their own file and confine them and pretty much everything else to the pipeworks.{} table (still global though). More to come.
Diffstat (limited to 'pipes.lua')
-rw-r--r--pipes.lua147
1 files changed, 27 insertions, 120 deletions
diff --git a/pipes.lua b/pipes.lua
index ed1c238..25ced05 100644
--- a/pipes.lua
+++ b/pipes.lua
@@ -1,104 +1,10 @@
-pipeworks_liquid_texture = "default_water.png"
+-- This file supplies the steel pipes
-pipe_leftstub = {
- { -32/64, -2/64, -6/64, 1/64, 2/64, 6/64 }, -- pipe segment against -X face
- { -32/64, -4/64, -5/64, 1/64, 4/64, 5/64 },
- { -32/64, -5/64, -4/64, 1/64, 5/64, 4/64 },
- { -32/64, -6/64, -2/64, 1/64, 6/64, 2/64 },
-
- { -32/64, -3/64, -8/64, -30/64, 3/64, 8/64 }, -- (the flange for it)
- { -32/64, -5/64, -7/64, -30/64, 5/64, 7/64 },
- { -32/64, -6/64, -6/64, -30/64, 6/64, 6/64 },
- { -32/64, -7/64, -5/64, -30/64, 7/64, 5/64 },
- { -32/64, -8/64, -3/64, -30/64, 8/64, 3/64 }
-}
-
-pipe_rightstub = {
- { -1/64, -2/64, -6/64, 32/64, 2/64, 6/64 }, -- pipe segment against +X face
- { -1/64, -4/64, -5/64, 32/64, 4/64, 5/64 },
- { -1/64, -5/64, -4/64, 32/64, 5/64, 4/64 },
- { -1/64, -6/64, -2/64, 32/64, 6/64, 2/64 },
-
- { 30/64, -3/64, -8/64, 32/64, 3/64, 8/64 }, -- (the flange for it)
- { 30/64, -5/64, -7/64, 32/64, 5/64, 7/64 },
- { 30/64, -6/64, -6/64, 32/64, 6/64, 6/64 },
- { 30/64, -7/64, -5/64, 32/64, 7/64, 5/64 },
- { 30/64, -8/64, -3/64, 32/64, 8/64, 3/64 }
-}
-
-pipe_bottomstub = {
- { -2/64, -32/64, -6/64, 2/64, 1/64, 6/64 }, -- pipe segment against -Y face
- { -4/64, -32/64, -5/64, 4/64, 1/64, 5/64 },
- { -5/64, -32/64, -4/64, 5/64, 1/64, 4/64 },
- { -6/64, -32/64, -2/64, 6/64, 1/64, 2/64 },
-
- { -3/64, -32/64, -8/64, 3/64, -30/64, 8/64 }, -- (the flange for it)
- { -5/64, -32/64, -7/64, 5/64, -30/64, 7/64 },
- { -6/64, -32/64, -6/64, 6/64, -30/64, 6/64 },
- { -7/64, -32/64, -5/64, 7/64, -30/64, 5/64 },
- { -8/64, -32/64, -3/64, 8/64, -30/64, 3/64 }
-}
-
-
-pipe_topstub = {
- { -2/64, -1/64, -6/64, 2/64, 32/64, 6/64 }, -- pipe segment against +Y face
- { -4/64, -1/64, -5/64, 4/64, 32/64, 5/64 },
- { -5/64, -1/64, -4/64, 5/64, 32/64, 4/64 },
- { -6/64, -1/64, -2/64, 6/64, 32/64, 2/64 },
-
- { -3/64, 30/64, -8/64, 3/64, 32/64, 8/64 }, -- (the flange for it)
- { -5/64, 30/64, -7/64, 5/64, 32/64, 7/64 },
- { -6/64, 30/64, -6/64, 6/64, 32/64, 6/64 },
- { -7/64, 30/64, -5/64, 7/64, 32/64, 5/64 },
- { -8/64, 30/64, -3/64, 8/64, 32/64, 3/64 }
-}
-
-pipe_frontstub = {
- { -6/64, -2/64, -32/64, 6/64, 2/64, 1/64 }, -- pipe segment against -Z face
- { -5/64, -4/64, -32/64, 5/64, 4/64, 1/64 },
- { -4/64, -5/64, -32/64, 4/64, 5/64, 1/64 },
- { -2/64, -6/64, -32/64, 2/64, 6/64, 1/64 },
-
- { -8/64, -3/64, -32/64, 8/64, 3/64, -30/64 }, -- (the flange for it)
- { -7/64, -5/64, -32/64, 7/64, 5/64, -30/64 },
- { -6/64, -6/64, -32/64, 6/64, 6/64, -30/64 },
- { -5/64, -7/64, -32/64, 5/64, 7/64, -30/64 },
- { -3/64, -8/64, -32/64, 3/64, 8/64, -30/64 }
-}
-
-pipe_backstub = {
- { -6/64, -2/64, -1/64, 6/64, 2/64, 32/64 }, -- pipe segment against -Z face
- { -5/64, -4/64, -1/64, 5/64, 4/64, 32/64 },
- { -4/64, -5/64, -1/64, 4/64, 5/64, 32/64 },
- { -2/64, -6/64, -1/64, 2/64, 6/64, 32/64 },
-
- { -8/64, -3/64, 30/64, 8/64, 3/64, 32/64 }, -- (the flange for it)
- { -7/64, -5/64, 30/64, 7/64, 5/64, 32/64 },
- { -6/64, -6/64, 30/64, 6/64, 6/64, 32/64 },
- { -5/64, -7/64, 30/64, 5/64, 7/64, 32/64 },
- { -3/64, -8/64, 30/64, 3/64, 8/64, 32/64 }
-}
-
-pipe_selectboxes = {
- { -32/64, -8/64, -8/64, 8/64, 8/64, 8/64 },
- { -8/64 , -8/64, -8/64, 32/64, 8/64, 8/64 },
- { -8/64 , -32/64, -8/64, 8/64, 8/64, 8/64 },
- { -8/64 , -8/64, -8/64, 8/64, 32/64, 8/64 },
- { -8/64 , -8/64, -32/64, 8/64, 8/64, 8/64 },
- { -8/64 , -8/64, -8/64, 8/64, 8/64, 32/64 }
-}
-
-pipe_bendsphere = {
- { -4/64, -4/64, -4/64, 4/64, 4/64, 4/64 },
- { -5/64, -3/64, -3/64, 5/64, 3/64, 3/64 },
- { -3/64, -5/64, -3/64, 3/64, 5/64, 3/64 },
- { -3/64, -3/64, -5/64, 3/64, 3/64, 5/64 }
-}
-
--- now define the nodes!
-
-pipes_empty_nodenames = {}
-pipes_full_nodenames = {}
+local pipes_empty_nodenames = {}
+local pipes_full_nodenames = {}
+local outboxes = {}
+local outsel = {}
+local outimgs = {}
for xm = 0, 1 do
for xp = 0, 1 do
@@ -106,48 +12,49 @@ for ym = 0, 1 do
for yp = 0, 1 do
for zm = 0, 1 do
for zp = 0, 1 do
- local outboxes = {}
- local outsel = {}
- local outimgs = {}
+
+ outboxes = {}
+ outsel = {}
+ outimgs = {}
if yp==1 then
- pipeworks.add_pipebox(outboxes, pipe_topstub)
- table.insert(outsel, pipe_selectboxes[4])
+ pipeworks.add_node_box(outboxes, pipeworks.pipe_topstub)
+ table.insert(outsel, pipeworks.pipe_selectboxes[4])
table.insert(outimgs, "pipeworks_pipe_end.png")
else
table.insert(outimgs, "pipeworks_plain.png")
end
if ym==1 then
- pipeworks.add_pipebox(outboxes, pipe_bottomstub)
- table.insert(outsel, pipe_selectboxes[3])
+ pipeworks.add_node_box(outboxes, pipeworks.pipe_bottomstub)
+ table.insert(outsel, pipeworks.pipe_selectboxes[3])
table.insert(outimgs, "pipeworks_pipe_end.png")
else
table.insert(outimgs, "pipeworks_plain.png")
end
if xp==1 then
- pipeworks.add_pipebox(outboxes, pipe_rightstub)
- table.insert(outsel, pipe_selectboxes[2])
+ pipeworks.add_node_box(outboxes, pipeworks.pipe_rightstub)
+ table.insert(outsel, pipeworks.pipe_selectboxes[2])
table.insert(outimgs, "pipeworks_pipe_end.png")
else
table.insert(outimgs, "pipeworks_plain.png")
end
if xm==1 then
- pipeworks.add_pipebox(outboxes, pipe_leftstub)
- table.insert(outsel, pipe_selectboxes[1])
+ pipeworks.add_node_box(outboxes, pipeworks.pipe_leftstub)
+ table.insert(outsel, pipeworks.pipe_selectboxes[1])
table.insert(outimgs, "pipeworks_pipe_end.png")
else
table.insert(outimgs, "pipeworks_plain.png")
end
if zp==1 then
- pipeworks.add_pipebox(outboxes, pipe_backstub)
- table.insert(outsel, pipe_selectboxes[6])
+ pipeworks.add_node_box(outboxes, pipeworks.pipe_backstub)
+ table.insert(outsel, pipeworks.pipe_selectboxes[6])
table.insert(outimgs, "pipeworks_pipe_end.png")
else
table.insert(outimgs, "pipeworks_plain.png")
end
if zm==1 then
- pipeworks.add_pipebox(outboxes, pipe_frontstub)
- table.insert(outsel, pipe_selectboxes[5])
+ pipeworks.add_node_box(outboxes, pipeworks.pipe_frontstub)
+ table.insert(outsel, pipeworks.pipe_selectboxes[5])
table.insert(outimgs, "pipeworks_pipe_end.png")
else
table.insert(outimgs, "pipeworks_plain.png")
@@ -185,21 +92,21 @@ for zp = 0, 1 do
end
if jx+jy+jz >= 2 then
- pipeworks.add_pipebox(outboxes, pipe_bendsphere)
+ pipeworks.add_node_box(outboxes, pipeworks.pipe_bendsphere)
end
if (jx==2 and jy~=2 and jz~=2) then
table.remove(outimgs, 5)
table.remove(outimgs, 5)
- table.insert(outimgs, 5, pipeworks_liquid_texture.."^pipeworks_windowed_XXXXX.png")
- table.insert(outimgs, 5, pipeworks_liquid_texture.."^pipeworks_windowed_XXXXX.png")
+ table.insert(outimgs, 5, pipeworks.liquid_texture.."^pipeworks_windowed_XXXXX.png")
+ table.insert(outimgs, 5, pipeworks.liquid_texture.."^pipeworks_windowed_XXXXX.png")
end
if (jx~=2 and jy~=2 and jz==2) or (jx~=2 and jy==2 and jz~=2) then
table.remove(outimgs, 3)
table.remove(outimgs, 3)
- table.insert(outimgs, 3, pipeworks_liquid_texture.."^pipeworks_windowed_XXXXX.png")
- table.insert(outimgs, 3, pipeworks_liquid_texture.."^pipeworks_windowed_XXXXX.png")
+ table.insert(outimgs, 3, pipeworks.liquid_texture.."^pipeworks_windowed_XXXXX.png")
+ table.insert(outimgs, 3, pipeworks.liquid_texture.."^pipeworks_windowed_XXXXX.png")
end
local pname = xm..xp..ym..yp..zm..zp