This commit is contained in:
RealBadAngel 2012-12-13 02:17:29 +01:00
parent b8d77627a4
commit 7efa3ff73f
56 changed files with 0 additions and 1723 deletions

@ -1 +0,0 @@
*~

@ -1,34 +0,0 @@
This simple mod uses nodeboxes to supply a complete set of 3D flanged pipes,
along with "valve" and "pump" devices.
Unlike the previous version of this mod, these pipes are rounded, and when
placed, they'll automatically join together as needed. Pipes can go vertically
or horizontally, and there are enough nodes defined to allow for all possible
connections. Valves and pumps can only be placed horizontally, and will
automatically rotate and join with neighboring pipes as objects are added, as
well as joining with each other under certain circumstances.
Pipes come in two variants: one type bears one or more dark windows on each
pipe, suggesting they're empty, while the other type bears green-tinted
windows, as if full (the two colors should also be easy to select if you want
to change them in a paint program). These windows only appear on straight
lengths and on certain junctions.
There are no crafting recipes, yet, but you can use /giveme as usual, namely
"/giveme pipeworks:pipe 999" or so, and then place them as needed. See
init.lua for more details.
This mod is intended to be used as a basis or at least as sort of a model for
something else to build on (perhaps a nicer-looking oil mod?), and does not
provide any of the code necessary to cause anything to flow through them. Like
the pipes, the valve and pump don't do anything useful yet, but you can punch
them to turn them "on" and "off". Note that the valve and pump textures and
shapes are not yet complete (hence their boxy appearance).
This mod is a work in progress.
Please note that owing to the nature of this mod, I have opted to use 64px
textures. Anything less just looks terrible.
If you don't need the old node names from the previous version of this mod,
edit init.lua and comment-out the 'dofile' line at the top.

