local-ize a few more variables, move all of the nodebox models
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>
Sun, 15 Dec 2013 09:35:59 +0000 (04:35 -0500)
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>
Sun, 15 Dec 2013 09:35:59 +0000 (04:35 -0500)
into their own file and confine them and pretty much everything
else to the pipeworks.{} table (still global though).  More to
come.

autoplace_tubes.lua
devices.lua
init.lua
models.lua [new file with mode: 0644]
pipes.lua
teleport_tube.lua
tubes.lua

index 72d1835ecbdf3333d751fea55976e35095413537..cbca2ba26f2b1c3a1b810abf3debb52b0de8b1db 100644 (file)
@@ -120,18 +120,18 @@ function tube_autoroute(pos)
 
     -- all sides checked, now figure which tube to use.
 
-    nsurround = ""
-    for i,n in ipairs(active) do
-        nsurround = nsurround .. n
-    end
-    local newname=string.sub(nctr.name,1,-7)..nsurround
-    if newname == nctr.name then return end
-    local meta=minetest.get_meta(pos)
-    local meta0=meta:to_table() -- XXX: hacky_swap_node
-    nctr.name = newname
-    minetest.add_node(pos, nctr)
-    local meta=minetest.get_meta(pos)
-    meta:from_table(meta0)
+       local nsurround = ""
+       for i,n in ipairs(active) do
+               nsurround = nsurround .. n
+       end
+       local newname=string.sub(nctr.name,1,-7)..nsurround
+       if newname == nctr.name then return end
+       local meta=minetest.get_meta(pos)
+       local meta0=meta:to_table() -- XXX: hacky_swap_node
+       nctr.name = newname
+       minetest.add_node(pos, nctr)
+       local meta=minetest.get_meta(pos)
+       meta:from_table(meta0)
        local nctr = minetest.get_node(pos)
 end
 
index ed0ed4745c344a8ffb89be478e1ce91a1d2ed8b0..ffe56a92187637e56f9df6ff6c84601d35d2d9b4 100644 (file)
@@ -35,75 +35,11 @@ local pipes_devicelist = {
        "storage_tank_10"
 }
 
--- tables
-
-local pipe_pumpbody = {
-       { -7/16, -6/16, -7/16, 7/16,  5/16, 7/16 },
-       { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }
-}
-
-local pipe_valvebody = {
-       { -4/16, -4/16, -4/16, 4/16, 4/16, 4/16 }
-}
-
-local pipe_valvehandle_on = {
-       { -5/16, 4/16, -1/16, 0, 5/16, 1/16 }
-}
-
-local pipe_valvehandle_off = {
-       { -1/16, 4/16, -5/16, 1/16, 5/16, 0 }
-}
-
-local pipe_sensorbody = {
-       { -3/16, -2/16, -2/16, 3/16, 2/16, 2/16 }
-}
-
-local spigot_bottomstub = {
-       { -2/64, -16/64, -6/64,   2/64, 1/64, 6/64 },   -- pipe segment against -Y face
-       { -4/64, -16/64, -5/64,   4/64, 1/64, 5/64 },
-       { -5/64, -16/64, -4/64,   5/64, 1/64, 4/64 },
-       { -6/64, -16/64, -2/64,   6/64, 1/64, 2/64 },
-
-       { -3/64, -16/64, -8/64, 3/64, -14/64, 8/64 },   -- (the flange for it)
-       { -5/64, -16/64, -7/64, 5/64, -14/64, 7/64 },
-       { -6/64, -16/64, -6/64, 6/64, -14/64, 6/64 },
-       { -7/64, -16/64, -5/64, 7/64, -14/64, 5/64 },
-       { -8/64, -16/64, -3/64, 8/64, -14/64, 3/64 }
-}
-
-local spigot_stream = { 
-       { -3/64, (-41/64)-0.01, -5/64, 3/64, -16/64, 5/64 },
-       { -4/64, (-41/64)-0.01, -4/64, 4/64, -16/64, 4/64 },
-       { -5/64, (-41/64)-0.01, -3/64, 5/64, -16/64, 3/64 }
-}
-
-local entry_panel = {
-       { -8/16, -8/16, -1/16, 8/16, 8/16, 1/16 }
-}
-
-local fountainhead_model = {
-       { -2/64, -32/64, -6/64,   2/64, 21/64, 6/64 },  -- main segment
-       { -4/64, -32/64, -5/64,   4/64, 21/64, 5/64 },
-       { -5/64, -32/64, -4/64,   5/64, 21/64, 4/64 },
-       { -6/64, -32/64, -2/64,   6/64, 21/64, 2/64 },
-
-       { -3/64, -32/64, -8/64, 3/64, -30/64, 8/64 },   -- bottom flange
-       { -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 },
-
-       { -3/64, 20/64, -8/64, 3/64, 32/64, 8/64 },     -- top flange/outlet
-       { -5/64, 20/64, -7/64, 5/64, 32/64, 7/64 },
-       { -6/64, 20/64, -6/64, 6/64, 32/64, 6/64 },
-       { -7/64, 20/64, -5/64, 7/64, 32/64, 5/64 },
-       { -8/64, 20/64, -3/64, 8/64, 32/64, 3/64 }
-}
-
 -- Now define the nodes.
 
 local states = { "on", "off" }
 local dgroups = ""
