summaryrefslogtreecommitdiff
path: root/pipes.lua
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2015-01-15 06:25:41 -0500
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2015-01-15 06:25:41 -0500
commit50359104c7e1a304360a5c9e7e53a416954fcea7 (patch)
treed6328e998b690c3c59069c2848bcf39abcadc185 /pipes.lua
parente0039f22f8dfbd9fc3f476ced9ddd8a37e70ea68 (diff)
downloadpipeworks-50359104c7e1a304360a5c9e7e53a416954fcea7.tar
pipeworks-50359104c7e1a304360a5c9e7e53a416954fcea7.tar.gz
pipeworks-50359104c7e1a304360a5c9e7e53a416954fcea7.tar.bz2
pipeworks-50359104c7e1a304360a5c9e7e53a416954fcea7.tar.xz
pipeworks-50359104c7e1a304360a5c9e7e53a416954fcea7.zip
Use mesh nodes for all nodebox-based pipe-related nodes
Diffstat (limited to 'pipes.lua')
-rw-r--r--pipes.lua56
1 files changed, 26 insertions, 30 deletions
diff --git a/pipes.lua b/pipes.lua
index ad79a3e..2056fdf 100644
--- a/pipes.lua
+++ b/pipes.lua
@@ -8,13 +8,7 @@ local pipes_full_nodenames = {}
local vti = {4, 3, 2, 1, 6, 5}
local cconnects = {{}, {1}, {1, 2}, {1, 3}, {1, 3, 5}, {1, 2, 3}, {1, 2, 3, 5}, {1, 2, 3, 4}, {1, 2, 3, 4, 5}, {1, 2, 3, 4, 5, 6}}
for index, connects in ipairs(cconnects) do
- local outboxes = {}
local outsel = {}
- local outimgs = {}
-
- for i = 1, 6 do
- outimgs[vti[i]] = "pipeworks_plain.png"
- end
local jx = 0
local jy = 0
@@ -27,24 +21,12 @@ for index, connects in ipairs(cconnects) do
else
jz = jz + 1
end
- pipeworks.add_node_box(outboxes, pipeworks.pipe_boxes[v])
table.insert(outsel, pipeworks.pipe_selectboxes[v])
- outimgs[vti[v]] = "pipeworks_pipe_end.png"
end
if #connects == 1 then
local v = connects[1]
v = v-1 + 2*(v%2) -- Opposite side
- outimgs[vti[v]] = "^pipeworks_plain.png"
- end
-
- if #connects >= 2 then
- pipeworks.add_node_box(outboxes, pipeworks.pipe_bendsphere)
- end
-
- if jx == 2 and jy ~= 2 and jz ~= 2 then
- outimgs[5] = pipeworks.liquid_texture.."^pipeworks_windowed_XXXXX.png"
- outimgs[6] = outimgs[5]
end
local pgroups = {snappy = 3, pipe = 1, not_in_creative_inventory = 1}
@@ -57,24 +39,37 @@ for index, connects in ipairs(cconnects) do
image = "pipeworks_pipe_inv.png"
end
- --table.insert(pipeworks.tubenodes, name.."_"..tname)
-
+ local outimg_e = { "pipeworks_pipe_plain.png" }
+ local outimg_l = { "pipeworks_pipe_plain.png" }
+
+ if index == 3 then
+ outimg_e = { "pipeworks_pipe_3_empty.png" }
+ outimg_l = { "pipeworks_pipe_3_loaded.png" }
+ end
+
+ local mesh = "pipeworks_pipe_"..index..".obj"
+
+ if index == 1 then
+ mesh = "pipeworks_pipe_3.obj"
+ end
+
minetest.register_node("pipeworks:pipe_"..index.."_empty", {
description = pipedesc,
- drawtype = "nodebox",
- tiles = pipeworks.fix_image_names(outimgs, "_empty"),
+ drawtype = "mesh",
+ mesh = mesh,
+ tiles = outimg_e,
sunlight_propagates = true,
inventory_image = image,
wield_image = image,
paramtype = "light",
paramtype2 = "facedir",
selection_box = {
- type = "fixed",
+ type = "fixed",
fixed = outsel
},
- node_box = {
+ collision_box = {
type = "fixed",
- fixed = outboxes
+ fixed = outsel
},
groups = pgroups,
sounds = default.node_sound_wood_defaults(),
@@ -92,18 +87,19 @@ for index, connects in ipairs(cconnects) do
minetest.register_node("pipeworks:pipe_"..index.."_loaded", {
description = pipedesc,
- drawtype = "nodebox",
- tiles = pipeworks.fix_image_names(outimgs, "_loaded"),
+ drawtype = "mesh",
+ mesh = mesh,
+ tiles = outimg_l,
sunlight_propagates = true,
paramtype = "light",
paramtype2 = "facedir",
selection_box = {
- type = "fixed",
+ type = "fixed",
fixed = outsel
},
- node_box = {
+ collision_box = {
type = "fixed",
- fixed = outboxes
+ fixed = outsel
},
groups = pgroups,
sounds = default.node_sound_wood_defaults(),