@ -1,176 +0,0 @@
-- autorouting for pipes
function pipe_scanforobjects(pos)
pipe_autoroute({ x=pos.x-1, y=pos.y , z=pos.z }, "_loaded")
pipe_autoroute({ x=pos.x+1, y=pos.y , z=pos.z }, "_loaded")
pipe_autoroute({ x=pos.x , y=pos.y-1, z=pos.z }, "_loaded")
pipe_autoroute({ x=pos.x , y=pos.y+1, z=pos.z }, "_loaded")
pipe_autoroute({ x=pos.x , y=pos.y , z=pos.z-1 }, "_loaded")
pipe_autoroute({ x=pos.x , y=pos.y , z=pos.z+1 }, "_loaded")
pipe_autoroute(pos, "_loaded")
pipe_autoroute({ x=pos.x-1, y=pos.y , z=pos.z }, "_empty")
pipe_autoroute({ x=pos.x+1, y=pos.y , z=pos.z }, "_empty")
pipe_autoroute({ x=pos.x , y=pos.y-1, z=pos.z }, "_empty")
pipe_autoroute({ x=pos.x , y=pos.y+1, z=pos.z }, "_empty")
pipe_autoroute({ x=pos.x , y=pos.y , z=pos.z-1 }, "_empty")
pipe_autoroute({ x=pos.x , y=pos.y , z=pos.z+1 }, "_empty")
pipe_autoroute(pos, "_empty")
end
function pipe_autoroute(pos, state)
nctr = minetest.env:get_node(pos)
if (string.find(nctr.name, "pipeworks:pipe_") == nil) then return end
pipes_scansurroundings(pos)
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
-- autorouting for pneumatic tubes
function tube_scanforobjects(pos)
tube_autoroute({ x=pos.x-1, y=pos.y , z=pos.z })
tube_autoroute({ x=pos.x+1, y=pos.y , z=pos.z })
tube_autoroute({ x=pos.x , y=pos.y-1, z=pos.z })
tube_autoroute({ x=pos.x , y=pos.y+1, z=pos.z })
tube_autoroute({ x=pos.x , y=pos.y , z=pos.z-1 })
tube_autoroute({ x=pos.x , y=pos.y , z=pos.z+1 })
tube_autoroute(pos)
end
function tube_autoroute(pos)
nctr = minetest.env:get_node(pos)
print ("minetest.get_item_group("..nctr.name..',"tubedevice") == '..minetest.get_item_group(nctr.name, "tubedevice"))
if (string.find(nctr.name, "pipeworks:tube_") == nil)
and minetest.get_item_group(nctr.name, "tubedevice") ~= 1 then return end
pxm=0
pxp=0
pym=0
pyp=0
pzm=0
pzp=0
nxm = minetest.env:get_node({ x=pos.x-1, y=pos.y , z=pos.z })
nxp = minetest.env:get_node({ x=pos.x+1, y=pos.y , z=pos.z })
nym = minetest.env:get_node({ x=pos.x , y=pos.y-1, z=pos.z })
nyp = minetest.env:get_node({ x=pos.x , y=pos.y+1, z=pos.z })
nzm = minetest.env:get_node({ x=pos.x , y=pos.y , z=pos.z-1 })
nzp = minetest.env:get_node({ x=pos.x , y=pos.y , z=pos.z+1 })
if (string.find(nxm.name, "pipeworks:tube_") ~= nil)
or minetest.get_item_group(nxm.name, "tubedevice") == 1 then pxm=1 end
if (string.find(nxp.name, "pipeworks:tube_") ~= nil)
or minetest.get_item_group(nxp.name, "tubedevice") == 1 then pxp=1 end
if (string.find(nym.name, "pipeworks:tube_") ~= nil)
or minetest.get_item_group(nym.name, "tubedevice") == 1 then pym=1 end
if (string.find(nyp.name, "pipeworks:tube_") ~= nil)
or minetest.get_item_group(nyp.name, "tubedevice") == 1 then pyp=1 end
if (string.find(nzm.name, "pipeworks:tube_") ~= nil)
or minetest.get_item_group(nzm.name, "tubedevice") == 1 then pzm=1 end
if (string.find(nzp.name, "pipeworks:tube_") ~= nil)
or minetest.get_item_group(nzp.name, "tubedevice") == 1 then pzp=1 end
nsurround = pxm..pxp..pym..pyp..pzm..pzp
if minetest.get_item_group(nctr.name, "tubedevice") ~= 1 then
minetest.env:add_node(pos, { name = "pipeworks:tube_"..nsurround })
end
end
-- auto-rotation code for various devices the tubes attach to
function pipe_device_autorotate(pos, state, bname)
if state == nil then
nname = bname
else
nname = bname.."_"..state
end
local nctr = minetest.env:get_node(pos)
pipes_scansurroundings(pos)
if (pxm+pxp) ~= 0 then
minetest.env:add_node(pos, { name = nname.."_x" })
return
end
if (pzm+pzp) ~= 0 then
minetest.env:add_node(pos, { name = nname.."_z" })
end
end
function pipes_scansurroundings(pos)
pxm=0
pxp=0
pym=0
pyp=0
pzm=0
pzp=0
nxm = minetest.env:get_node({ x=pos.x-1, y=pos.y , z=pos.z })
nxp = minetest.env:get_node({ x=pos.x+1, y=pos.y , z=pos.z })
nym = minetest.env:get_node({ x=pos.x , y=pos.y-1, z=pos.z })
nyp = minetest.env:get_node({ x=pos.x , y=pos.y+1, z=pos.z })
nzm = minetest.env:get_node({ x=pos.x , y=pos.y , z=pos.z-1 })
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
for p in ipairs(pipes_devicelist) do
pdev = pipes_devicelist[p]
if (string.find(nxm.name, "pipeworks:"..pdev.."_off_x") ~= nil) or
(string.find(nxm.name, "pipeworks:"..pdev.."_on_x") ~= nil) or
(string.find(nxm.name, "pipeworks:"..pdev.."_x") ~= nil) then
pxm=1
end
if (string.find(nxp.name, "pipeworks:"..pdev.."_off_x") ~= nil) or
(string.find(nxp.name, "pipeworks:"..pdev.."_on_x") ~= nil) or
(string.find(nxp.name, "pipeworks:"..pdev.."_x") ~= nil) then
pxp=1
end
if (string.find(nzm.name, "pipeworks:"..pdev.."_off_z") ~= nil) or
(string.find(nzm.name, "pipeworks:"..pdev.."_on_z") ~= nil) or
(string.find(nzm.name, "pipeworks:"..pdev.."_z") ~= nil) then
pzm=1
end
if (string.find(nzp.name, "pipeworks:"..pdev.."_off_z") ~= nil) or
(string.find(nzp.name, "pipeworks:"..pdev.."_on_z") ~= nil) or
(string.find(nzp.name, "pipeworks:"..pdev.."_z") ~= nil) then
pzp=1
end
end
-- storage tanks and intake grates have vertical connections
-- also, so they require a special case
if (string.find(nym.name, "pipeworks:storage_tank_") ~= nil) or
(string.find(nym.name, "pipeworks:intake") ~= nil) or
(string.find(nym.name, "pipeworks:outlet") ~= nil) then
pym=1
end
end
function pipe_look_for_stackable_tanks(pos)
tym = minetest.env:get_node({ x=pos.x , y=pos.y-1, z=pos.z })
if string.find(tym.name, "pipeworks:storage_tank_") ~= nil or
string.find(tym.name, "pipeworks:expansion_tank_") ~= nil then
minetest.env:add_node(pos, { name = "pipeworks:expansion_tank_0"})
end
end

