summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2012-08-18 08:46:17 -0400
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2012-08-18 08:46:17 -0400
commit4ccb053e039237bae91f1a56a961793a3dc2caaa (patch)
treeeb230b07cb9a5cbc9a9c6a0933058035962d2bc8
parente388ab5b5c0b07fea2561de86e202aefa903fccd (diff)
downloadpipeworks-4ccb053e039237bae91f1a56a961793a3dc2caaa.tar
pipeworks-4ccb053e039237bae91f1a56a961793a3dc2caaa.tar.gz
pipeworks-4ccb053e039237bae91f1a56a961793a3dc2caaa.tar.bz2
pipeworks-4ccb053e039237bae91f1a56a961793a3dc2caaa.tar.xz
pipeworks-4ccb053e039237bae91f1a56a961793a3dc2caaa.zip
Total rewrite again. All pipes are now nice and round-looking, and they auto-connect! Also added temporary nodes for pump
and valve (each with an on/off setting - punch to change). No crafting recipes yet and the pipes still don't do anything useful yet. Soon.
-rw-r--r--init.lua748
-rw-r--r--oldpipes.lua353
-rw-r--r--textures/pipeworks_pipe_end.pngbin423 -> 2149 bytes
-rw-r--r--textures/pipeworks_plain.pngbin296 -> 1872 bytes
-rw-r--r--textures/pipeworks_pump_ends.pngbin0 -> 6410 bytes
-rw-r--r--textures/pipeworks_pump_off.pngbin0 -> 5185 bytes
-rw-r--r--textures/pipeworks_pump_on.pngbin0 -> 6488 bytes
-rw-r--r--textures/pipeworks_pump_sides.pngbin0 -> 5389 bytes
-rw-r--r--textures/pipeworks_valvebody_bottom.pngbin0 -> 5321 bytes
-rw-r--r--textures/pipeworks_valvebody_ends.pngbin0 -> 6138 bytes
-rw-r--r--textures/pipeworks_valvebody_sides.pngbin0 -> 4592 bytes
-rw-r--r--textures/pipeworks_valvebody_top_off.pngbin0 -> 4557 bytes
-rw-r--r--textures/pipeworks_valvebody_top_on.pngbin0 -> 4559 bytes
-rw-r--r--textures/pipeworks_windowed_empty.pngbin335 -> 1945 bytes
-rw-r--r--textures/pipeworks_windowed_loaded.pngbin345 -> 1950 bytes
15 files changed, 790 insertions, 311 deletions
diff --git a/init.lua b/init.lua
index 1c8c147..713b5da 100644
--- a/init.lua
+++ b/init.lua
@@ -6,361 +6,487 @@
-- License: WTFPL
--
-local DEBUG = 0
+-- uncomment the following dofile line to enable the old pipe nodes.
+-- dofile(minetest.get_modpath("pipeworks").."/oldpipes.lua")
--- Local Functions
+-- tables
-local dbg = function(s)
- if DEBUG == 1 then
- print('[PIPEWORKS] ' .. s)
- end
-end
+minetest.register_alias("pipeworks:pipe", "pipeworks:pipe_000000_empty")
+
+local 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 }
+}
+
+local 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 }
+}
+
+local 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 }
+}
+
+
+local 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 }
+}
+
+local 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 }
+}
+
+local 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 }
+}
+
+local 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 }
+}
-local nodenames = {
- "vertical",
- "horizontal",
- "junction_xy",
- "junction_xz",
- "bend_xy_down",
- "bend_xy_up",
- "bend_xz",
- "crossing_xz",
- "crossing_xy",
- "crossing_xyz",
- "pipe",
- "cap_neg_x",
- "cap_pos_x",
- "cap_neg_y",
- "cap_pos_y",
- "cap_neg_z",
- "cap_pos_z"
+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 }
}
-local descriptions = {
- "vertical",
- "horizontal",
- "junction between X and Y axes",
- "junction between X and Z axes",
- "downward bend between X and Y axes",
- "upward bend between X and Y axes",
- "bend between X/Z axes",
- "4-way crossing between X and Z axes",
- "4-way crossing between X/Z and Y axes",
- "6-way crossing",
- "basic segment",
- "capped, negative X half only",
- "capped, positive X half only",
- "capped, negative Y half only",
- "capped, positive Y half only",
- "capped, negative Z half only",
- "capped, positive Z half only"
+pumpbody = {
+ { -6/16, -8/16, -6/16, 6/16, 8/16, 6/16 }
}
-local nodeimages = {
- {"pipeworks_pipe_end.png",
- "pipeworks_pipe_end.png",
- "pipeworks_plain.png",
- "pipeworks_plain.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png"},
-
- {"pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_pipe_end.png",
- "pipeworks_pipe_end.png",
- "pipeworks_plain.png",
- "pipeworks_plain.png"},
-
- {"pipeworks_pipe_end.png",
- "pipeworks_pipe_end.png",
- "pipeworks_pipe_end.png",
- "pipeworks_plain.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png"},
-
- {"pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_pipe_end.png",
- "pipeworks_pipe_end.png",
- "pipeworks_pipe_end.png",
- "pipeworks_plain.png"},
-
- {"pipeworks_plain.png",
- "pipeworks_pipe_end.png",
- "pipeworks_pipe_end.png",
- "pipeworks_plain.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png"},
-
- {"pipeworks_pipe_end.png",
- "pipeworks_plain.png",
- "pipeworks_pipe_end.png",
- "pipeworks_plain.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png"},
-
- {"pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_pipe_end.png",
- "pipeworks_plain.png",
- "pipeworks_pipe_end.png",
- "pipeworks_plain.png"},
-
- {"pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_pipe_end.png",
- "pipeworks_pipe_end.png",
- "pipeworks_pipe_end.png",
- "pipeworks_pipe_end.png"},
-
- {"pipeworks_pipe_end.png",
- "pipeworks_pipe_end.png",
- "pipeworks_pipe_end.png",
- "pipeworks_pipe_end.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png"},
-
- {"pipeworks_pipe_end.png",
- "pipeworks_pipe_end.png",
- "pipeworks_pipe_end.png",
- "pipeworks_pipe_end.png",
- "pipeworks_pipe_end.png",
- "pipeworks_pipe_end.png"},
-
--- horizontal short segment
-
- {"pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_pipe_end.png",
- "pipeworks_pipe_end.png",
- "pipeworks_plain.png",
- "pipeworks_plain.png"},
-
--- capped
-
- {"pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_pipe_end.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png"},
-
- {"pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_pipe_end.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png"},
-
- {"pipeworks_windowed_XXXXX.png",
- "pipeworks_pipe_end.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png"},
-
- {"pipeworks_pipe_end.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png"},
-
- {"pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_pipe_end.png"},
-
- {"pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_windowed_XXXXX.png",
- "pipeworks_pipe_end.png",
- "pipeworks_windowed_XXXXX.png"},
+valvebody = {
+ { -4/16, -4/16, -4/16, 4/16, 4/16, 4/16 }
}
-local selectionboxes = {
- { -0.15, -0.5, -0.15, 0.15, 0.5, 0.15 },
- { -0.5, -0.15, -0.15, 0.5, 0.15, 0.15 },
- { -0.15, -0.5, -0.15, 0.5, 0.5, 0.15 },
- { -0.5, -0.15, -0.15, 0.5, 0.15, 0.5 },
- { -0.15, -0.5, -0.15, 0.5, 0.15, 0.15 },
- { -0.15, -0.15, -0.15, 0.5, 0.5, 0.15 },
- { -0.15, -0.15, -0.15, 0.5, 0.15, 0.5 },
- { -0.5, -0.15, -0.5, 0.5, 0.15, 0.5 },
- { -0.5, -0.5, -0.15, 0.5, 0.5, 0.15 },
- { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },
- { -0.3, -0.15, -0.15, 0.3, 0.15, 0.15 },
- { -0.5, -0.15, -0.15, 0, 0.15, 0.15 },
- { 0, -0.15, -0.15, 0.5, 0.15, 0.15 },
- { -0.15, -0.5, -0.15, 0.15, 0, 0.15 },
- { -0.15, 0, -0.15, 0.15, 0.5, 0.15 },
- { -0.15, -0.15, -0.5, 0.15, 0.15, 0 },
- { -0.15, -0.15, 0, 0.15, 0.15, 0.5 },
+valvehandle_on = {
+ { -5/16, 4/16, -1/16, 0, 5/16, 1/16 }
}
-local nodeboxes = {
- {{ -0.15, -0.5 , -0.15, 0.15, -0.45, 0.15 }, -- vertical
- { -0.1 , -0.45, -0.1 , 0.1 , 0.45, 0.1 },
- { -0.15, 0.45, -0.15, 0.15, 0.5 , 0.15 }},
-
- {{ -0.5 , -0.15, -0.15, -0.45, 0.15, 0.15 }, -- horizontal
- { -0.45, -0.1 , -0.1 , 0.45, 0.1 , 0.1 },
- { 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }},
-
- {{ -0.15, -0.5 , -0.15, 0.15, -0.45, 0.15 }, -- vertical with X/Z junction
- { -0.1 , -0.45, -0.1 , 0.1 , 0.45, 0.1 },
- { -0.15, 0.45, -0.15, 0.15, 0.5 , 0.15 },
- { 0.1 , -0.1 , -0.1 , 0.45, 0.1 , 0.1 },
- { 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }},
-
- {{ -0.15, -0.15, 0.45, 0.15, 0.15, 0.5 }, -- horizontal with X/Z junction
- { -0.1 , -0.1 , 0.1 , 0.1 , 0.1 , 0.45 },
- { -0.5 , -0.15, -0.15, -0.45, 0.15, 0.15 },
- { -0.45, -0.1 , -0.1 , 0.45, 0.1 , 0.1 },
- { 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }},
-
- {{ -0.15, -0.5 , -0.15, 0.15, -0.45, 0.15 }, -- bend down from X/Z to Y axis
- { -0.1 , -0.45, -0.1 , 0.1 , 0.1 , 0.1 },
- { -0.1 , -0.1 , -0.1 , 0.45, 0.1 , 0.1 },
- { 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }},
-
- {{ -0.15, 0.45 , -0.15, 0.15, 0.5, 0.15 }, -- bend up from X/Z to Y axis
- { -0.1 , -0.1 , -0.1 , 0.1 , 0.45, 0.1 },
- { -0.1 , -0.1 , -0.1 , 0.45, 0.1 , 0.1 },
- { 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }},
-
- {{ -0.15, -0.15, 0.45, 0.15, 0.15, 0.5 }, -- bend between X and Z axes
- { -0.1 , -0.1 , 0.1 , 0.1 , 0.1 , 0.45 },
- { -0.1 , -0.1 , -0.1 , 0.45, 0.1 , 0.1 },
- { 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }},
-
- {{ -0.5 , -0.15, -0.15, -0.45, 0.15, 0.15 }, -- 4-way crossing between X and Z axes
- { -0.45, -0.1 , -0.1 , 0.45, 0.1 , 0.1 },
- { 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 },
- { -0.15, -0.15, -0.5 , 0.15, 0.15, -0.45 },
- { -0.1 , -0.1 , -0.45, 0.1 , 0.1 , 0.45 },
- { -0.15, -0.15, 0.45, 0.15, 0.15, 0.5 }},
-
- {{ -0.15, -0.5 , -0.15, 0.15, -0.45, 0.15 }, -- 4-way crossing between X/Z and Y axes
- { -0.1 , -0.45, -0.1 , 0.1 , 0.45, 0.1 },
- { -0.15, 0.45, -0.15, 0.15, 0.5 , 0.15 },
- { -0.5 , -0.15, -0.15, -0.45, 0.15, 0.15 },
- { -0.45, -0.1 , -0.1 , 0.45, 0.1 , 0.1 },
- { 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }},
-
- {{ -0.5 , -0.15, -0.15, -0.45, 0.15, 0.15 }, -- 6-way crossing (all 3 axes)
- { -0.45, -0.1 , -0.1 , 0.45, 0.1 , 0.1 },
- { 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 },
- { -0.15, -0.15, -0.5 , 0.15, 0.15, -0.45 },
- { -0.1 , -0.1 , -0.45, 0.1 , 0.1 , 0.45 },
- { -0.15, -0.15, 0.45, 0.15, 0.15, 0.5 },
- { -0.15, -0.5 , -0.15, 0.15, -0.45, 0.15 },
- { -0.1 , -0.45, -0.1 , 0.1 , 0.45, 0.1 },
- { -0.15, 0.45, -0.15, 0.15, 0.5 , 0.15 }},
-
- {{ -0.3 , -0.15, -0.15, -0.25, 0.15, 0.15 }, -- main center segment
- { -0.25, -0.1 , -0.1 , 0.25, 0.1 , 0.1 },
- { 0.25, -0.15, -0.15, 0.3 , 0.15, 0.15 }},
-
- {{ -0.5, -0.15, -0.15, -0.45, 0.15, 0.15 }, -- anchored at -X
- { -0.45, -0.1, -0.1, -0.2, 0.1, 0.1 },
- { -0.2, -0.15, -0.15, -0.15, 0.15, 0.15 },
- { -0.15, -0.12, -0.12, -0.1, 0.12, 0.12 },
- { -0.1, -0.08, -0.08, -0.05, 0.08, 0.08 },
- { -0.05, -0.04, -0.04, 0, 0.04, 0.04 }},
-
- {{ 0.45, -0.15, -0.15, 0.5, 0.15, 0.15 }, -- anchored at +X
- { 0.2, -0.1, -0.1, 0.45, 0.1, 0.1 },
- { 0.15, -0.15, -0.15, 0.2, 0.15, 0.15 },
- { 0.1, -0.12, -0.12, 0.15, 0.12, 0.12 },
- { 0.05, -0.08, -0.08, 0.1, 0.08, 0.08 },
- { 0, -0.04, -0.04, 0.05, 0.04, 0.04 }},
-
- {{ -0.15, -0.5, -0.15, 0.15, -0.45, 0.15 }, -- anchored at -Y
- { -0.1, -0.45, -0.1, 0.1, -0.2, 0.1 },
- { -0.15, -0.2, -0.15, 0.15, -0.15, 0.15 },
- { -0.12, -0.15, -0.12, 0.12, -0.1, 0.12 },
- { -0.08, -0.1, -0.08, 0.08, -0.05, 0.08 },
- { -0.04, -0.05, -0.04, 0.04, 0, 0.04 }},
-
- {{ -0.15, 0.45, -0.15, 0.15, 0.5, 0.15 }, -- anchored at +Y
- { -0.1, 0.2, -0.1, 0.1, 0.45, 0.1 },
- { -0.15, 0.15, -0.15, 0.15, 0.2, 0.15 },
- { -0.12, 0.1, -0.12, 0.12, 0.15, 0.12 },
- { -0.08, 0.05, -0.08, 0.08, 0.1, 0.08 } ,
- { -0.04, 0, -0.04, 0.04, 0.05, 0.04 }},
-
- {{ -0.15, -0.15, -0.5, 0.15, 0.15, -0.45 }, -- anchored at -Z
- { -0.1, -0.1, -0.45, 0.1, 0.1, -0.2 },
- { -0.15, -0.15, -0.2, 0.15, 0.15, -0.15 },
- { -0.12, -0.12, -0.15, 0.12, 0.12, -0.1 },
- { -0.08, -0.08, -0.1, 0.08, 0.08, -0.05 },
- { -0.04, -0.04, -0.05, 0.04, 0.04, 0 }},
-
- {{ -0.15, -0.15, 0.45, 0.15, 0.15, 0.5 }, -- anchored at +Z
- { -0.1, -0.1, 0.2, 0.1, 0.1, 0.45 },
- { -0.15, -0.15, 0.15, 0.15, 0.15, 0.2 },
- { -0.12, -0.12, 0.1, 0.12, 0.12, 0.15 },
- { -0.08, -0.08, 0.05, 0.08, 0.08, 0.1 },
- { -0.04, -0.04, 0, 0.04, 0.04, 0.05 }},
+valvehandle_off = {
+ { -1/16, 4/16, -5/16, 1/16, 5/16, 0 }
}
-function fix_image_names(node, replacement)
+
+-- Local Functions
+
+local dbg = function(s)
+ if DEBUG == 1 then
+ print('[PIPEWORKS] ' .. s)
+ end
+end
+
+function fix_newpipe_names(table, replacement)
outtable={}
- for i in ipairs(nodeimages[node]) do
- outtable[i]=string.gsub(nodeimages[node][i], "_XXXXX", replacement)
+ for i in ipairs(table) do
+ outtable[i]=string.gsub(table[i], "_XXXXX", replacement)
end
return outtable
end
--- Now define the actual nodes
+local function addbox(t, b)
+ for i in ipairs(b)
+ do table.insert(t, b[i])
+ end
+end
+
+local function autoroute(pos, state)
+
+ local nctr = minetest.env:get_node(pos)
+ if (string.find(nctr.name, "pipeworks:pipe_") == nil) then return end
+
+ local pxm=0
+ local pxp=0
+ local pym=0
+ local pyp=0
+ local pzm=0
+ local pzp=0
+
+ local nxm = minetest.env:get_node({ x=pos.x-1, y=pos.y , z=pos.z })
+ local nxp = minetest.env:get_node({ x=pos.x+1, y=pos.y , z=pos.z })
+ local nym = minetest.env:get_node({ x=pos.x , y=pos.y-1, z=pos.z })
+ local nyp = minetest.env:get_node({ x=pos.x , y=pos.y+1, z=pos.z })
+ local nzm = minetest.env:get_node({ x=pos.x , y=pos.y , z=pos.z-1 })
+ local nzp = minetest.env:get_node({ x=pos.x , y=pos.y , z=pos.z+1 })
+
+ if (string.find(nxm.name, "pipeworks:pipe_") ~= nil) then pxm=1 end
+ if (string.find(nxp.name, "pipeworks:pipe_") ~= nil) then pxp=1 end
+ if (string.find(nym.name, "pipeworks:pipe_") ~= nil) then pym=1 end
+ if (string.find(nyp.name, "pipeworks:pipe_") ~= nil) then pyp=1 end
+ if (string.find(nzm.name, "pipeworks:pipe_") ~= nil) then pzm=1 end
+ if (string.find(nzp.name, "pipeworks:pipe_") ~= nil) then pzp=1 end
+
+ local nsurround = pxm..pxp..pym..pyp..pzm..pzp
+
+ if nsurround == "000000" then nsurround = "110000" end
+
+ minetest.env:add_node(pos, { name = "pipeworks:pipe_"..nsurround..state })
+end
+
+-- now define the nodes!
+
+for xm = 0, 1 do
+for xp = 0, 1 do
+for ym = 0, 1 do
+for yp = 0, 1 do
+for zm = 0, 1 do
+for zp = 0, 1 do
+ outboxes = {}
+ outsel = {}
+ outimgs = {}
+ if yp==1 then
+ addbox(outboxes, topstub)
+ table.insert(outsel, selectboxes[4])
+ table.insert(outimgs, "pipeworks_pipe_end.png")
+ else
+ table.insert(outimgs, "pipeworks_plain.png")
+ end
+ if ym==1 then
+ addbox(outboxes, bottomstub)
+ table.insert(outsel, selectboxes[3])
+ table.insert(outimgs, "pipeworks_pipe_end.png")
+ else
+ table.insert(outimgs, "pipeworks_plain.png")
+ end
+ if xp==1 then
+ addbox(outboxes, rightstub)
+ table.insert(outsel, selectboxes[2])
+ table.insert(outimgs, "pipeworks_pipe_end.png")
+ else
+ table.insert(outimgs, "pipeworks_plain.png")
+ end
+ if xm==1 then
+ addbox(outboxes, leftstub)
+ table.insert(outsel, selectboxes[1])
+ table.insert(outimgs, "pipeworks_pipe_end.png")
+ else
+ table.insert(outimgs, "pipeworks_plain.png")
+ end
+ if zp==1 then
+ addbox(outboxes, backstub)
+ table.insert(outsel, selectboxes[6])
+ table.insert(outimgs, "pipeworks_pipe_end.png")
+ else
+ table.insert(outimgs, "pipeworks_plain.png")
+ end
+ if zm==1 then
+ addbox(outboxes, frontstub)
+ table.insert(outsel, selectboxes[5])
+ table.insert(outimgs, "pipeworks_pipe_end.png")
+ else
+ table.insert(outimgs, "pipeworks_plain.png")
+ end
+
+ jx = xp+xm
+ jy = yp+ym
+ jz = zp+zm
+
+ if (jx==1 and jy==1 and jz~=1) or (jx==1 and jy~=1 and jz==1) or (jx~= 1 and jy==1 and jz==1) then
+ addbox(outboxes, 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_windowed_XXXXX.png")
+ table.insert(outimgs, 5, "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_windowed_XXXXX.png")
+ table.insert(outimgs, 3, "pipeworks_windowed_XXXXX.png")
+ end
+
+ pname = xm..xp..ym..yp..zm..zp
-for node in ipairs(nodenames) do
- minetest.register_node("pipeworks:"..nodenames[node], {
- description = "Empty Pipe ("..descriptions[node]..")",
+ minetest.register_node("pipeworks:pipe_"..pname.."_empty", {
+ description = "Pipe segment (empty, "..pname..").",
drawtype = "nodebox",
- tiles = fix_image_names(node, "_empty"),
+ tiles = fix_newpipe_names(outimgs, "_empty"),
paramtype = "light",
- paramtype2 = "facedir",
selection_box = {
- type = "fixed",
- fixed = selectionboxes[node],
+ type = "fixed",
+ fixed = outsel
},
node_box = {
type = "fixed",
- fixed = nodeboxes[node]
+ fixed = outboxes
},
groups = {snappy=3, pipe=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
stack_max = 99,
- drop = "pipeworks:pipe"
+ drop = "pipeworks:pipe_110000_empty",
+ after_place_node = function(pos)
+ autoroute({ x=pos.x-1, y=pos.y , z=pos.z }, "_empty")
+ autoroute({ x=pos.x+1, y=pos.y , z=pos.z }, "_empty")
+ autoroute({ x=pos.x , y=pos.y-1, z=pos.z }, "_empty")
+ autoroute({ x=pos.x , y=pos.y+1, z=pos.z }, "_empty")
+ autoroute({ x=pos.x , y=pos.y , z=pos.z-1 }, "_empty")
+ autoroute({ x=pos.x , y=pos.y , z=pos.z+1 }, "_empty")
+ autoroute(pos, "_empty")
+ end,
+ after_dig_node = function(pos)
+ autoroute({ x=pos.x-1, y=pos.y , z=pos.z }, "_empty")
+ autoroute({ x=pos.x+1, y=pos.y , z=pos.z }, "_empty")
+ autoroute({ x=pos.x , y=pos.y-1, z=pos.z }, "_empty")
+ autoroute({ x=pos.x , y=pos.y+1, z=pos.z }, "_empty")
+ autoroute({ x=pos.x , y=pos.y , z=pos.z-1 }, "_empty")
+ autoroute({ x=pos.x , y=pos.y , z=pos.z+1 }, "_empty")
+ end
})
- minetest.register_node("pipeworks:"..nodenames[node].."_loaded", {
- description = "Loaded Pipe ("..descriptions[node]..")",
+ minetest.register_node("pipeworks:pipe_"..pname.."_loaded", {
+ description = "Pipe segment (loaded, "..pname..").",
drawtype = "nodebox",
- tiles = fix_image_names(node, "_loaded"),
+ tiles = fix_newpipe_names(outimgs, "_loaded"),
paramtype = "light",
- paramtype2 = "facedir",
selection_box = {
- type = "fixed",
- fixed = selectionboxes[node],
- },
+ type = "fixed",
+ fixed = outsel
+ },
node_box = {
type = "fixed",
- fixed = nodeboxes[node]
+ fixed = outboxes
},
groups = {snappy=3, pipe=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
stack_max = 99,
- drop = "pipeworks:pipe"
+ drop = "pipeworks:pipe_110000_loaded",
+ after_place_node = function(pos)
+ autoroute({ x=pos.x-1, y=pos.y , z=pos.z }, "_loaded")
+ autoroute({ x=pos.x+1, y=pos.y , z=pos.z }, "_loaded")
+ autoroute({ x=pos.x , y=pos.y-1, z=pos.z }, "_loaded")
+ autoroute({ x=pos.x , y=pos.y+1, z=pos.z }, "_loaded")
+ autoroute({ x=pos.x , y=pos.y , z=pos.z-1 }, "_loaded")
+ autoroute({ x=pos.x , y=pos.y , z=pos.z+1 }, "_loaded")
+ autoroute(pos, "_loaded")
+ end,
+ after_dig_node = function(pos)
+ autoroute({ x=pos.x-1, y=pos.y , z=pos.z }, "_loaded")
+ autoroute({ x=pos.x+1, y=pos.y , z=pos.z }, "_loaded")
+ autoroute({ x=pos.x , y=pos.y-1, z=pos.z }, "_loaded")
+ autoroute({ x=pos.x , y=pos.y+1, z=pos.z }, "_loaded")
+ autoroute({ x=pos.x , y=pos.y , z=pos.z-1 }, "_loaded")
+ autoroute({ x=pos.x , y=pos.y , z=pos.z+1 }, "_loaded")
+ end
})
end
+end
+end
+end
+end
+end
+
+-- the pump module
+
+pumpboxes = {}
+addbox(pumpboxes, leftstub)
+addbox(pumpboxes, pumpbody)
+addbox(pumpboxes, rightstub)
+
+minetest.register_node("pipeworks:pump_on", {
+ description = "Pump Module (on)",
+ drawtype = "nodebox",
+ tiles = {
+ "pipeworks_pump_sides.png",
+ "pipeworks_pump_sides.png",
+ "pipeworks_pump_ends.png",
+ "pipeworks_pump_ends.png",
+ "pipeworks_pump_on.png",
+ "pipeworks_pump_on.png"
+ },
+ paramtype = "light",
+ selection_box = {
+ type = "fixed",
+ fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
+ },
+ node_box = {
+ type = "fixed",
+ fixed = pumpboxes
+ },
+ groups = {snappy=3, pipe=1},
+ sounds = default.node_sound_wood_defaults(),
+ walkable = true,
+ stack_max = 99,
+})
+
+minetest.register_node("pipeworks:pump_off", {
+ description = "Pump Module (off)",
+ drawtype = "nodebox",
+ tiles = {
+ "pipeworks_pump_sides.png",
+ "pipeworks_pump_sides.png",
+ "pipeworks_pump_ends.png",
+ "pipeworks_pump_ends.png",
+ "pipeworks_pump_off.png",
+ "pipeworks_pump_off.png"
+ },
+ paramtype = "light",
+ selection_box = {
+ type = "fixed",
+ fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
+ },
+ node_box = {
+ type = "fixed",
+ fixed = pumpboxes
+ },
+ groups = {snappy=3, pipe=1},
+ sounds = default.node_sound_wood_defaults(),
+ walkable = true,
+ stack_max = 99,
+})
+
+-- valve module
+
+valveboxes = {}
+addbox(valveboxes, leftstub)
+addbox(valveboxes, valvebody)
+addbox(valveboxes, valvehandle_off)
+addbox(valveboxes, rightstub)
+
+minetest.register_node("pipeworks:valve_off", {
+ description = "Valve (off)",
+ drawtype = "nodebox",
+ tiles = {
+ "pipeworks_valvebody_top_off.png",
+ "pipeworks_valvebody_bottom.png",
+ "pipeworks_valvebody_ends.png",
+ "pipeworks_valvebody_ends.png",
+ "pipeworks_valvebody_sides.png",
+ "pipeworks_valvebody_sides.png",
+ },
+ paramtype = "light",
+ selection_box = {
+ type = "fixed",
+ fixed = { -5/16, -4/16, -5/16, 6/16, 8/16, 6/16 }
+ },
+ node_box = {
+ type = "fixed",
+ fixed = valveboxes
+ },
+ groups = {snappy=3, pipe=1},
+ sounds = default.node_sound_wood_defaults(),
+ walkable = true,
+ stack_max = 99,
+})
+
+valveboxes = {}
+addbox(valveboxes, leftstub)
+addbox(valveboxes, valvebody)
+addbox(valveboxes, valvehandle_on)
+addbox(valveboxes, rightstub)
+
+minetest.register_node("pipeworks:valve_on", {
+ description = "Valve (on)",
+ drawtype = "nodebox",
+ tiles = {
+ "pipeworks_valvebody_top_on.png",
+ "pipeworks_valvebody_bottom.png",
+ "pipeworks_valvebody_ends.png",
+ "pipeworks_valvebody_ends.png",
+ "pipeworks_valvebody_sides.png",
+ "pipeworks_valvebody_sides.png",
+ },
+ paramtype = "light",
+ selection_box = {
+ type = "fixed",
+ fixed = { -5/16, -4/16, -5/16, 6/16, 8/16, 6/16 }
+ },
+ node_box = {
+ type = "fixed",
+ fixed = valveboxes
+ },
+ groups = {snappy=3, pipe=1},
+ sounds = default.node_sound_wood_defaults(),
+ walkable = true,
+ stack_max = 99,
+})
+
+minetest.register_on_punchnode(function (pos, node)
+ if node.name=="pipeworks:valve_on" then
+ minetest.env:add_node(pos, { name = "pipeworks:valve_off" })
+ end
+end)
+
+minetest.register_on_punchnode(function (pos, node)
+ if node.name=="pipeworks:valve_off" then
+ minetest.env:add_node(pos, { name = "pipeworks:valve_on" })
+ end
+end)
+
+
+minetest.register_on_punchnode(function (pos, node)
+ if node.name=="pipeworks:pump_on" then
+ minetest.env:add_node(pos, { name = "pipeworks:pump_off" })
+ end
+end)
+
+minetest.register_on_punchnode(function (pos, node)
+ if node.name=="pipeworks:pump_off" then
+ minetest.env:add_node(pos, { name = "pipeworks:pump_on" })
+ end
+end)
print("Pipeworks loaded!")
diff --git a/oldpipes.lua b/oldpipes.lua
new file mode 100644
index 0000000..876fc24
--- /dev/null
+++ b/oldpipes.lua
@@ -0,0 +1,353 @@
+-- This file is basically most of the old init.lua and only supplies the
+-- old nodes created by the previous verison of Pipeworks.
+--
+-- License: WTFPL
+--
+
+local nodenames = {
+ "vertical",
+ "horizontal",
+ "junction_xy",
+ "junction_xz",
+ "bend_xy_down",
+ "bend_xy_up",
+ "bend_xz",
+ "crossing_xz",
+ "crossing_xy",
+ "crossing_xyz",
+ "pipe",
+ "cap_neg_x",
+ "cap_pos_x",
+ "cap_neg_y",
+ "cap_pos_y",
+ "cap_neg_z",
+ "cap_pos_z"
+}
+
+local descriptions = {
+ "vertical",
+ "horizontal",
+ "junction between X and Y axes",
+ "junction between X and Z axes",
+ "downward bend between X and Y axes",
+ "upward bend between X and Y axes",
+ "bend between X/Z axes",
+ "4-way crossing between X and Z axes",
+ "4-way crossing between X/Z and Y axes",
+ "6-way crossing",
+ "basic segment",
+ "capped, negative X half only",
+ "capped, positive X half only",
+ "capped, negative Y half only",
+ "capped, positive Y half only",
+ "capped, negative Z half only",
+ "capped, positive Z half only"
+}
+
+local nodeimages = {
+ {"pipeworks_pipe_end.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_plain.png",
+ "pipeworks_plain.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png"},
+
+ {"pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_plain.png",
+ "pipeworks_plain.png"},
+
+ {"pipeworks_pipe_end.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_plain.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png"},
+
+ {"pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_plain.png"},
+
+ {"pipeworks_plain.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_plain.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png"},
+
+ {"pipeworks_pipe_end.png",
+ "pipeworks_plain.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_plain.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png"},
+
+ {"pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_plain.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_plain.png"},
+
+ {"pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_pipe_end.png"},
+
+ {"pipeworks_pipe_end.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png"},
+
+ {"pipeworks_pipe_end.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_pipe_end.png"},
+
+-- horizontal short segment
+
+ {"pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_plain.png",
+ "pipeworks_plain.png"},
+
+-- capped
+
+ {"pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png"},
+
+ {"pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png"},
+
+ {"pipeworks_windowed_XXXXX.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png"},
+
+ {"pipeworks_pipe_end.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png"},
+
+ {"pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_pipe_end.png"},
+
+ {"pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_windowed_XXXXX.png",
+ "pipeworks_pipe_end.png",
+ "pipeworks_windowed_XXXXX.png"},
+}
+
+local selectionboxes = {
+ { -0.15, -0.5, -0.15, 0.15, 0.5, 0.15 },
+ { -0.5, -0.15, -0.15, 0.5, 0.15, 0.15 },
+ { -0.15, -0.5, -0.15, 0.5, 0.5, 0.15 },
+ { -0.5, -0.15, -0.15, 0.5, 0.15, 0.5 },
+ { -0.15, -0.5, -0.15, 0.5, 0.15, 0.15 },
+ { -0.15, -0.15, -0.15, 0.5, 0.5, 0.15 },
+ { -0.15, -0.15, -0.15, 0.5, 0.15, 0.5 },
+ { -0.5, -0.15, -0.5, 0.5, 0.15, 0.5 },
+ { -0.5, -0.5, -0.15, 0.5, 0.5, 0.15 },
+ { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },
+ { -0.3, -0.15, -0.15, 0.3, 0.15, 0.15 },
+ { -0.5, -0.15, -0.15, 0, 0.15, 0.15 },
+ { 0, -0.15, -0.15, 0.5, 0.15, 0.15 },
+ { -0.15, -0.5, -0.15, 0.15, 0, 0.15 },
+ { -0.15, 0, -0.15, 0.15, 0.5, 0.15 },
+ { -0.15, -0.15, -0.5, 0.15, 0.15, 0 },
+ { -0.15, -0.15, 0, 0.15, 0.15, 0.5 },
+}
+
+local nodeboxes = {
+ {{ -0.15, -0.5 , -0.15, 0.15, -0.45, 0.15 }, -- vertical
+ { -0.1 , -0.45, -0.1 , 0.1 , 0.45, 0.1 },
+ { -0.15, 0.45, -0.15, 0.15, 0.5 , 0.15 }},
+
+ {{ -0.5 , -0.15, -0.15, -0.45, 0.15, 0.15 }, -- horizontal
+ { -0.45, -0.1 , -0.1 , 0.45, 0.1 , 0.1 },
+ { 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }},
+
+ {{ -0.15, -0.5 , -0.15, 0.15, -0.45, 0.15 }, -- vertical with X/Z junction
+ { -0.1 , -0.45, -0.1 , 0.1 , 0.45, 0.1 },
+ { -0.15, 0.45, -0.15, 0.15, 0.5 , 0.15 },
+ { 0.1 , -0.1 , -0.1 , 0.45, 0.1 , 0.1 },
+ { 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }},
+
+ {{ -0.15, -0.15, 0.45, 0.15, 0.15, 0.5 }, -- horizontal with X/Z junction
+ { -0.1 , -0.1 , 0.1 , 0.1 , 0.1 , 0.45 },
+ { -0.5 , -0.15, -0.15, -0.45, 0.15, 0.15 },
+ { -0.45, -0.1 , -0.1 , 0.45, 0.1 , 0.1 },
+ { 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }},
+
+ {{ -0.15, -0.5 , -0.15, 0.15, -0.45, 0.15 }, -- bend down from X/Z to Y axis
+ { -0.1 , -0.45, -0.1 , 0.1 , 0.1 , 0.1 },
+ { -0.1 , -0.1 , -0.1 , 0.45, 0.1 , 0.1 },
+ { 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }},
+
+ {{ -0.15, 0.45 , -0.15, 0.15, 0.5, 0.15 }, -- bend up from X/Z to Y axis
+ { -0.1 , -0.1 , -0.1 , 0.1 , 0.45, 0.1 },
+ { -0.1 , -0.1 , -0.1 , 0.45, 0.1 , 0.1 },
+ { 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }},
+
+ {{ -0.15, -0.15, 0.45, 0.15, 0.15, 0.5 }, -- bend between X and Z axes
+ { -0.1 , -0.1 , 0.1 , 0.1 , 0.1 , 0.45 },
+ { -0.1 , -0.1 , -0.1 , 0.45, 0.1 , 0.1 },
+ { 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }},
+
+ {{ -0.5 , -0.15, -0.15, -0.45, 0.15, 0.15 }, -- 4-way crossing between X and Z axes
+ { -0.45, -0.1 , -0.1 , 0.45, 0.1 , 0.1 },
+ { 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 },
+ { -0.15, -0.15, -0.5 , 0.15, 0.15, -0.45 },
+ { -0.1 , -0.1 , -0.45, 0.1 , 0.1 , 0.45 },
+ { -0.15, -0.15, 0.45, 0.15, 0.15, 0.5 }},
+
+ {{ -0.15, -0.5 , -0.15, 0.15, -0.45, 0.15 }, -- 4-way crossing between X/Z and Y axes
+ { -0.1 , -0.45, -0.1 , 0.1 , 0.45, 0.1 },
+ { -0.15, 0.45, -0.15, 0.15, 0.5 , 0.15 },
+ { -0.5 , -0.15, -0.15, -0.45, 0.15, 0.15 },
+ { -0.45, -0.1 , -0.1 , 0.45, 0.1 , 0.1 },
+ { 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }},
+
+ {{ -0.5 , -0.15, -0.15, -0.45, 0.15, 0.15 }, -- 6-way crossing (all 3 axes)
+ { -0.45, -0.1 , -0.1 , 0.45, 0.1 , 0.1 },
+ { 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 },
+ { -0.15, -0.15, -0.5 , 0.15, 0.15, -0.45 },
+ { -0.1 , -0.1 , -0.45, 0.1 , 0.1 , 0.45 },
+ { -0.15, -0.15, 0.45, 0.15, 0.15, 0.5 },
+ { -0.15, -0.5 , -0.15, 0.15, -0.45, 0.15 },
+ { -0.1 , -0.45, -0.1 , 0.1 , 0.45, 0.1 },
+ { -0.15, 0.45, -0.15, 0.15, 0.5 , 0.15 }},
+
+ {{ -0.3 , -0.15, -0.15, -0.25, 0.15, 0.15 }, -- main center segment
+ { -0.25, -0.1 , -0.1 , 0.25, 0.1 , 0.1 },
+ { 0.25, -0.15, -0.15, 0.3 , 0.15, 0.15 }},
+
+ {{ -0.5, -0.15, -0.15, -0.45, 0.15, 0.15 }, -- anchored at -X
+ { -0.45, -0.1, -0.1, -0.2, 0.1, 0.1 },
+ { -0.2, -0.15, -0.15, -0.15, 0.15, 0.15 },
+ { -0.15, -0.12, -0.12, -0.1, 0.12, 0.12 },
+ { -0.1, -0.08, -0.08, -0.05, 0.08, 0.08 },
+ { -0.05, -0.04, -0.04, 0, 0.04, 0.04 }},
+
+ {{ 0.45, -0.15, -0.15, 0.5, 0.15, 0.15 }, -- anchored at +X
+ { 0.2, -0.1, -0.1, 0.45, 0.1, 0.1 },
+ { 0.15, -0.15, -0.15, 0.2, 0.15, 0.15 },
+ { 0.1, -0.12, -0.12, 0.15, 0.12, 0.12 },
+ { 0.05, -0.08, -0.08, 0.1, 0.08, 0.08 },
+ { 0, -0.04, -0.04, 0.05, 0.04, 0.04 }},
+
+ {{ -0.15, -0.5, -0.15, 0.15, -0.45, 0.15 }, -- anchored at -Y
+ { -0.1, -0.45, -0.1, 0.1, -0.2, 0.1 },
+ { -0.15, -0.2, -0.15, 0.15, -0.15, 0.15 },
+ { -0.12, -0.15, -0.12, 0.12, -0.1, 0.12 },
+ { -0.08, -0.1, -0.08, 0.08, -0.05, 0.08 },
+ { -0.04, -0.05, -0.04, 0.04, 0, 0.04 }},
+
+ {{ -0.15, 0.45, -0.15, 0.15, 0.5, 0.15 }, -- anchored at +Y
+ { -0.1, 0.2, -0.1, 0.1, 0.45, 0.1 },
+ { -0.15, 0.15, -0.15, 0.15, 0.2, 0.15 },
+ { -0.12, 0.1, -0.12, 0.12, 0.15, 0.12 },
+ { -0.08, 0.05, -0.08, 0.08, 0.1, 0.08 } ,
+ { -0.04, 0, -0.04, 0.04, 0.05, 0.04 }},
+
+ {{ -0.15, -0.15, -0.5, 0.15, 0.15, -0.45 }, -- anchored at -Z
+ { -0.1, -0.1, -0.45, 0.1, 0.1, -0.2 },
+ { -0.15, -0.15, -0.2, 0.15, 0.15, -0.15 },
+ { -0.12, -0.12, -0.15, 0.12, 0.12, -0.1 },
+ { -0.08, -0.08, -0.1, 0.08, 0.08, -0.05 },
+ { -0.04, -0.04, -0.05, 0.04, 0.04, 0 }},
+
+ {{ -0.15, -0.15, 0.45, 0.15, 0.15, 0.5 }, -- anchored at +Z
+ { -0.1, -0.1, 0.2, 0.1, 0.1, 0.45 },
+ { -0.15, -0.15, 0.15, 0.15, 0.15, 0.2 },
+ { -0.12, -0.12, 0.1, 0.12, 0.12, 0.15 },
+ { -0.08, -0.08, 0.05, 0.08, 0.08, 0.1 },
+ { -0.04, -0.04, 0, 0.04, 0.04, 0.05 }},
+}
+
+function fix_image_names(node, replacement)
+ outtable={}
+ for i in ipairs(nodeimages[node]) do
+ outtable[i]=string.gsub(nodeimages[node][i], "_XXXXX", replacement)
+ end
+
+ return outtable
+end
+
+-- Now define the actual nodes
+
+for node in ipairs(nodenames) do
+ minetest.register_node("pipeworks:"..nodenames[node], {
+ description = "Empty Pipe ("..descriptions[node]..")",
+ drawtype = "nodebox",
+ tiles = fix_image_names(node, "_empty"),
+ paramtype = "light",
+ paramtype2 = "facedir",
+ selection_box = {
+ type = "fixed",
+ fixed = selectionboxes[node],
+ },
+ node_box = {
+ type = "fixed",
+ fixed = nodeboxes[node]
+ },
+ groups = {snappy=3, pipe=1},
+ sounds = default.node_sound_wood_defaults(),
+ walkable = true,
+ stack_max = 99,
+ drop = "pipeworks:pipe"
+ })
+
+ minetest.register_node("pipeworks:"..nodenames[node].."_loaded", {
+ description = "Loaded Pipe ("..descriptions[node]..")",
+ drawtype = "nodebox",
+ tiles = fix_image_names(node, "_loaded"),
+ paramtype = "light",
+ paramtype2 = "facedir",
+ selection_box = {
+ type = "fixed",
+ fixed = selectionboxes[node],
+ },
+ node_box = {
+ type = "fixed",
+ fixed = nodeboxes[node]
+ },
+ groups = {snappy=3, pipe=1},
+ sounds = default.node_sound_wood_defaults(),
+ walkable = true,
+ stack_max = 99,
+ drop = "pipeworks:pipe"
+ })
+end
+
diff --git a/textures/pipeworks_pipe_end.png b/textures/pipeworks_pipe_end.png
index 61ec0a1..cb0e4b9 100644
--- a/textures/pipeworks_pipe_end.png
+++ b/textures/pipeworks_pipe_end.png
Binary files differ
diff --git a/textures/pipeworks_plain.png b/textures/pipeworks_plain.png
index 0c5753b..3bd1b6a 100644
--- a/textures/pipeworks_plain.png
+++ b/textures/pipeworks_plain.png
Binary files differ
diff --git a/textures/pipeworks_pump_ends.png b/textures/pipeworks_pump_ends.png
new file mode 100644
index 0000000..a76aea1
--- /dev/null
+++ b/textures/pipeworks_pump_ends.png
Binary files differ
diff --git a/textures/pipeworks_pump_off.png b/textures/pipeworks_pump_off.png
new file mode 100644
index 0000000..4705a9a
--- /dev/null
+++ b/textures/pipeworks_pump_off.png
Binary files differ
diff --git a/textures/pipeworks_pump_on.png b/textures/pipeworks_pump_on.png
new file mode 100644
index 0000000..4f35b08
--- /dev/null
+++ b/textures/pipeworks_pump_on.png
Binary files differ
diff --git a/textures/pipeworks_pump_sides.png b/textures/pipeworks_pump_sides.png
new file mode 100644
index 0000000..14129f7
--- /dev/null
+++ b/textures/pipeworks_pump_sides.png
Binary files differ
diff --git a/textures/pipeworks_valvebody_bottom.png b/textures/pipeworks_valvebody_bottom.png
new file mode 100644
index 0000000..05f20e3
--- /dev/null
+++ b/textures/pipeworks_valvebody_bottom.png
Binary files differ
diff --git a/textures/pipeworks_valvebody_ends.png b/textures/pipeworks_valvebody_ends.png
new file mode 100644
index 0000000..2bc3ecb
--- /dev/null
+++ b/textures/pipeworks_valvebody_ends.png
Binary files differ
diff --git a/textures/pipeworks_valvebody_sides.png b/textures/pipeworks_valvebody_sides.png
new file mode 100644
index 0000000..989cbbc
--- /dev/null
+++ b/textures/pipeworks_valvebody_sides.png
Binary files differ
diff --git a/textures/pipeworks_valvebody_top_off.png b/textures/pipeworks_valvebody_top_off.png
new file mode 100644
index 0000000..4ecd7fc
--- /dev/null
+++ b/textures/pipeworks_valvebody_top_off.png
Binary files differ
diff --git a/textures/pipeworks_valvebody_top_on.png b/textures/pipeworks_valvebody_top_on.png
new file mode 100644
index 0000000..e36eb94
--- /dev/null
+++ b/textures/pipeworks_valvebody_top_on.png
Binary files differ
diff --git a/textures/pipeworks_windowed_empty.png b/textures/pipeworks_windowed_empty.png
index c0f8e04..ebd4486 100644
--- a/textures/pipeworks_windowed_empty.png
+++ b/textures/pipeworks_windowed_empty.png
Binary files differ
diff --git a/textures/pipeworks_windowed_loaded.png b/textures/pipeworks_windowed_loaded.png
index e6ceb2a..91c4829 100644
--- a/textures/pipeworks_windowed_loaded.png
+++ b/textures/pipeworks_windowed_loaded.png
Binary files differ