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.
This commit is contained in:
Vanessa Ezekowitz 2013-12-15 04:35:59 -05:00
parent bd80f18cfc
commit 659b4e42b2
7 changed files with 310 additions and 301 deletions

View File

@ -120,7 +120,7 @@ function tube_autoroute(pos)
-- all sides checked, now figure which tube to use. -- all sides checked, now figure which tube to use.
nsurround = "" local nsurround = ""
for i,n in ipairs(active) do for i,n in ipairs(active) do
nsurround = nsurround .. n nsurround = nsurround .. n
end end

View File

@ -35,75 +35,11 @@ local pipes_devicelist = {
"storage_tank_10" "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. -- Now define the nodes.
local states = { "on", "off" } local states = { "on", "off" }
local dgroups = "" local dgroups = ""
local pumpboxes = {}
for s in ipairs(states) do 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} dgroups = {snappy=3, pipe=1, not_in_creative_inventory=1}
end end
local pumpboxes = {} pumpboxes = {}
pipeworks.add_pipebox(pumpboxes, pipe_pumpbody)
pipeworks.add_pipebox(pumpboxes, pipe_topstub) pipeworks.add_node_box(pumpboxes, pipeworks.pipe_pumpbody)
pipeworks.add_node_box(pumpboxes, pipeworks.pipe_topstub)
minetest.register_node("pipeworks:pump_"..states[s], { minetest.register_node("pipeworks:pump_"..states[s], {
description = "Pump/Intake Module", description = "Pump/Intake Module",
@ -163,14 +100,14 @@ for s in ipairs(states) do
}) })
local valveboxes = {} local valveboxes = {}
pipeworks.add_pipebox(valveboxes, pipe_leftstub) pipeworks.add_node_box(valveboxes, pipeworks.pipe_leftstub)
pipeworks.add_pipebox(valveboxes, pipe_valvebody) pipeworks.add_node_box(valveboxes, pipeworks.pipe_valvebody)
if states[s] == "off" then if states[s] == "off" then
pipeworks.add_pipebox(valveboxes, pipe_valvehandle_off) pipeworks.add_node_box(valveboxes, pipeworks.pipe_valvehandle_off)
else else
pipeworks.add_pipebox(valveboxes, pipe_valvehandle_on) pipeworks.add_node_box(valveboxes, pipeworks.pipe_valvehandle_on)
end end
pipeworks.add_pipebox(valveboxes, pipe_rightstub) pipeworks.add_node_box(valveboxes, pipeworks.pipe_rightstub)
local tilex = "pipeworks_valvebody_ends.png" local tilex = "pipeworks_valvebody_ends.png"
local tilez = "pipeworks_valvebody_sides.png" local tilez = "pipeworks_valvebody_sides.png"
@ -222,10 +159,10 @@ for s in ipairs(states) do
end end
local valveboxes = {} local valveboxes = {}
pipeworks.add_pipebox(valveboxes, pipe_leftstub) pipeworks.add_node_box(valveboxes, pipeworks.pipe_leftstub)
pipeworks.add_pipebox(valveboxes, pipe_valvebody) pipeworks.add_node_box(valveboxes, pipeworks.pipe_valvebody)
pipeworks.add_pipebox(valveboxes, pipe_rightstub) pipeworks.add_node_box(valveboxes, pipeworks.pipe_rightstub)
pipeworks.add_pipebox(valveboxes, pipe_valvehandle_on) pipeworks.add_node_box(valveboxes, pipeworks.pipe_valvehandle_on)
minetest.register_node("pipeworks:valve_on_loaded", { minetest.register_node("pipeworks:valve_on_loaded", {
description = "Valve", description = "Valve",
@ -301,15 +238,15 @@ minetest.register_node("pipeworks:grating", {
-- outlet spigot -- outlet spigot
local spigotboxes = {} local spigotboxes = {}
pipeworks.add_pipebox(spigotboxes, pipe_backstub) pipeworks.add_node_box(spigotboxes, pipeworks.pipe_backstub)
pipeworks.add_pipebox(spigotboxes, spigot_bottomstub) pipeworks.add_node_box(spigotboxes, pipeworks.spigot_bottomstub)
pipeworks.add_pipebox(spigotboxes, pipe_bendsphere) pipeworks.add_node_box(spigotboxes, pipeworks.pipe_bendsphere)
local spigotboxes_pouring = {} local spigotboxes_pouring = {}
pipeworks.add_pipebox(spigotboxes_pouring, spigot_stream) pipeworks.add_node_box(spigotboxes_pouring, pipeworks.spigot_stream)
pipeworks.add_pipebox(spigotboxes_pouring, pipe_backstub) pipeworks.add_node_box(spigotboxes_pouring, pipeworks.pipe_backstub)
pipeworks.add_pipebox(spigotboxes_pouring, spigot_bottomstub) pipeworks.add_node_box(spigotboxes_pouring, pipeworks.spigot_bottomstub)
pipeworks.add_pipebox(spigotboxes_pouring, pipe_bendsphere) pipeworks.add_node_box(spigotboxes_pouring, pipeworks.pipe_bendsphere)
minetest.register_node("pipeworks:spigot", { minetest.register_node("pipeworks:spigot", {
description = "Spigot outlet", 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) -- wall, for use in places where walls should look like they're airtight)
local airtightboxes = {} local airtightboxes = {}
pipeworks.add_pipebox(airtightboxes, pipe_frontstub) pipeworks.add_node_box(airtightboxes, pipeworks.pipe_frontstub)
pipeworks.add_pipebox(airtightboxes, pipe_backstub) pipeworks.add_node_box(airtightboxes, pipeworks.pipe_backstub)
pipeworks.add_pipebox(airtightboxes, entry_panel) pipeworks.add_node_box(airtightboxes, pipeworks.entry_panel)
minetest.register_node("pipeworks:entry_panel_empty", { minetest.register_node("pipeworks:entry_panel_empty", {
description = "Airtight Pipe entry/exit", description = "Airtight Pipe entry/exit",
@ -537,9 +474,9 @@ minetest.register_node("pipeworks:entry_panel_loaded", {
}) })
local sensorboxes = {} local sensorboxes = {}
pipeworks.add_pipebox(sensorboxes, pipe_leftstub) pipeworks.add_node_box(sensorboxes, pipeworks.pipe_leftstub)
pipeworks.add_pipebox(sensorboxes, pipe_sensorbody) pipeworks.add_node_box(sensorboxes, pipeworks.pipe_sensorbody)
pipeworks.add_pipebox(sensorboxes, pipe_rightstub) pipeworks.add_node_box(sensorboxes, pipeworks.pipe_rightstub)
minetest.register_node("pipeworks:flow_sensor_empty", { minetest.register_node("pipeworks:flow_sensor_empty", {
description = "Flow Sensor", 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_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, inventory_image = image,
paramtype = "light", 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_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, inventory_image = image,
paramtype = "light", paramtype = "light",
@ -717,7 +654,7 @@ minetest.register_node("pipeworks:fountainhead", {
end, end,
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = fountainhead_model , fixed = pipeworks.fountainhead_model ,
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
@ -751,7 +688,7 @@ minetest.register_node("pipeworks:fountainhead_pouring", {
end, end,
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = fountainhead_model, fixed = pipeworks.fountainhead_model,
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",

View File

@ -36,6 +36,8 @@ else
dofile(pipeworks.worldpath.."/pipeworks_settings.txt") dofile(pipeworks.worldpath.."/pipeworks_settings.txt")
end end
-- Random variables
pipeworks.expect_infinite_stacks = true pipeworks.expect_infinite_stacks = true
if minetest.get_modpath("unified_inventory") or not minetest.setting_getbool("creative_mode") then if minetest.get_modpath("unified_inventory") or not minetest.setting_getbool("creative_mode") then
pipeworks_expect_infinite_stacks = false 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.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 -- Helper functions
function pipeworks.fix_image_names(table, replacement) function pipeworks.fix_image_names(table, replacement)
@ -54,7 +58,7 @@ function pipeworks.fix_image_names(table, replacement)
return outtable return outtable
end end
function pipeworks.add_pipebox(t, b) function pipeworks.add_node_box(t, b)
for i in ipairs(b) for i in ipairs(b)
do table.insert(t, b[i]) do table.insert(t, b[i])
end end
@ -107,14 +111,15 @@ function pipeworks.replace_name(tbl,tr,name)
return ntbl return ntbl
end 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_pipes.lua")
dofile(pipeworks.modpath.."/autoplace_tubes.lua") dofile(pipeworks.modpath.."/autoplace_tubes.lua")
dofile(pipeworks.modpath.."/item_transport.lua") dofile(pipeworks.modpath.."/item_transport.lua")
dofile(pipeworks.modpath.."/flowing_logic.lua") dofile(pipeworks.modpath.."/flowing_logic.lua")
dofile(pipeworks.modpath.."/crafts.lua") dofile(pipeworks.modpath.."/crafts.lua")
dofile(pipeworks.modpath.."/tubes.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}, 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},

198
models.lua Normal file
View File

@ -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 }
}

147
pipes.lua
View File

@ -1,104 +1,10 @@
pipeworks_liquid_texture = "default_water.png" -- This file supplies the steel pipes
pipe_leftstub = { local pipes_empty_nodenames = {}
{ -32/64, -2/64, -6/64, 1/64, 2/64, 6/64 }, -- pipe segment against -X face local pipes_full_nodenames = {}
{ -32/64, -4/64, -5/64, 1/64, 4/64, 5/64 }, local outboxes = {}
{ -32/64, -5/64, -4/64, 1/64, 5/64, 4/64 }, local outsel = {}
{ -32/64, -6/64, -2/64, 1/64, 6/64, 2/64 }, local outimgs = {}
{ -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 = {}
for xm = 0, 1 do for xm = 0, 1 do
for xp = 0, 1 do for xp = 0, 1 do
@ -106,48 +12,49 @@ for ym = 0, 1 do
for yp = 0, 1 do for yp = 0, 1 do
for zm = 0, 1 do for zm = 0, 1 do
for zp = 0, 1 do for zp = 0, 1 do
local outboxes = {}
local outsel = {} outboxes = {}
local outimgs = {} outsel = {}
outimgs = {}
if yp==1 then if yp==1 then
pipeworks.add_pipebox(outboxes, pipe_topstub) pipeworks.add_node_box(outboxes, pipeworks.pipe_topstub)
table.insert(outsel, pipe_selectboxes[4]) table.insert(outsel, pipeworks.pipe_selectboxes[4])
table.insert(outimgs, "pipeworks_pipe_end.png") table.insert(outimgs, "pipeworks_pipe_end.png")
else else
table.insert(outimgs, "pipeworks_plain.png") table.insert(outimgs, "pipeworks_plain.png")
end end
if ym==1 then if ym==1 then
pipeworks.add_pipebox(outboxes, pipe_bottomstub) pipeworks.add_node_box(outboxes, pipeworks.pipe_bottomstub)
table.insert(outsel, pipe_selectboxes[3]) table.insert(outsel, pipeworks.pipe_selectboxes[3])
table.insert(outimgs, "pipeworks_pipe_end.png") table.insert(outimgs, "pipeworks_pipe_end.png")
else else
table.insert(outimgs, "pipeworks_plain.png") table.insert(outimgs, "pipeworks_plain.png")
end end
if xp==1 then if xp==1 then
pipeworks.add_pipebox(outboxes, pipe_rightstub) pipeworks.add_node_box(outboxes, pipeworks.pipe_rightstub)
table.insert(outsel, pipe_selectboxes[2]) table.insert(outsel, pipeworks.pipe_selectboxes[2])
table.insert(outimgs, "pipeworks_pipe_end.png") table.insert(outimgs, "pipeworks_pipe_end.png")
else else
table.insert(outimgs, "pipeworks_plain.png") table.insert(outimgs, "pipeworks_plain.png")
end end
if xm==1 then if xm==1 then
pipeworks.add_pipebox(outboxes, pipe_leftstub) pipeworks.add_node_box(outboxes, pipeworks.pipe_leftstub)
table.insert(outsel, pipe_selectboxes[1]) table.insert(outsel, pipeworks.pipe_selectboxes[1])
table.insert(outimgs, "pipeworks_pipe_end.png") table.insert(outimgs, "pipeworks_pipe_end.png")
else else
table.insert(outimgs, "pipeworks_plain.png") table.insert(outimgs, "pipeworks_plain.png")
end end
if zp==1 then if zp==1 then
pipeworks.add_pipebox(outboxes, pipe_backstub) pipeworks.add_node_box(outboxes, pipeworks.pipe_backstub)
table.insert(outsel, pipe_selectboxes[6]) table.insert(outsel, pipeworks.pipe_selectboxes[6])
table.insert(outimgs, "pipeworks_pipe_end.png") table.insert(outimgs, "pipeworks_pipe_end.png")
else else
table.insert(outimgs, "pipeworks_plain.png") table.insert(outimgs, "pipeworks_plain.png")
end end
if zm==1 then if zm==1 then
pipeworks.add_pipebox(outboxes, pipe_frontstub) pipeworks.add_node_box(outboxes, pipeworks.pipe_frontstub)
table.insert(outsel, pipe_selectboxes[5]) table.insert(outsel, pipeworks.pipe_selectboxes[5])
table.insert(outimgs, "pipeworks_pipe_end.png") table.insert(outimgs, "pipeworks_pipe_end.png")
else else
table.insert(outimgs, "pipeworks_plain.png") table.insert(outimgs, "pipeworks_plain.png")
@ -185,21 +92,21 @@ for zp = 0, 1 do
end end
if jx+jy+jz >= 2 then if jx+jy+jz >= 2 then
pipeworks.add_pipebox(outboxes, pipe_bendsphere) pipeworks.add_node_box(outboxes, pipeworks.pipe_bendsphere)
end end
if (jx==2 and jy~=2 and jz~=2) then if (jx==2 and jy~=2 and jz~=2) then
table.remove(outimgs, 5) table.remove(outimgs, 5)
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 end
if (jx~=2 and jy~=2 and jz==2) or (jx~=2 and jy==2 and jz~=2) then 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.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 end
local pname = xm..xp..ym..yp..zm..zp local pname = xm..xp..ym..yp..zm..zp

View 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_short_texture="pipeworks_teleport_tube_short.png"
local teleport_inv_texture="pipeworks_teleport_tube_inv.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, teleport_noctr_textures,teleport_end_textures,teleport_short_texture,teleport_inv_texture,
{tube={can_go=function(pos,node,velocity,stack) {tube={can_go=function(pos,node,velocity,stack)
velocity.x=0 velocity.x=0

104
tubes.lua
View File

@ -1,104 +1,66 @@
-- This file supplies the various kinds of pneumatic tubes -- This file supplies the various kinds of pneumatic tubes
print(dump(tube_backstub))
tubenodes={} tubenodes={}
-- tables
minetest.register_alias("pipeworks:tube", "pipeworks:tube_000000") 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 }
}
-- Functions
local function tube_addbox(t, b)
for i in ipairs(b)
do table.insert(t, b[i])
end
end
-- now, a function to define the tubes -- now, a function to define the tubes
register_tube = function(name, desc, plain, noctrs, ends, short, inv, special) local outboxes = {}
local outsel = {}
local outimgs = {}
pipeworks.register_tube = function(name, desc, plain, noctrs, ends, short, inv, special)
for xm = 0, 1 do for xm = 0, 1 do
for xp = 0, 1 do for xp = 0, 1 do
for ym = 0, 1 do for ym = 0, 1 do
for yp = 0, 1 do for yp = 0, 1 do
for zm = 0, 1 do for zm = 0, 1 do
for zp = 0, 1 do for zp = 0, 1 do
local outboxes = {}
local outsel = {} outboxes = {}
local outimgs = {} outsel = {}
outimgs = {}
if yp==1 then if yp==1 then
tube_addbox(outboxes, tube_topstub) pipeworks.add_node_box(outboxes, pipeworks.tube_topstub)
table.insert(outsel, tube_selectboxes[4]) table.insert(outsel, pipeworks.tube_selectboxes[4])
table.insert(outimgs, noctrs[4]) table.insert(outimgs, noctrs[4])
else else
table.insert(outimgs, plain[4]) table.insert(outimgs, plain[4])
end end
if ym==1 then if ym==1 then
tube_addbox(outboxes, tube_bottomstub) pipeworks.add_node_box(outboxes, pipeworks.tube_bottomstub)
table.insert(outsel, tube_selectboxes[3]) table.insert(outsel, pipeworks.tube_selectboxes[3])
table.insert(outimgs, noctrs[3]) table.insert(outimgs, noctrs[3])
else else
table.insert(outimgs, plain[3]) table.insert(outimgs, plain[3])
end end
if xp==1 then if xp==1 then
tube_addbox(outboxes, tube_rightstub) pipeworks.add_node_box(outboxes, pipeworks.tube_rightstub)
table.insert(outsel, tube_selectboxes[2]) table.insert(outsel, pipeworks.tube_selectboxes[2])
table.insert(outimgs, noctrs[2]) table.insert(outimgs, noctrs[2])
else else
table.insert(outimgs, plain[2]) table.insert(outimgs, plain[2])
end end
if xm==1 then if xm==1 then
tube_addbox(outboxes, tube_leftstub) pipeworks.add_node_box(outboxes, pipeworks.tube_leftstub)
table.insert(outsel, tube_selectboxes[1]) table.insert(outsel, pipeworks.tube_selectboxes[1])
table.insert(outimgs, noctrs[1]) table.insert(outimgs, noctrs[1])
else else
table.insert(outimgs, plain[1]) table.insert(outimgs, plain[1])
end end
if zp==1 then if zp==1 then
tube_addbox(outboxes, tube_backstub) pipeworks.add_node_box(outboxes, pipeworks.tube_backstub)
table.insert(outsel, tube_selectboxes[6]) table.insert(outsel, pipeworks.tube_selectboxes[6])
table.insert(outimgs, noctrs[6]) table.insert(outimgs, noctrs[6])
else else
table.insert(outimgs, plain[6]) table.insert(outimgs, plain[6])
end end
if zm==1 then if zm==1 then
tube_addbox(outboxes, tube_frontstub) pipeworks.add_node_box(outboxes, pipeworks.tube_frontstub)
table.insert(outsel, tube_selectboxes[5]) table.insert(outsel, pipeworks.tube_selectboxes[5])
table.insert(outimgs, noctrs[5]) table.insert(outimgs, noctrs[5])
else else
table.insert(outimgs, plain[5]) 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 short_texture="pipeworks_tube_short.png"
local inv_texture="pipeworks_tube_inv.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", 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" local mese_inv_texture="pipeworks_mese_tube_inv.png"
if enable_mese_tube then 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, mese_end_textures,mese_short_texture,mese_inv_texture,
{tube={can_go=function(pos,node,velocity,stack) {tube={can_go=function(pos,node,velocity,stack)
tbl={} 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"} "pipeworks_detector_tube_plain.png","pipeworks_detector_tube_plain.png","pipeworks_detector_tube_plain.png"}
local detector_inv_texture="pipeworks_detector_tube_inv.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, end_textures,short_texture,detector_inv_texture,
{tube={can_go=function(pos,node,velocity,stack) {tube={can_go=function(pos,node,velocity,stack)
local meta = minetest.get_meta(pos) 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) minetest.after(0.1,minetest.registered_nodes[name].item_exit,pos)
end}) 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, end_textures,short_texture,detector_inv_texture,
{tube={can_go=function(pos,node,velocity,stack) {tube={can_go=function(pos,node,velocity,stack)
local name = minetest.get_node(pos).name 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"} "pipeworks_conductor_tube_on_end.png","pipeworks_conductor_tube_on_end.png","pipeworks_conductor_tube_on_end.png"}
if enable_conductor_tube then 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, conductor_end_textures,conductor_short_texture,conductor_inv_texture,
{groups={mesecon=2}, {groups={mesecon=2},
mesecons={conductor={state="off", mesecons={conductor={state="off",
@ -442,7 +404,7 @@ if enable_conductor_tube then
onstate="pipeworks:conductor_tube_on_#id"}} 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, conductor_on_end_textures,conductor_short_texture,conductor_inv_texture,
{groups={mesecon=2,not_in_creative_inventory=1}, {groups={mesecon=2,not_in_creative_inventory=1},
drop="pipeworks:conductor_tube_off_000000", 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" local accelerator_inv_texture="pipeworks_accelerator_tube_inv.png"
if enable_accelerator_tube then 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, accelerator_noctr_textures,accelerator_end_textures,accelerator_short_texture,accelerator_inv_texture,
{tube={can_go=function(pos,node,velocity,stack) {tube={can_go=function(pos,node,velocity,stack)
velocity.speed=velocity.speed+1 velocity.speed=velocity.speed+1
@ -472,7 +434,7 @@ if enable_accelerator_tube then
end end
if enable_crossing_tube then 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, accelerator_noctr_textures,accelerator_end_textures,accelerator_short_texture,accelerator_inv_texture,
{tube={can_go=function(pos,node,velocity,stack) {tube={can_go=function(pos,node,velocity,stack)
return {velocity} return {velocity}
@ -490,7 +452,7 @@ local sand_short_texture="pipeworks_sand_tube_short.png"
local sand_inv_texture="pipeworks_sand_tube_inv.png" local sand_inv_texture="pipeworks_sand_tube_inv.png"
if enable_sand_tube then 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, sand_short_texture,sand_inv_texture,
{groups={sand_tube=1}}) {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" local mese_sand_inv_texture="pipeworks_mese_sand_tube_inv.png"
if enable_mese_sand_tube then 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, mese_sand_short_texture,mese_sand_inv_texture,
{groups={mese_sand_tube=1}, {groups={mese_sand_tube=1},
on_construct = function(pos) on_construct = function(pos)