@ -1,46 +0,0 @@
Changelog
---------
2012-08-24: Added square-ish pneumatic tubes, with their own autoplace code
(they do not connect to the steel pipes or their related devices).
2012-08-22: Added outlet grate, made it participate in autoplace algorithm.
Extended storage tank to show fill level in 10% steps (0% to 100%). Added
"expansion tank" that appears if the user stacks tanks upwards. (Downwards is
not checked).
2012-08-21: Made storage tank participate in autoplace algorithm. Tuned API a
little to allow for more flexible placement. Re-organized code a bit to allow
for some upcoming rules changes. Made storage tanks' upper/lower fittins and
intake grate participate in autoplace algorithm.
2012-08-20: Added temporary nodes for storage tank and intake grating, but
without autoplace.
2012-08-19: Pumps and valves now fully participate in the
auto-rotate/auto-place algorithm.
2012-08-18: 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.
2012-08-06: Moved this changelog off the forum post and into a separate file.
2012-08-05 (multiple updates): Rewrote pipeworks to use loops and tables to
create the nodes. Requires far less code now. Added -X, +X, -Y, +Y, -Z, +Z
capped stubs and a short centered horizontal segment. Changed node definitions
so that the aforementioned "short centered" segment is given on dig/drop.
Renamed it to just "pipeworks:pipe" (and pipe_loaded). Added empty/loaded
indicator images to the capped ends, removed some redundant comments. Made the
empty/loaded indication at the capped end more prominent.
2012-07-21: Added screenshot showing pipes as they look now that nodebox
texture rotation is fixed.
2012-07-18: Changed the mod name and all internals to 'pipeworks' instead of
'pipes'... after a couple of mistakes :-)
2012-07-12: moved project to github.
2012-06-23: Initial release, followed by reworking the textures a bit.

@ -1,94 +0,0 @@
-- Crafting recipes for pipeworks
-- If the technic mod is present, then don't bother registering these recipes
-- as that mod supplies its own.
if io.open(minetest.get_modpath("pipeworks").."/../technic/init.lua", "r") == nil then
-- If homedecor is not installed, we need to register a few of its crafts
-- manually so we can use them.
if minetest.get_modpath("homedecor") == nil then
minetest.register_craftitem(":homedecor:plastic_sheeting", {
description = "Plastic sheet",
inventory_image = "pipeworks_plastic_sheeting.png",
})
minetest.register_craft({
type = "cooking",
output = "homedecor:plastic_sheeting",
recipe = "default:junglegrass",
})
minetest.register_craft({
type = 'fuel',
recipe = 'homedecor:plastic_sheeting',
burntime = 30,
})
end
minetest.register_craft( {
output = "pipeworks:pipe_110000_empty 12",
recipe = {
{ "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" },
{ "", "", "" },
{ "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" }
},
})
minetest.register_craft( {
output = "pipeworks:pump 2",
recipe = {
{ "default:stone", "default:stone", "default:stone" },
{ "default:steel_ingot", "default:stick", "default:steel_ingot" },
{ "default:stone", "default:stone", "default:stone" }
},
})
minetest.register_craft( {
output = "pipeworks:valve 2",
recipe = {
{ "", "default:stick", "" },
{ "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" },
{ "", "default:steel_ingot", "" }
},
})
minetest.register_craft( {
output = "pipeworks:storage_tank 2",
recipe = {
{ "", "default:steel_ingot", "default:steel_ingot" },
{ "default:steel_ingot", "default:glass", "default:steel_ingot" },
{ "default:steel_ingot", "default:steel_ingot", "" }
},
})
minetest.register_craft( {
output = "pipeworks:intake 2",
recipe = {
{ "", "default:steel_ingot", "" },
{ "default:steel_ingot", "", "default:steel_ingot" },
{ "", "default:steel_ingot", "" }
},
})
minetest.register_craft( {
output = "pipeworks:outlet 2",
recipe = {
{ "default:steel_ingot", "", "default:steel_ingot" },
{ "", "default:steel_ingot", "" },
{ "default:steel_ingot", "", "default:steel_ingot" }
},
})
minetest.register_craft( {
output = "pipeworks:tube 12",
recipe = {
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
{ "", "", "" },
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
},
})
end

@ -1,2 +0,0 @@
default