+local pumpboxes = {}
 
 for s in ipairs(states) do
 
@@ -113,9 +49,10 @@ for s in ipairs(states) do
                dgroups = {snappy=3, pipe=1, not_in_creative_inventory=1}
        end
 
-       local pumpboxes = {}
-       pipeworks.add_pipebox(pumpboxes, pipe_pumpbody)
-       pipeworks.add_pipebox(pumpboxes, pipe_topstub)
+       pumpboxes = {}
+
+       pipeworks.add_node_box(pumpboxes, pipeworks.pipe_pumpbody)
+       pipeworks.add_node_box(pumpboxes, pipeworks.pipe_topstub)
 
        minetest.register_node("pipeworks:pump_"..states[s], {
                description = "Pump/Intake Module",
@@ -163,14 +100,14 @@ for s in ipairs(states) do
        })
        
        local valveboxes = {}
-       pipeworks.add_pipebox(valveboxes, pipe_leftstub)
-       pipeworks.add_pipebox(valveboxes, pipe_valvebody)
+       pipeworks.add_node_box(valveboxes, pipeworks.pipe_leftstub)
+       pipeworks.add_node_box(valveboxes, pipeworks.pipe_valvebody)
        if states[s] == "off" then 
-               pipeworks.add_pipebox(valveboxes, pipe_valvehandle_off)
+               pipeworks.add_node_box(valveboxes, pipeworks.pipe_valvehandle_off)
        else
-               pipeworks.add_pipebox(valveboxes, pipe_valvehandle_on)
+               pipeworks.add_node_box(valveboxes, pipeworks.pipe_valvehandle_on)
        end
-       pipeworks.add_pipebox(valveboxes, pipe_rightstub)
+       pipeworks.add_node_box(valveboxes, pipeworks.pipe_rightstub)
        local tilex = "pipeworks_valvebody_ends.png"
        local tilez = "pipeworks_valvebody_sides.png"
 
@@ -222,10 +159,10 @@ for s in ipairs(states) do
 end
 
 local valveboxes = {}