@ -1,471 +0,0 @@
-- List of devices that should participate in the autoplace algorithm
pipes_devicelist = {
"pump",
"valve",
"storage_tank_0",
"storage_tank_1",
"storage_tank_2",
"storage_tank_3",
"storage_tank_4",
"storage_tank_5",
"storage_tank_6",
"storage_tank_7",
"storage_tank_8",
"storage_tank_9",
"storage_tank_10"
}
-- tables
minetest.register_alias("pipeworks:pump", "pipeworks:pump_off_x")
minetest.register_alias("pipeworks:valve", "pipeworks:valve_off_x")
minetest.register_alias("pipeworks:storage_tank", "pipeworks:storage_tank_0_x")
pipe_pumpbody_x = {
{ -6/16, -8/16, -6/16, 6/16, 8/16, 6/16 }
}
pipe_pumpbody_z = {
{ -6/16, -8/16, -6/16, 6/16, 8/16, 6/16 }
}
pipe_valvebody_x = {
{ -4/16, -4/16, -4/16, 4/16, 4/16, 4/16 }
}
pipe_valvebody_z = {
{ -4/16, -4/16, -4/16, 4/16, 4/16, 4/16 }
}
pipe_valvehandle_on_x = {
{ -5/16, 4/16, -1/16, 0, 5/16, 1/16 }
}
pipe_valvehandle_on_z = {
{ -1/16, 4/16, -5/16, 1/16, 5/16, 0 }
}
pipe_valvehandle_off_x = {
{ -1/16, 4/16, -5/16, 1/16, 5/16, 0 }
}
pipe_valvehandle_off_z = {
{ -5/16, 4/16, -1/16, 0, 5/16, 1/16 }
}
-- Now define the nodes.
local states = { "on", "off" }
local dgroups = ""
for s in ipairs(states) do
if states[s] == "off" then
dgroups = {snappy=3, pipe=1}
else
dgroups = {snappy=3, pipe=1, not_in_creative_inventory=1}
end
local pumpboxes = {}
pipe_addbox(pumpboxes, pipe_leftstub)
pipe_addbox(pumpboxes, pipe_pumpbody_x)
pipe_addbox(pumpboxes, pipe_rightstub)
local tilex = "pipeworks_pump_ends.png"
local tilez = "pipeworks_pump_"..states[s]..".png"
minetest.register_node("pipeworks:pump_"..states[s].."_x", {
description = "Pump Module ("..states[s]..")",
drawtype = "nodebox",
tiles = {
"pipeworks_pump_top_x.png",
"pipeworks_pump_sides.png",
tilex,
tilex,
"pipeworks_pump_sides.png",
tilez
},
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 = dgroups,
sounds = default.node_sound_wood_defaults(),
walkable = true,
stack_max = 99,
after_place_node = function(pos)
pipe_device_autorotate(pos, states[s], "pipeworks:pump")
pipe_scanforobjects(pos)
end,
after_dig_node = function(pos)
pipe_scanforobjects(pos)
end,
drop = "pipeworks:pump_off_x"
})
local pumpboxes = {}
pipe_addbox(pumpboxes, pipe_frontstub)
pipe_addbox(pumpboxes, pipe_pumpbody_z)
pipe_addbox(pumpboxes, pipe_backstub)
minetest.register_node("pipeworks:pump_"..states[s].."_z", {
description = "Pump Module ("..states[s]..", Z-axis)",
drawtype = "nodebox",
tiles = {
"pipeworks_pump_top_z.png",
"pipeworks_pump_sides.png",
tilez,
tilez,
"pipeworks_pump_sides.png",
tilex
},
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, not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
stack_max = 99,
after_place_node = function(pos)
pipe_device_autorotate(pos, states[s], "pipeworks:pump")
pipe_scanforobjects(pos)
end,
after_dig_node = function(pos)
pipe_scanforobjects(pos)
end,
drop = "pipeworks:pump_off_x"
})
local valveboxes = {}
pipe_addbox(valveboxes, pipe_leftstub)
pipe_addbox(valveboxes, pipe_valvebody_x)
if states[s] == "off" then
pipe_addbox(valveboxes, pipe_valvehandle_off_x)
else
pipe_addbox(valveboxes, pipe_valvehandle_on_x)
end
pipe_addbox(valveboxes, pipe_rightstub)
local tilex = "pipeworks_valvebody_ends.png"
local tilez = "pipeworks_valvebody_sides.png"
minetest.register_node("pipeworks:valve_"..states[s].."_x", {
description = "Valve ("..states[s]..")",
drawtype = "nodebox",
tiles = {
"pipeworks_valvebody_top_"..states[s].."_x.png",
"pipeworks_valvebody_bottom.png",
tilex,
tilex,
tilez,
tilez,
},
paramtype = "light",
selection_box = {
type = "fixed",
fixed = { -8/16, -4/16, -5/16, 8/16, 5/16, 5/16 }
},
node_box = {
type = "fixed",
fixed = valveboxes
},
groups = dgroups,
sounds = default.node_sound_wood_defaults(),
walkable = true,
stack_max = 99,
after_place_node = function(pos)
pipe_device_autorotate(pos, states[s], "pipeworks:valve")
pipe_scanforobjects(pos)
end,
after_dig_node = function(pos)
pipe_scanforobjects(pos)
end,
drop = "pipeworks:valve_off_x",
pipelike=1,
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_int("pipelike",1)
end,
})
local valveboxes = {}
pipe_addbox(valveboxes, pipe_frontstub)
pipe_addbox(valveboxes, pipe_valvebody_z)
if states[s] == "off" then
pipe_addbox(valveboxes, pipe_valvehandle_off_z)
else
pipe_addbox(valveboxes, pipe_valvehandle_on_z)
end
pipe_addbox(valveboxes, pipe_backstub)
minetest.register_node("pipeworks:valve_"..states[s].."_z", {
description = "Valve ("..states[s]..", Z-axis)",
drawtype = "nodebox",
tiles = {
"pipeworks_valvebody_top_"..states[s].."_z.png",
"pipeworks_valvebody_bottom.png",
tilez,
tilez,
tilex,
tilex,
},
paramtype = "light",
selection_box = {
type = "fixed",
fixed = { -5/16, -4/16, -8/16, 5/16, 5/16, 8/16 }
},
node_box = {
type = "fixed",
fixed = valveboxes
},
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
stack_max = 99,
after_place_node = function(pos)
pipe_device_autorotate(pos, states[s], "pipeworks:valve")
pipe_scanforobjects(pos)
end,
after_dig_node = function(pos)
pipe_scanforobjects(pos)
end,
drop = "pipeworks:valve_off_x",
pipelike=1,
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_int("pipelike",1)
end,
})
end
-- intake grate
minetest.register_node("pipeworks:intake", {
description = "Intake grate",
drawtype = "nodebox",
tiles = {
"pipeworks_intake_top.png",
"pipeworks_intake_sides.png",
"pipeworks_intake_sides.png",
"pipeworks_intake_sides.png",
"pipeworks_intake_sides.png",
"pipeworks_intake_sides.png"
},
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
},
node_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
},
paramtype = "light",
groups = {snappy=3, pipe=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
stack_max = 99,
after_place_node = function(pos)
pipe_scanforobjects(pos)
end,
after_dig_node = function(pos)
pipe_scanforobjects(pos)
end,
pipelike=1,
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_int("pipelike",1)
end,
})
-- outlet grate
minetest.register_node("pipeworks:outlet", {
description = "Outlet grate",
drawtype = "nodebox",
tiles = {
"pipeworks_outlet_top.png",
"pipeworks_outlet_sides.png",
"pipeworks_outlet_sides.png",
"pipeworks_outlet_sides.png",
"pipeworks_outlet_sides.png",
"pipeworks_outlet_sides.png"
},
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
},
node_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
},
paramtype = "light",
groups = {snappy=3, pipe=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
stack_max = 99,
after_place_node = function(pos)
pipe_scanforobjects(pos)
end,
after_dig_node = function(pos)
pipe_scanforobjects(pos)
end,
pipelike=1,
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_int("pipelike",1)
end,
})
-- tanks
for fill = 0, 10 do
if fill == 0 then
filldesc="empty"
sgroups = {snappy=3, pipe=1, tankfill=fill+1}
else
filldesc=fill.."0% full"
sgroups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1}
end
minetest.register_node("pipeworks:expansion_tank_"..fill, {
description = "Expansion Tank ("..filldesc..")... You hacker, you.",
tiles = {
"pipeworks_storage_tank_fittings.png",
"pipeworks_storage_tank_fittings.png",
"pipeworks_storage_tank_back.png",
"pipeworks_storage_tank_back.png",
"pipeworks_storage_tank_back.png",
"pipeworks_storage_tank_front_"..fill..".png"
},
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
stack_max = 99,
drop = "pipeworks:storage_tank_"..fill.."_x",
after_place_node = function(pos)
pipe_look_for_stackable_tanks(pos)
pipe_scanforobjects(pos)
end,
after_dig_node = function(pos)
pipe_scanforobjects(pos)
end,
pipelike=0,
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_int("pipelike",0)
end,
})
minetest.register_node("pipeworks:storage_tank_"..fill.."_x", {
description = "Fluid Storage Tank ("..filldesc..")",
tiles = {
"pipeworks_storage_tank_fittings.png",
"pipeworks_storage_tank_back.png",
"pipeworks_storage_tank_fittings.png",
"pipeworks_storage_tank_fittings.png",
"pipeworks_storage_tank_back.png",
"pipeworks_storage_tank_front_"..fill..".png"
},
paramtype = "light",
groups = sgroups,
sounds = default.node_sound_wood_defaults(),
walkable = true,
stack_max = 99,
after_place_node = function(pos)
pipe_look_for_stackable_tanks(pos)
if string.find(minetest.env:get_node(pos).name, "pipeworks:storage_tank_") ~= nil then
pipe_device_autorotate(pos, nil, "pipeworks:storage_tank_"..fill)
end
pipe_scanforobjects(pos)
end,
after_dig_node = function(pos)
pipe_scanforobjects(pos)
end,
pipelike=1,
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_int("pipelike",1)
end,
})
minetest.register_node("pipeworks:storage_tank_"..fill.."_z", {
description = "Fluid Storage Tank (Z axis, "..filldesc..")... You hacker, you.",
tiles = {
"pipeworks_storage_tank_fittings.png",
"pipeworks_storage_tank_back.png",
"pipeworks_storage_tank_front_"..fill..".png",
"pipeworks_storage_tank_back.png",
"pipeworks_storage_tank_fittings.png",
"pipeworks_storage_tank_fittings.png"
},
paramtype = "light",
groups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
stack_max = 99,
drop = "pipeworks:storage_tank_"..fill.."_x",
after_place_node = function(pos)
pipe_look_for_stackable_tanks(pos)
if string.find(minetest.env:get_node(pos).name, "pipeworks:storage_tank_") ~= nil then
pipe_device_autorotate(pos, nil, "pipeworks:storage_tank_"..fill)
end
pipe_scanforobjects(pos)
end,
after_dig_node = function(pos)
pipe_scanforobjects(pos)
end,
pipelike=1,
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_int("pipelike",1)
end,
})
end
-- various actions
local axes = { "x", "z" }
for a in ipairs(axes) do
minetest.register_on_punchnode(function (pos, node)
if node.name=="pipeworks:valve_on_"..axes[a] then
minetest.env:add_node(pos, { name = "pipeworks:valve_off_"..axes[a] })
local meta = minetest.env:get_meta(pos)
meta:set_int("pipelike",0)
end
end)
minetest.register_on_punchnode(function (pos, node)
if node.name=="pipeworks:valve_off_"..axes[a] then
minetest.env:add_node(pos, { name = "pipeworks:valve_on_"..axes[a] })
local meta = minetest.env:get_meta(pos)
meta:set_int("pipelike",1)
end
end)
minetest.register_on_punchnode(function (pos, node)
if node.name=="pipeworks:pump_on_"..axes[a] then
minetest.env:add_node(pos, { name = "pipeworks:pump_off_"..axes[a] })
end
end)
minetest.register_on_punchnode(function (pos, node)
if node.name=="pipeworks:pump_off_"..axes[a] then
minetest.env:add_node(pos, { name = "pipeworks:pump_on_"..axes[a] })
end
end)
end

@ -1,322 +0,0 @@
-- Pipeworks mod by Vanessa Ezekowitz - 2012-08-05
--
-- Entirely my own code. This mod supplies various shapes of pipes
-- and devices that they can connect to such as pumps, valves, etc.
-- All pipes autoconnect as you lay them out, and devices will auto-
-- connect to them.
--
-- License: WTFPL
--
-- Un-comment the following dofile line to re-enable the old pipe nodes.
-- dofile(minetest.get_modpath("pipeworks").."/oldpipes.lua")
minetest.register_alias("pipeworks:pipe", "pipeworks:pipe_110000_empty")
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 }
}
-- Functions
dbg = function(s)
if DEBUG == 1 then
print('[PIPEWORKS] ' .. s)
end
end
function pipes_fix_image_names(table, replacement)
outtable={}
for i in ipairs(table) do
outtable[i]=string.gsub(table[i], "_XXXXX", replacement)
end
return outtable
end
function pipe_addbox(t, b)
for i in ipairs(b)
do table.insert(t, b[i])
end
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
local outboxes = {}
local outsel = {}
local outimgs = {}
if yp==1 then
pipe_addbox(outboxes, pipe_topstub)
table.insert(outsel, pipe_selectboxes[4])
table.insert(outimgs, "pipeworks_pipe_end.png")
else
table.insert(outimgs, "pipeworks_plain.png")
end
if ym==1 then
pipe_addbox(outboxes, pipe_bottomstub)
table.insert(outsel, pipe_selectboxes[3])
table.insert(outimgs, "pipeworks_pipe_end.png")
else
table.insert(outimgs, "pipeworks_plain.png")
end
if xp==1 then
pipe_addbox(outboxes, pipe_rightstub)
table.insert(outsel, pipe_selectboxes[2])
table.insert(outimgs, "pipeworks_pipe_end.png")
else
table.insert(outimgs, "pipeworks_plain.png")
end
if xm==1 then
pipe_addbox(outboxes, pipe_leftstub)
table.insert(outsel, pipe_selectboxes[1])
table.insert(outimgs, "pipeworks_pipe_end.png")
else
table.insert(outimgs, "pipeworks_plain.png")
end
if zp==1 then
pipe_addbox(outboxes, pipe_backstub)
table.insert(outsel, pipe_selectboxes[6])
table.insert(outimgs, "pipeworks_pipe_end.png")
else
table.insert(outimgs, "pipeworks_plain.png")
end
if zm==1 then
pipe_addbox(outboxes, pipe_frontstub)
table.insert(outsel, pipe_selectboxes[5])
table.insert(outimgs, "pipeworks_pipe_end.png")
else
table.insert(outimgs, "pipeworks_plain.png")
end
local jx = xp+xm
local jy = yp+ym
local jz = zp+zm
if (jx+jy+jz) == 1 then
if xm == 1 then
table.remove(outimgs, 3)
table.insert(outimgs, 3, "pipeworks_pipe_end_XXXXX.png")
end
if xp == 1 then
table.remove(outimgs, 4)
table.insert(outimgs, 4, "pipeworks_pipe_end_XXXXX.png")
end
if ym == 1 then
table.remove(outimgs, 1)
table.insert(outimgs, 1, "pipeworks_pipe_end_XXXXX.png")
end
if xp == 1 then
table.remove(outimgs, 2)
table.insert(outimgs, 2, "pipeworks_pipe_end_XXXXX.png")
end
if zm == 1 then
table.remove(outimgs, 5)
table.insert(outimgs, 5, "pipeworks_pipe_end_XXXXX.png")
end
if zp == 1 then
table.remove(outimgs, 6)
table.insert(outimgs, 6, "pipeworks_pipe_end_XXXXX.png")
end
end
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
pipe_addbox(outboxes, 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_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
local pname = xm..xp..ym..yp..zm..zp
local pgroups = ""
if pname ~= "110000" then
pgroups = {snappy=3, pipe=1, not_in_creative_inventory=1}
pipedesc = "Pipe segment (empty, "..pname..")... You hacker, you."
else
pgroups = {snappy=3, pipe=1}
pipedesc = "Pipe segment"
end
minetest.register_node("pipeworks:pipe_"..pname.."_empty", {
description = pipedesc,
drawtype = "nodebox",
tiles = pipes_fix_image_names(outimgs, "_empty"),
paramtype = "light",
selection_box = {
type = "fixed",
fixed = outsel
},
node_box = {
type = "fixed",
fixed = outboxes
},
groups = pgroups,
sounds = default.node_sound_wood_defaults(),
walkable = true,
stack_max = 99,
drop = "pipeworks:pipe_110000_empty",
pipelike=1,
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_int("pipelike",1)
end,
after_place_node = function(pos)
pipe_scanforobjects(pos)
end,
after_dig_node = function(pos)
pipe_scanforobjects(pos)
end,
})
minetest.register_node("pipeworks:pipe_"..pname.."_loaded", {
description = "Pipe segment (loaded, "..pname..")... You hacker, you.",
drawtype = "nodebox",
tiles = pipes_fix_image_names(outimgs, "_loaded"),
paramtype = "light",
selection_box = {
type = "fixed",
fixed = outsel
},
node_box = {
type = "fixed",
fixed = outboxes
},
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
stack_max = 99,
drop = "pipeworks:pipe_110000_loaded",
pipelike=1,
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_int("pipelike",1)
end,
after_place_node = function(pos)
pipe_scanforobjects(pos)
end,
after_dig_node = function(pos)
pipe_scanforobjects(pos)
end
})
end
end
end
end
end
end
dofile(minetest.get_modpath("pipeworks").."/tubes.lua")
dofile(minetest.get_modpath("pipeworks").."/devices.lua")
dofile(minetest.get_modpath("pipeworks").."/autoplace.lua")
dofile(minetest.get_modpath("pipeworks").."/crafts.lua")
print("Pipeworks loaded!")

@ -1,360 +0,0 @@
-- 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_segment",
"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
if node ~= 2 then
pgroups = {snappy=3, pipe=1, not_in_creative_inventory=1}
else
pgroups = {snappy=3, pipe=1}
end
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 = pgroups,
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, not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
stack_max = 99,
drop = "pipeworks:pipe"
})
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