-pipeworks.add_pipebox(valveboxes, pipe_leftstub)
-pipeworks.add_pipebox(valveboxes, pipe_valvebody)
-pipeworks.add_pipebox(valveboxes, pipe_rightstub)
-pipeworks.add_pipebox(valveboxes, pipe_valvehandle_on)
+pipeworks.add_node_box(valveboxes, pipeworks.pipe_leftstub)
+pipeworks.add_node_box(valveboxes, pipeworks.pipe_valvebody)
+pipeworks.add_node_box(valveboxes, pipeworks.pipe_rightstub)
+pipeworks.add_node_box(valveboxes, pipeworks.pipe_valvehandle_on)
 
 minetest.register_node("pipeworks:valve_on_loaded", {
        description = "Valve",
@@ -301,15 +238,15 @@ minetest.register_node("pipeworks:grating", {
 -- outlet spigot
 
        local spigotboxes = {}
-       pipeworks.add_pipebox(spigotboxes, pipe_backstub)
-       pipeworks.add_pipebox(spigotboxes, spigot_bottomstub)
-       pipeworks.add_pipebox(spigotboxes, pipe_bendsphere)
+       pipeworks.add_node_box(spigotboxes, pipeworks.pipe_backstub)
+       pipeworks.add_node_box(spigotboxes, pipeworks.spigot_bottomstub)
+       pipeworks.add_node_box(spigotboxes, pipeworks.pipe_bendsphere)
 
        local spigotboxes_pouring = {}
-       pipeworks.add_pipebox(spigotboxes_pouring, spigot_stream)
-       pipeworks.add_pipebox(spigotboxes_pouring, pipe_backstub)
-       pipeworks.add_pipebox(spigotboxes_pouring, spigot_bottomstub)
-       pipeworks.add_pipebox(spigotboxes_pouring, pipe_bendsphere)
+       pipeworks.add_node_box(spigotboxes_pouring, pipeworks.spigot_stream)
+       pipeworks.add_node_box(spigotboxes_pouring, pipeworks.pipe_backstub)
+       pipeworks.add_node_box(spigotboxes_pouring, pipeworks.spigot_bottomstub)
+       pipeworks.add_node_box(spigotboxes_pouring, pipeworks.pipe_bendsphere)
 
 minetest.register_node("pipeworks:spigot", {
        description = "Spigot outlet",
@@ -410,9 +347,9 @@ minetest.register_node("pipeworks:spigot_pouring", {
 -- wall, for use in places where walls should look like they're airtight)
 
 local airtightboxes = {}
-pipeworks.add_pipebox(airtightboxes, pipe_frontstub)
-pipeworks.add_pipebox(airtightboxes, pipe_backstub)
-pipeworks.add_pipebox(airtightboxes, entry_panel)
+pipeworks.add_node_box(airtightboxes, pipeworks.pipe_frontstub)
+pipeworks.add_node_box(airtightboxes, pipeworks.pipe_backstub)
+pipeworks.add_node_box(airtightboxes, pipeworks.entry_panel)
 
 minetest.register_node("pipeworks:entry_panel_empty", {
        description = "Airtight Pipe entry/exit",
@@ -537,9 +474,9 @@ minetest.register_node("pipeworks:entry_panel_loaded", {
 })
 
 local sensorboxes = {}
-pipeworks.add_pipebox(sensorboxes, pipe_leftstub)
-pipeworks.add_pipebox(sensorboxes, pipe_sensorbody)
-pipeworks.add_pipebox(sensorboxes, pipe_rightstub)
+pipeworks.add_node_box(sensorboxes, pipeworks.pipe_leftstub)
+pipeworks.add_node_box(sensorboxes, pipeworks.pipe_sensorbody)
+pipeworks.add_node_box(sensorboxes, pipeworks.pipe_rightstub)
 
 minetest.register_node("pipeworks:flow_sensor_empty", {
        description = "Flow Sensor",
@@ -645,7 +582,7 @@ for fill = 0, 10 do
                        "pipeworks_storage_tank_back.png",
                        "pipeworks_storage_tank_back.png",
                        "pipeworks_storage_tank_back.png",
-                       pipeworks_liquid_texture.."^pipeworks_storage_tank_front_"..fill..".png"
+                       pipeworks.liquid_texture.."^pipeworks_storage_tank_front_"..fill..".png"
                },
                inventory_image = image,
                paramtype = "light",
@@ -671,7 +608,7 @@ for fill = 0, 10 do
                        "pipeworks_storage_tank_back.png",
                        "pipeworks_storage_tank_back.png",
                        "pipeworks_storage_tank_back.png",
-                       pipeworks_liquid_texture.."^pipeworks_storage_tank_front_"..fill..".png"
+                       pipeworks.liquid_texture.."^pipeworks_storage_tank_front_"..fill..".png"
                },
                inventory_image = image,
                paramtype = "light",
@@ -717,7 +654,7 @@ minetest.register_node("pipeworks:fountainhead", {
        end,
        node_box = {
                type = "fixed",
-               fixed = fountainhead_model ,
+               fixed = pipeworks.fountainhead_model ,
        },
        selection_box = {
                type = "fixed",
@@ -751,7 +688,7 @@ minetest.register_node("pipeworks:fountainhead_pouring", {
        end,
        node_box = {
                type = "fixed",
-               fixed = fountainhead_model,
+               fixed = pipeworks.fountainhead_model,
        },
        selection_box = {
                type = "fixed",
index f11ee39429cdc825c69bdcacc7518e4ca1e517c9..5798d617453cd4993163185607709b0d267b53a5 100644 (file)
--- a/init.lua
+++ b/init.lua
@@ -36,6 +36,8 @@ else
        dofile(pipeworks.worldpath.."/pipeworks_settings.txt")
 end
 
+-- Random variables
+
 pipeworks.expect_infinite_stacks = true
 if minetest.get_modpath("unified_inventory") or not minetest.setting_getbool("creative_mode") then
        pipeworks_expect_infinite_stacks = false
@@ -43,6 +45,8 @@ end
 
 pipeworks.meseadjlist={{x=0,y=0,z=1},{x=0,y=0,z=-1},{x=0,y=1,z=0},{x=0,y=-1,z=0},{x=1,y=0,z=0},{x=-1,y=0,z=0}}
 
+pipeworks.liquid_texture = "default_water.png"
+
 -- Helper functions
 
 function pipeworks.fix_image_names(table, replacement)
@@ -54,7 +58,7 @@ function pipeworks.fix_image_names(table, replacement)
        return outtable
 end
 
-function pipeworks.add_pipebox(t, b)
+function pipeworks.add_node_box(t, b)
        for i in ipairs(b)
                do table.insert(t, b[i])
        end
@@ -107,14 +111,15 @@ function pipeworks.replace_name(tbl,tr,name)
        return ntbl
 end
 
--- Load the various parts of the mod
+-------------------------------------------
+-- Load the various other parts of the mod
 
+dofile(pipeworks.modpath.."/models.lua")
 dofile(pipeworks.modpath.."/autoplace_pipes.lua")
 dofile(pipeworks.modpath.."/autoplace_tubes.lua")
 dofile(pipeworks.modpath.."/item_transport.lua")
 dofile(pipeworks.modpath.."/flowing_logic.lua")
 dofile(pipeworks.modpath.."/crafts.lua")
-
 dofile(pipeworks.modpath.."/tubes.lua")
 
 local rules_all = {{x=0, y=0, z=1},{x=0, y=0, z=-1},{x=1, y=0, z=0},{x=-1, y=0, z=0},
diff --git a/models.lua b/models.lua
new file mode 100644 (file)
index 0000000..f8ca219
--- /dev/null
@@ -0,0 +1,198 @@
+---------------------
+-- The various models
+
+-- Pipe models
+
+pipeworks.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 }
+}
+
+pipeworks.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 }
+}
+
+pipeworks.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 }
+}
+
+pipeworks.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 }
+}
+
+pipeworks.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 }
+}
+
+pipeworks.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 }
+} 
+
+pipeworks.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 }
+}
+
+pipeworks.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 }
+}
+
+-- Tube models
+
+pipeworks.tube_leftstub = {
+       { -32/64, -9/64, -9/64, 9/64, 9/64, 9/64 },     -- tube segment against -X face
+}
+
+pipeworks.tube_rightstub = {
+       { -9/64, -9/64, -9/64,  32/64, 9/64, 9/64 },    -- tube segment against +X face
+}
+
+pipeworks.tube_bottomstub = {
+       { -9/64, -32/64, -9/64,   9/64, 9/64, 9/64 },   -- tube segment against -Y face
+}
+
+pipeworks.tube_topstub = {
+       { -9/64, -9/64, -9/64,   9/64, 32/64, 9/64 },   -- tube segment against +Y face
+}
+
+pipeworks.tube_frontstub = {
+       { -9/64, -9/64, -32/64,   9/64, 9/64, 9/64 },   -- tube segment against -Z face
+}
+
+pipeworks.tube_backstub = {
+       { -9/64, -9/64, -9/64,   9/64, 9/64, 32/64 },   -- tube segment against -Z face
+} 
+
+pipeworks.tube_selectboxes = {
+       { -32/64,  -10/64,  -10/64,  10/64,  10/64,  10/64 },
+       { -10/64 ,  -10/64,  -10/64, 32/64,  10/64,  10/64 },
+       { -10/64 , -32/64,  -10/64,  10/64,  10/64,  10/64 },
+       { -10/64 ,  -10/64,  -10/64,  10/64, 32/64,  10/64 },
+       { -10/64 ,  -10/64, -32/64,  10/64,  10/64,  10/64 },
+       { -10/64 ,  -10/64,  -10/64,  10/64,  10/64, 32/64 }
+}
+
+-- Device models
+
+pipeworks.pipe_pumpbody = {
+       { -7/16, -6/16, -7/16, 7/16,  5/16, 7/16 },
+       { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }
+}
+
+pipeworks.pipe_valvebody = {
+       { -4/16, -4/16, -4/16, 4/16, 4/16, 4/16 }
+}
+
+pipeworks.pipe_valvehandle_on = {
+       { -5/16, 4/16, -1/16, 0, 5/16, 1/16 }
+}
+
+pipeworks.pipe_valvehandle_off = {
+       { -1/16, 4/16, -5/16, 1/16, 5/16, 0 }
+}
+
+pipeworks.pipe_sensorbody = {
+       { -3/16, -2/16, -2/16, 3/16, 2/16, 2/16 }
+}
+
+pipeworks.spigot_bottomstub = {
+       { -2/64, -16/64, -6/64,   2/64, 1/64, 6/64 },   -- pipe segment against -Y face
+       { -4/64, -16/64, -5/64,   4/64, 1/64, 5/64 },
+       { -5/64, -16/64, -4/64,   5/64, 1/64, 4/64 },
+       { -6/64, -16/64, -2/64,   6/64, 1/64, 2/64 },
+
+       { -3/64, -16/64, -8/64, 3/64, -14/64, 8/64 },   -- (the flange for it)
+       { -5/64, -16/64, -7/64, 5/64, -14/64, 7/64 },
+       { -6/64, -16/64, -6/64, 6/64, -14/64, 6/64 },
+       { -7/64, -16/64, -5/64, 7/64, -14/64, 5/64 },
+       { -8/64, -16/64, -3/64, 8/64, -14/64, 3/64 }
+}
+
+pipeworks.spigot_stream = { 
+       { -3/64, (-41/64)-0.01, -5/64, 3/64, -16/64, 5/64 },
+       { -4/64, (-41/64)-0.01, -4/64, 4/64, -16/64, 4/64 },
+       { -5/64, (-41/64)-0.01, -3/64, 5/64, -16/64, 3/64 }
+}
+
+pipeworks.entry_panel = {
+       { -8/16, -8/16, -1/16, 8/16, 8/16, 1/16 }
+}
+
+pipeworks.fountainhead_model = {
+       { -2/64, -32/64, -6/64,   2/64, 21/64, 6/64 },  -- main segment
+       { -4/64, -32/64, -5/64,   4/64, 21/64, 5/64 },
+       { -5/64, -32/64, -4/64,   5/64, 21/64, 4/64 },
+       { -6/64, -32/64, -2/64,   6/64, 21/64, 2/64 },
+
+       { -3/64, -32/64, -8/64, 3/64, -30/64, 8/64 },   -- bottom flange
+       { -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 },
+
+       { -3/64, 20/64, -8/64, 3/64, 32/64, 8/64 },     -- top flange/outlet
+       { -5/64, 20/64, -7/64, 5/64, 32/64, 7/64 },
+       { -6/64, 20/64, -6/64, 6/64, 32/64, 6/64 },
+       { -7/64, 20/64, -5/64, 7/64, 32/64, 5/64 },
+       { -8/64, 20/64, -3/64, 8/64, 32/64, 3/64 }
+}
index ed1c23810f5eae8ab60b83ee4e10330619c61fa6..25ced059e965f8d5ed36ea0805deb9f904b0b7aa 100644 (file)
--- a/pipes.lua
+++ b/pipes.lua
-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
index d3736901c0a6b9f14b9cc922aacab35d15aa1e7e..a67daed546ad87a966c36b49f953952cdd509764 100644 (file)
@@ -67,7 +67,7 @@ local teleport_end_textures={"pipeworks_teleport_tube_end.png","pipeworks_telepo
 local teleport_short_texture="pipeworks_teleport_tube_short.png"
 local teleport_inv_texture="pipeworks_teleport_tube_inv.png"
 
-register_tube("pipeworks:teleport_tube","Teleporter pneumatic tube segment",teleport_plain_textures,
+pipeworks.register_tube("pipeworks:teleport_tube","Teleporter pneumatic tube segment",teleport_plain_textures,
                teleport_noctr_textures,teleport_end_textures,teleport_short_texture,teleport_inv_texture,
                {tube={can_go=function(pos,node,velocity,stack)
                        velocity.x=0
index 7bf7af300f4da06d033449afcb92b7b7c4bb0c4e..3eafb8087237d4d3d16c40ae3e3b0ccd77189f56 100644 (file)
--- a/tubes.lua
+++ b/tubes.lua
 -- This file supplies the various kinds of pneumatic tubes
-
+print(dump(tube_backstub))
 tubenodes={}
 
--- tables
-
 minetest.register_alias("pipeworks:tube", "pipeworks:tube_000000")
 
-local tube_leftstub = {
-       { -32/64, -9/64, -9/64, 9/64, 9/64, 9/64 },     -- tube segment against -X face
-}
-
-local tube_rightstub = {
-       { -9/64, -9/64, -9/64,  32/64, 9/64, 9/64 },    -- tube segment against +X face
-}
-
-local tube_bottomstub = {
-       { -9/64, -32/64, -9/64,   9/64, 9/64, 9/64 },   -- tube segment against -Y face
-}
-
-
-local tube_topstub = {
-       { -9/64, -9/64, -9/64,   9/64, 32/64, 9/64 },   -- tube segment against +Y face
-}
-
-local tube_frontstub = {
-       { -9/64, -9/64, -32/64,   9/64, 9/64, 9/64 },   -- tube segment against -Z face
-}
-
-local tube_backstub = {
-       { -9/64, -9/64, -9/64,   9/64, 9/64, 32/64 },   -- tube segment against -Z face
-} 
-
-local tube_selectboxes = {
-       { -32/64,  -10/64,  -10/64,  10/64,  10/64,  10/64 },
-       { -10/64 ,  -10/64,  -10/64, 32/64,  10/64,  10/64 },
-       { -10/64 , -32/64,  -10/64,  10/64,  10/64,  10/64 },
-       { -10/64 ,  -10/64,  -10/64,  10/64, 32/64,  10/64 },
-       { -10/64 ,  -10/64, -32/64,  10/64,  10/64,  10/64 },
-       { -10/64 ,  -10/64,  -10/64,  10/64,  10/64, 32/64 }
-}
+-- now, a function to define the tubes
 
---  Functions
+local outboxes = {}
+local outsel = {}
+local outimgs = {}
 
-local function tube_addbox(t, b)
-       for i in ipairs(b)
-               do table.insert(t, b[i])
-       end
-end
+pipeworks.register_tube = function(name, desc, plain, noctrs, ends, short, inv, special)
 
--- now, a function to define the tubes
-
-register_tube = function(name, desc, plain, noctrs, ends, short, inv, special)
 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
-       local outboxes = {}
-       local outsel = {}
-       local outimgs = {}
+
+       outboxes = {}
+       outsel = {}
+       outimgs = {}
 
        if yp==1 then
-               tube_addbox(outboxes, tube_topstub)
-               table.insert(outsel, tube_selectboxes[4])
+               pipeworks.add_node_box(outboxes, pipeworks.tube_topstub)
+               table.insert(outsel, pipeworks.tube_selectboxes[4])
                table.insert(outimgs, noctrs[4])
        else
                table.insert(outimgs, plain[4])
        end
        if ym==1 then
-               tube_addbox(outboxes, tube_bottomstub)
-               table.insert(outsel, tube_selectboxes[3])
+               pipeworks.add_node_box(outboxes, pipeworks.tube_bottomstub)
+               table.insert(outsel, pipeworks.tube_selectboxes[3])
                table.insert(outimgs, noctrs[3])
        else
                table.insert(outimgs, plain[3])
        end
        if xp==1 then
-               tube_addbox(outboxes, tube_rightstub)
-               table.insert(outsel, tube_selectboxes[2])
+               pipeworks.add_node_box(outboxes, pipeworks.tube_rightstub)
+               table.insert(outsel, pipeworks.tube_selectboxes[2])
                table.insert(outimgs, noctrs[2])
        else
                table.insert(outimgs, plain[2])
        end
        if xm==1 then
-               tube_addbox(outboxes, tube_leftstub)
-               table.insert(outsel, tube_selectboxes[1])
+               pipeworks.add_node_box(outboxes, pipeworks.tube_leftstub)
+               table.insert(outsel, pipeworks.tube_selectboxes[1])
                table.insert(outimgs, noctrs[1])
        else
                table.insert(outimgs, plain[1])
        end
        if zp==1 then
-               tube_addbox(outboxes, tube_backstub)
-               table.insert(outsel, tube_selectboxes[6])
+               pipeworks.add_node_box(outboxes, pipeworks.tube_backstub)
+               table.insert(outsel, pipeworks.tube_selectboxes[6])
                table.insert(outimgs, noctrs[6])
        else
                table.insert(outimgs, plain[6])
        end
        if zm==1 then
-               tube_addbox(outboxes, tube_frontstub)
-               table.insert(outsel, tube_selectboxes[5])
+               pipeworks.add_node_box(outboxes, pipeworks.tube_frontstub)
+               table.insert(outsel, pipeworks.tube_selectboxes[5])
                table.insert(outimgs, noctrs[5])
        else
                table.insert(outimgs, plain[5])
@@ -249,7 +211,7 @@ local end_textures={"pipeworks_tube_end.png","pipeworks_tube_end.png","pipeworks
 local short_texture="pipeworks_tube_short.png"
 local inv_texture="pipeworks_tube_inv.png"
 
-register_tube("pipeworks:tube","Pneumatic tube segment",plain_textures,noctr_textures,end_textures,short_texture,inv_texture)
+pipeworks.register_tube("pipeworks:tube","Pneumatic tube segment",plain_textures,noctr_textures,end_textures,short_texture,inv_texture)
 
 
 local mese_noctr_textures={"pipeworks_mese_tube_noctr_1.png","pipeworks_mese_tube_noctr_2.png","pipeworks_mese_tube_noctr_3.png",
@@ -262,7 +224,7 @@ local mese_short_texture="pipeworks_mese_tube_short.png"
 local mese_inv_texture="pipeworks_mese_tube_inv.png"
 
 if enable_mese_tube then
-       register_tube("pipeworks:mese_tube","Mese pneumatic tube segment",mese_plain_textures,mese_noctr_textures,
+       pipeworks.register_tube("pipeworks:mese_tube","Mese pneumatic tube segment",mese_plain_textures,mese_noctr_textures,
                mese_end_textures,mese_short_texture,mese_inv_texture,
                {tube={can_go=function(pos,node,velocity,stack)
                        tbl={}
@@ -371,7 +333,7 @@ if enable_detector_tube then
                        "pipeworks_detector_tube_plain.png","pipeworks_detector_tube_plain.png","pipeworks_detector_tube_plain.png"}
        local detector_inv_texture="pipeworks_detector_tube_inv.png"
 
-       register_tube("pipeworks:detector_tube_on","Detector tube segment on (you hacker you)",detector_plain_textures,noctr_textures,
+       pipeworks.register_tube("pipeworks:detector_tube_on","Detector tube segment on (you hacker you)",detector_plain_textures,noctr_textures,
                end_textures,short_texture,detector_inv_texture,
                {tube={can_go=function(pos,node,velocity,stack)
                        local meta = minetest.get_meta(pos)
@@ -403,7 +365,7 @@ if enable_detector_tube then
                        minetest.after(0.1,minetest.registered_nodes[name].item_exit,pos)
                end})
 
-       register_tube("pipeworks:detector_tube_off","Detector tube segment",detector_plain_textures,noctr_textures,
+       pipeworks.register_tube("pipeworks:detector_tube_off","Detector tube segment",detector_plain_textures,noctr_textures,
                end_textures,short_texture,detector_inv_texture,
                {tube={can_go=function(pos,node,velocity,stack)
                        local name = minetest.get_node(pos).name
@@ -434,7 +396,7 @@ local conductor_on_end_textures={"pipeworks_conductor_tube_on_end.png","pipework
                "pipeworks_conductor_tube_on_end.png","pipeworks_conductor_tube_on_end.png","pipeworks_conductor_tube_on_end.png"}
 
 if enable_conductor_tube then
-       register_tube("pipeworks:conductor_tube_off","Conductor tube segment",conductor_plain_textures,conductor_noctr_textures,
+       pipeworks.register_tube("pipeworks:conductor_tube_off","Conductor tube segment",conductor_plain_textures,conductor_noctr_textures,
                conductor_end_textures,conductor_short_texture,conductor_inv_texture,
                {groups={mesecon=2},
                mesecons={conductor={state="off",
@@ -442,7 +404,7 @@ if enable_conductor_tube then
                                        onstate="pipeworks:conductor_tube_on_#id"}}
        })
 
-       register_tube("pipeworks:conductor_tube_on","Conductor tube segment on (you hacker you)",conductor_on_plain_textures,conductor_on_noctr_textures,
+       pipeworks.register_tube("pipeworks:conductor_tube_on","Conductor tube segment on (you hacker you)",conductor_on_plain_textures,conductor_on_noctr_textures,
                conductor_on_end_textures,conductor_short_texture,conductor_inv_texture,
                {groups={mesecon=2,not_in_creative_inventory=1},
                drop="pipeworks:conductor_tube_off_000000",
@@ -462,7 +424,7 @@ local accelerator_short_texture="pipeworks_accelerator_tube_short.png"
 local accelerator_inv_texture="pipeworks_accelerator_tube_inv.png"
 
 if enable_accelerator_tube then
-       register_tube("pipeworks:accelerator_tube","Accelerator pneumatic tube segment",accelerator_plain_textures,
+       pipeworks.register_tube("pipeworks:accelerator_tube","Accelerator pneumatic tube segment",accelerator_plain_textures,
                        accelerator_noctr_textures,accelerator_end_textures,accelerator_short_texture,accelerator_inv_texture,
                        {tube={can_go=function(pos,node,velocity,stack)
                                velocity.speed=velocity.speed+1
@@ -472,7 +434,7 @@ if enable_accelerator_tube then
 end
 
 if enable_crossing_tube then
-       register_tube("pipeworks:crossing_tube","Crossing tube segment",accelerator_plain_textures,
+       pipeworks.register_tube("pipeworks:crossing_tube","Crossing tube segment",accelerator_plain_textures,
                        accelerator_noctr_textures,accelerator_end_textures,accelerator_short_texture,accelerator_inv_texture,
                        {tube={can_go=function(pos,node,velocity,stack)
                                return {velocity}
@@ -490,7 +452,7 @@ local sand_short_texture="pipeworks_sand_tube_short.png"
 local sand_inv_texture="pipeworks_sand_tube_inv.png"
 
 if enable_sand_tube then
-       register_tube("pipeworks:sand_tube","Sand pneumatic tube segment",sand_plain_textures,sand_noctr_textures,sand_end_textures,
+       pipeworks.register_tube("pipeworks:sand_tube","Sand pneumatic tube segment",sand_plain_textures,sand_noctr_textures,sand_end_textures,
                        sand_short_texture,sand_inv_texture,
                        {groups={sand_tube=1}})
 
@@ -522,7 +484,7 @@ local mese_sand_short_texture="pipeworks_mese_sand_tube_short.png"
 local mese_sand_inv_texture="pipeworks_mese_sand_tube_inv.png"
 
 if enable_mese_sand_tube then
-       register_tube("pipeworks:mese_sand_tube","Mese sand pneumatic tube segment",mese_sand_plain_textures,mese_sand_noctr_textures,mese_sand_end_textures,
+       pipeworks.register_tube("pipeworks:mese_sand_tube","Mese sand pneumatic tube segment",mese_sand_plain_textures,mese_sand_noctr_textures,mese_sand_end_textures,
                        mese_sand_short_texture,mese_sand_inv_texture,
                        {groups={mese_sand_tube=1},
                on_construct = function(pos)