@ -1,217 +0,0 @@
-- This file supplies pneumatic tubes and a 'test' device
minetest.register_node("pipeworks:testobject", {
description = "Pneumatic tube test ojbect",
tiles = {
"pipeworks_testobject.png",
},
paramtype = "light",
groups = {snappy=3, tubedevice=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
after_place_node = function(pos)
tube_scanforobjects(pos)
end,
after_dig_node = function(pos)
tube_scanforobjects(pos)
end,
})
-- tables
minetest.register_alias("pipeworks:tube", "pipeworks:tube_000000")
tube_leftstub = {
{ -32/64, -9/64, -9/64, 9/64, 9/64, 9/64 }, -- tube segment against -X face
}
tube_rightstub = {
{ -9/64, -9/64, -9/64, 32/64, 9/64, 9/64 }, -- tube segment against +X face
}
tube_bottomstub = {
{ -9/64, -32/64, -9/64, 9/64, 9/64, 9/64 }, -- tube segment against -Y face
}
tube_topstub = {
{ -9/64, -9/64, -9/64, 9/64, 32/64, 9/64 }, -- tube segment against +Y face
}
tube_frontstub = {
{ -9/64, -9/64, -32/64, 9/64, 9/64, 9/64 }, -- tube segment against -Z face
}
tube_backstub = {
{ -9/64, -9/64, -9/64, 9/64, 9/64, 32/64 }, -- tube segment against -Z face
}
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
function tube_addbox(t, b)
for i in ipairs(b)
do table.insert(t, b[i])
end
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
local outboxes = {}
local outsel = {}
local outimgs = {}
if yp==1 then
tube_addbox(outboxes, tube_topstub)
table.insert(outsel, tube_selectboxes[4])
table.insert(outimgs, "pipeworks_tube_noctr.png")
else
table.insert(outimgs, "pipeworks_tube_plain.png")
end
if ym==1 then
tube_addbox(outboxes, tube_bottomstub)
table.insert(outsel, tube_selectboxes[3])
table.insert(outimgs, "pipeworks_tube_noctr.png")
else
table.insert(outimgs, "pipeworks_tube_plain.png")
end
if xp==1 then
tube_addbox(outboxes, tube_rightstub)
table.insert(outsel, tube_selectboxes[2])
table.insert(outimgs, "pipeworks_tube_noctr.png")
else
table.insert(outimgs, "pipeworks_tube_plain.png")
end
if xm==1 then
tube_addbox(outboxes, tube_leftstub)
table.insert(outsel, tube_selectboxes[1])
table.insert(outimgs, "pipeworks_tube_noctr.png")
else
table.insert(outimgs, "pipeworks_tube_plain.png")
end
if zp==1 then
tube_addbox(outboxes, tube_backstub)
table.insert(outsel, tube_selectboxes[6])
table.insert(outimgs, "pipeworks_tube_noctr.png")
else
table.insert(outimgs, "pipeworks_tube_plain.png")
end
if zm==1 then
tube_addbox(outboxes, tube_frontstub)
table.insert(outsel, tube_selectboxes[5])
table.insert(outimgs, "pipeworks_tube_noctr.png")
else
table.insert(outimgs, "pipeworks_tube_plain.png")
end
local jx = xp+xm
local jy = yp+ym
local jz = zp+zm
if (jx+jy+jz) == 1 then
if xm == 1 then
table.remove(outimgs, 3)
table.insert(outimgs, 3, "pipeworks_tube_end.png")
end
if xp == 1 then
table.remove(outimgs, 4)
table.insert(outimgs, 4, "pipeworks_tube_end.png")
end
if ym == 1 then
table.remove(outimgs, 1)
table.insert(outimgs, 1, "pipeworks_tube_end.png")
end
if xp == 1 then
table.remove(outimgs, 2)
table.insert(outimgs, 2, "pipeworks_tube_end.png")
end
if zm == 1 then
table.remove(outimgs, 5)
table.insert(outimgs, 5, "pipeworks_tube_end.png")
end
if zp == 1 then
table.remove(outimgs, 6)
table.insert(outimgs, 6, "pipeworks_tube_end.png")
end
end
local tname = xm..xp..ym..yp..zm..zp
local tgroups = ""
if tname ~= "000000" then
tgroups = {snappy=3, tube=1, not_in_creative_inventory=1}
tubedesc = "Pneumatic tube segment ("..tname..")... You hacker, you."
iimg=nil
wscale = {x=1,y=1,z=1}
else
tgroups = {snappy=3, tube=1}
tubedesc = "Pneumatic tube segment"
iimg="pipeworks_tube_inv.png"
outimgs = {
"pipeworks_tube_short.png",
"pipeworks_tube_short.png",
"pipeworks_tube_end.png",
"pipeworks_tube_end.png",
"pipeworks_tube_short.png",
"pipeworks_tube_short.png"
}
outboxes = { -24/64, -9/64, -9/64, 24/64, 9/64, 9/64 }
outsel = { -24/64, -10/64, -10/64, 24/64, 10/64, 10/64 }
wscale = {x=1,y=1,z=0.01}
end
minetest.register_node("pipeworks:tube_"..tname, {
description = tubedesc,
drawtype = "nodebox",
tiles = outimgs,
inventory_image=iimg,
wield_image=iimg,
wield_scale=wscale,
paramtype = "light",
selection_box = {
type = "fixed",
fixed = outsel
},
node_box = {
type = "fixed",
fixed = outboxes
},
groups = tgroups,
sounds = default.node_sound_wood_defaults(),
walkable = true,
stack_max = 99,
drop = "pipeworks:tube_000000",
tubelike=1,
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_int("tubelike",1)
end,
after_place_node = function(pos)
tube_scanforobjects(pos)
end,
after_dig_node = function(pos)
tube_scanforobjects(pos)
end
})
end
end
end
end
end
end