local-ize pretty muchg everything that was previously global except where

stuff needs to be globally-visible.  Also, fix a bad drop on valve.
This commit is contained in:
Vanessa Ezekowitz 2013-12-15 02:53:10 -05:00
parent b43a1036ca
commit bd80f18cfc
14 changed files with 344 additions and 345 deletions

View File

@ -115,10 +115,10 @@ minetest.register_node("pipeworks:autocrafter", {
return (inv:is_empty("src") and inv:is_empty("recipe") and inv:is_empty("dst")) return (inv:is_empty("src") and inv:is_empty("recipe") and inv:is_empty("dst"))
end, end,
after_place_node = function(pos) after_place_node = function(pos)
tube_scanforobjects(pos) pipeworks.scan_for_tube_objects(pos)
end, end,
after_dig_node = function(pos) after_dig_node = function(pos)
tube_scanforobjects(pos) pipeworks.scan_for_tube_objects(pos)
autocrafterCache[minetest.hash_node_position(pos)] = nil autocrafterCache[minetest.hash_node_position(pos)] = nil
end end
}) })

View File

@ -1,50 +1,49 @@
-- autorouting for pipes -- autorouting for pipes
function pipe_scanforobjects(pos) local function autoroute_pipes(pos, state)
pipe_autoroute({ x=pos.x-1, y=pos.y , z=pos.z }, "_loaded") local nctr = minetest.get_node(pos)
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.get_node(pos)
if (string.find(nctr.name, "pipeworks:pipe_") == nil) then return end if (string.find(nctr.name, "pipeworks:pipe_") == nil) then return end
pipes_scansurroundings(pos) local nsurround = pipeworks.scan_pipe_surroundings(pos)
nsurround = pxm..pxp..pym..pyp..pzm..pzp
if nsurround == "000000" then nsurround = "110000" end if nsurround == "000000" then nsurround = "110000" end
minetest.add_node(pos, { name = "pipeworks:pipe_"..nsurround..state }) minetest.add_node(pos, { name = "pipeworks:pipe_"..nsurround..state })
end end
function pipeworks.scan_for_pipe_objects(pos)
autoroute_pipes({ x=pos.x-1, y=pos.y , z=pos.z }, "_loaded")
autoroute_pipes({ x=pos.x+1, y=pos.y , z=pos.z }, "_loaded")
autoroute_pipes({ x=pos.x , y=pos.y-1, z=pos.z }, "_loaded")
autoroute_pipes({ x=pos.x , y=pos.y+1, z=pos.z }, "_loaded")
autoroute_pipes({ x=pos.x , y=pos.y , z=pos.z-1 }, "_loaded")
autoroute_pipes({ x=pos.x , y=pos.y , z=pos.z+1 }, "_loaded")
autoroute_pipes(pos, "_loaded")
autoroute_pipes({ x=pos.x-1, y=pos.y , z=pos.z }, "_empty")
autoroute_pipes({ x=pos.x+1, y=pos.y , z=pos.z }, "_empty")
autoroute_pipes({ x=pos.x , y=pos.y-1, z=pos.z }, "_empty")
autoroute_pipes({ x=pos.x , y=pos.y+1, z=pos.z }, "_empty")
autoroute_pipes({ x=pos.x , y=pos.y , z=pos.z-1 }, "_empty")
autoroute_pipes({ x=pos.x , y=pos.y , z=pos.z+1 }, "_empty")
autoroute_pipes(pos, "_empty")
end
-- auto-rotation code for various devices the tubes attach to -- auto-rotation code for various devices the tubes attach to
function pipes_scansurroundings(pos) function pipeworks.scan_pipe_surroundings(pos)
pxm=0 local pxm=0
pxp=0 local pxp=0
pym=0 local pym=0
pyp=0 local pyp=0
pzm=0 local pzm=0
pzp=0 local pzp=0
nxm = minetest.get_node({ x=pos.x-1, y=pos.y , z=pos.z }) local nxm = minetest.get_node({ x=pos.x-1, y=pos.y , z=pos.z })
nxp = minetest.get_node({ x=pos.x+1, y=pos.y , z=pos.z }) local nxp = minetest.get_node({ x=pos.x+1, y=pos.y , z=pos.z })
nym = minetest.get_node({ x=pos.x , y=pos.y-1, z=pos.z }) local nym = minetest.get_node({ x=pos.x , y=pos.y-1, z=pos.z })
nyp = minetest.get_node({ x=pos.x , y=pos.y+1, z=pos.z }) local nyp = minetest.get_node({ x=pos.x , y=pos.y+1, z=pos.z })
nzm = minetest.get_node({ x=pos.x , y=pos.y , z=pos.z-1 }) local nzm = minetest.get_node({ x=pos.x , y=pos.y , z=pos.z-1 })
nzp = minetest.get_node({ x=pos.x , y=pos.y , z=pos.z+1 }) local nzp = minetest.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(nxm.name, "pipeworks:pipe_") ~= nil) then pxm=1 end
if (string.find(nxp.name, "pipeworks:pipe_") ~= nil) then pxp=1 end if (string.find(nxp.name, "pipeworks:pipe_") ~= nil) then pxp=1 end
@ -192,9 +191,10 @@ function pipes_scansurroundings(pos)
-- end -- end
-- --
return pxm..pxp..pym..pyp..pzm..pzp
end end
function pipe_look_for_stackable_tanks(pos) function pipeworks.look_for_stackable_tanks(pos)
local tym = minetest.get_node({ x=pos.x , y=pos.y-1, z=pos.z }) local tym = minetest.get_node({ x=pos.x , y=pos.y-1, z=pos.z })
if string.find(tym.name, "pipeworks:storage_tank_") ~= nil or if string.find(tym.name, "pipeworks:storage_tank_") ~= nil or

View File

@ -1,6 +1,6 @@
-- autorouting for pneumatic tubes -- autorouting for pneumatic tubes
function tube_scanforobjects(pos) function pipeworks.scan_for_tube_objects(pos)
if pos == nil then return end if pos == nil then return end
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+1, y=pos.y , z=pos.z }) tube_autoroute({ x=pos.x+1, y=pos.y , z=pos.z })
@ -139,7 +139,7 @@ minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack
if minetest.registered_items[newnode.name] if minetest.registered_items[newnode.name]
and minetest.registered_items[newnode.name].tube and minetest.registered_items[newnode.name].tube
and minetest.registered_items[newnode.name].tube.connect_sides then and minetest.registered_items[newnode.name].tube.connect_sides then
tube_scanforobjects(pos) pipeworks.scan_for_tube_objects(pos)
end end
end) end)
@ -147,7 +147,7 @@ minetest.register_on_dignode(function(pos, oldnode, digger)
if minetest.registered_items[oldnode.name] if minetest.registered_items[oldnode.name]
and minetest.registered_items[oldnode.name].tube and minetest.registered_items[oldnode.name].tube
and minetest.registered_items[oldnode.name].tube.connect_sides then and minetest.registered_items[oldnode.name].tube.connect_sides then
tube_scanforobjects(pos) pipeworks.scan_for_tube_objects(pos)
end end
end) end)

View File

@ -10,7 +10,7 @@ function pipeworks:clone_node(name)
return node2 return node2
end end
furnace=pipeworks:clone_node("default:furnace") local furnace=pipeworks:clone_node("default:furnace")
furnace.tiles[2] = "default_furnace_bottom.png^pipeworks_tube_connection_stony.png" furnace.tiles[2] = "default_furnace_bottom.png^pipeworks_tube_connection_stony.png"
furnace.tiles[3] = "default_furnace_side.png^pipeworks_tube_connection_stony.png" furnace.tiles[3] = "default_furnace_side.png^pipeworks_tube_connection_stony.png"
furnace.tiles[4] = "default_furnace_side.png^pipeworks_tube_connection_stony.png" furnace.tiles[4] = "default_furnace_side.png^pipeworks_tube_connection_stony.png"
@ -41,15 +41,15 @@ furnace=pipeworks:clone_node("default:furnace")
input_inventory="dst", input_inventory="dst",
connect_sides={left=1, right=1, back=1, bottom=1}} connect_sides={left=1, right=1, back=1, bottom=1}}
furnace.after_place_node= function(pos) furnace.after_place_node= function(pos)
tube_scanforobjects(pos) pipeworks.scan_for_tube_objects(pos)
end end
furnace.after_dig_node = function(pos) furnace.after_dig_node = function(pos)
tube_scanforobjects(pos) pipeworks.scan_for_tube_objects(pos)
end end
minetest.register_node(":default:furnace",furnace) minetest.register_node(":default:furnace",furnace)
furnace=pipeworks:clone_node("default:furnace_active") local furnace=pipeworks:clone_node("default:furnace_active")
furnace.tiles[2] = "default_furnace_bottom.png^pipeworks_tube_connection_stony.png" furnace.tiles[2] = "default_furnace_bottom.png^pipeworks_tube_connection_stony.png"
furnace.tiles[3] = "default_furnace_side.png^pipeworks_tube_connection_stony.png" furnace.tiles[3] = "default_furnace_side.png^pipeworks_tube_connection_stony.png"
furnace.tiles[4] = "default_furnace_side.png^pipeworks_tube_connection_stony.png" furnace.tiles[4] = "default_furnace_side.png^pipeworks_tube_connection_stony.png"
@ -80,15 +80,15 @@ furnace=pipeworks:clone_node("default:furnace_active")
input_inventory="dst", input_inventory="dst",
connect_sides={left=1, right=1, back=1, bottom=1}} connect_sides={left=1, right=1, back=1, bottom=1}}
furnace.after_place_node= function(pos) furnace.after_place_node= function(pos)
tube_scanforobjects(pos) pipeworks.scan_for_tube_objects(pos)
end end
furnace.after_dig_node = function(pos) furnace.after_dig_node = function(pos)
tube_scanforobjects(pos) pipeworks.scan_for_tube_objects(pos)
end end
minetest.register_node(":default:furnace_active",furnace) minetest.register_node(":default:furnace_active",furnace)
chest=pipeworks:clone_node("default:chest") local chest=pipeworks:clone_node("default:chest")
chest.tiles[1] = "default_chest_top.png^pipeworks_tube_connection_wooden.png" chest.tiles[1] = "default_chest_top.png^pipeworks_tube_connection_wooden.png"
chest.tiles[2] = "default_chest_top.png^pipeworks_tube_connection_wooden.png" chest.tiles[2] = "default_chest_top.png^pipeworks_tube_connection_wooden.png"
chest.tiles[3] = "default_chest_side.png^pipeworks_tube_connection_wooden.png" chest.tiles[3] = "default_chest_side.png^pipeworks_tube_connection_wooden.png"
@ -110,16 +110,16 @@ chest=pipeworks:clone_node("default:chest")
input_inventory="main", input_inventory="main",
connect_sides={left=1, right=1, back=1, bottom=1, top=1}} connect_sides={left=1, right=1, back=1, bottom=1, top=1}}
chest.after_place_node = function(pos) chest.after_place_node = function(pos)
tube_scanforobjects(pos) pipeworks.scan_for_tube_objects(pos)
end end
chest.after_dig_node = function(pos) chest.after_dig_node = function(pos)
tube_scanforobjects(pos) pipeworks.scan_for_tube_objects(pos)
end end
minetest.register_node(":default:chest",chest) minetest.register_node(":default:chest",chest)
chest_locked=pipeworks:clone_node("default:chest_locked") local chest_locked=pipeworks:clone_node("default:chest_locked")
chest_locked.tiles[1] = "default_chest_top.png^pipeworks_tube_connection_wooden.png" chest_locked.tiles[1] = "default_chest_top.png^pipeworks_tube_connection_wooden.png"
chest_locked.tiles[2] = "default_chest_top.png^pipeworks_tube_connection_wooden.png" chest_locked.tiles[2] = "default_chest_top.png^pipeworks_tube_connection_wooden.png"
chest_locked.tiles[3] = "default_chest_side.png^pipeworks_tube_connection_wooden.png" chest_locked.tiles[3] = "default_chest_side.png^pipeworks_tube_connection_wooden.png"
@ -141,11 +141,11 @@ chest_locked=pipeworks:clone_node("default:chest_locked")
connect_sides={left=1, right=1, back=1, bottom=1, top=1}} connect_sides={left=1, right=1, back=1, bottom=1, top=1}}
local old_after_place = minetest.registered_nodes["default:chest_locked"].after_place_node; local old_after_place = minetest.registered_nodes["default:chest_locked"].after_place_node;
chest_locked.after_place_node = function(pos, placer) chest_locked.after_place_node = function(pos, placer)
tube_scanforobjects(pos) pipeworks.scan_for_tube_objects(pos)
old_after_place(pos, placer) old_after_place(pos, placer)
end end
chest_locked.after_dig_node = function(pos) chest_locked.after_dig_node = function(pos)
tube_scanforobjects(pos) pipeworks.scan_for_tube_objects(pos)
end end
minetest.register_node(":default:chest_locked",chest_locked) minetest.register_node(":default:chest_locked",chest_locked)

View File

@ -1,18 +1,18 @@
-- Various settings -- Various settings
enable_pipes = true local enable_pipes = true
enable_autocrafter = true local enable_autocrafter = true
enable_deployer = true local enable_deployer = true
enable_node_breaker = true local enable_node_breaker = true
enable_teleport_tube = true local enable_teleport_tube = true
enable_pipe_devices = true local enable_pipe_devices = true
enable_redefines = true local enable_redefines = true
enable_mese_tube = true local enable_mese_tube = true
enable_detector_tube = true local enable_detector_tube = true
enable_conductor_tube = true local enable_conductor_tube = true
enable_accelerator_tube = true local enable_accelerator_tube = true
enable_crossing_tube = true local enable_crossing_tube = true
enable_sand_tube = true local enable_sand_tube = true
enable_mese_sand_tube = true local enable_mese_sand_tube = true
enable_one_way_tube = true local enable_one_way_tube = true
CYCLIC = true local CYCLIC = true

View File

@ -66,7 +66,7 @@ minetest.register_craft({
} }
}) })
function hacky_swap_node(pos,name) local function hacky_swap_node(pos,name)
local node=minetest.get_node(pos) local node=minetest.get_node(pos)
local meta=minetest.get_meta(pos) local meta=minetest.get_meta(pos)
local meta0=meta:to_table() local meta0=meta:to_table()
@ -83,7 +83,7 @@ local function delay(x)
return (function() return x end) return (function() return x end)
end end
deployer_on = function(pos, node) local deployer_on = function(pos, node)
if node.name ~= "pipeworks:deployer_off" then if node.name ~= "pipeworks:deployer_off" then
return return
end end
@ -161,7 +161,7 @@ deployer_on = function(pos, node)
end end
end end
deployer_off = function(pos, node) local deployer_off = function(pos, node)
if node.name == "pipeworks:deployer_on" then if node.name == "pipeworks:deployer_on" then
hacky_swap_node(pos,"pipeworks:deployer_off") hacky_swap_node(pos,"pipeworks:deployer_off")
nodeupdate(pos) nodeupdate(pos)
@ -206,7 +206,7 @@ minetest.register_node("pipeworks:deployer_off", {
return inv:is_empty("main") return inv:is_empty("main")
end, end,
after_place_node = function (pos, placer) after_place_node = function (pos, placer)
tube_scanforobjects(pos, placer) pipeworks.scan_for_tube_objects(pos, placer)
local placer_pos = placer:getpos() local placer_pos = placer:getpos()
--correct for the player's height --correct for the player's height
@ -225,7 +225,7 @@ minetest.register_node("pipeworks:deployer_off", {
minetest.log("action", "real (6d) facedir: " .. node.param2) minetest.log("action", "real (6d) facedir: " .. node.param2)
end end
end, end,
after_dig_node = tube_scanforobjects, after_dig_node = pipeworks.scan_for_tube_objects,
}) })
minetest.register_node("pipeworks:deployer_on", { minetest.register_node("pipeworks:deployer_on", {
@ -267,7 +267,7 @@ minetest.register_node("pipeworks:deployer_on", {
return inv:is_empty("main") return inv:is_empty("main")
end, end,
after_place_node = function (pos, placer) after_place_node = function (pos, placer)
tube_scanforobjects(pos, placer) pipeworks.scan_for_tube_objects(pos, placer)
local placer_pos = placer:getpos() local placer_pos = placer:getpos()
--correct for the player's height --correct for the player's height
@ -286,5 +286,5 @@ minetest.register_node("pipeworks:deployer_on", {
minetest.log("action", "real (6d) facedir: " .. node.param2) minetest.log("action", "real (6d) facedir: " .. node.param2)
end end
end, end,
after_dig_node = tube_scanforobjects, after_dig_node = pipeworks.scan_for_tube_objects,
}) })

View File

@ -1,5 +1,8 @@
-- List of devices that should participate in the autoplace algorithm -- List of devices that should participate in the autoplace algorithm
local pipereceptor_on = nil
local pipereceptor_off = nil
if mesecon then if mesecon then
pipereceptor_on = { pipereceptor_on = {
receptor = { receptor = {
@ -16,7 +19,7 @@ if mesecon then
} }
end end
pipes_devicelist = { local pipes_devicelist = {
"pump", "pump",
"valve", "valve",
"storage_tank_0", "storage_tank_0",
@ -34,28 +37,28 @@ pipes_devicelist = {
-- tables -- tables
pipe_pumpbody = { local pipe_pumpbody = {
{ -7/16, -6/16, -7/16, 7/16, 5/16, 7/16 }, { -7/16, -6/16, -7/16, 7/16, 5/16, 7/16 },
{ -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 } { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }
} }
pipe_valvebody = { local pipe_valvebody = {
{ -4/16, -4/16, -4/16, 4/16, 4/16, 4/16 } { -4/16, -4/16, -4/16, 4/16, 4/16, 4/16 }
} }
pipe_valvehandle_on = { local pipe_valvehandle_on = {
{ -5/16, 4/16, -1/16, 0, 5/16, 1/16 } { -5/16, 4/16, -1/16, 0, 5/16, 1/16 }
} }
pipe_valvehandle_off = { local pipe_valvehandle_off = {
{ -1/16, 4/16, -5/16, 1/16, 5/16, 0 } { -1/16, 4/16, -5/16, 1/16, 5/16, 0 }
} }
pipe_sensorbody = { local pipe_sensorbody = {
{ -3/16, -2/16, -2/16, 3/16, 2/16, 2/16 } { -3/16, -2/16, -2/16, 3/16, 2/16, 2/16 }
} }
spigot_bottomstub = { local spigot_bottomstub = {
{ -2/64, -16/64, -6/64, 2/64, 1/64, 6/64 }, -- pipe segment against -Y face { -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 }, { -4/64, -16/64, -5/64, 4/64, 1/64, 5/64 },
{ -5/64, -16/64, -4/64, 5/64, 1/64, 4/64 }, { -5/64, -16/64, -4/64, 5/64, 1/64, 4/64 },
@ -68,19 +71,17 @@ spigot_bottomstub = {
{ -8/64, -16/64, -3/64, 8/64, -14/64, 3/64 } { -8/64, -16/64, -3/64, 8/64, -14/64, 3/64 }
} }
spigot_stream = { local spigot_stream = {
{ -3/64, (-41/64)-0.01, -5/64, 3/64, -16/64, 5/64 }, { -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 }, { -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 } { -5/64, (-41/64)-0.01, -3/64, 5/64, -16/64, 3/64 }
} }
entry_panel = { local entry_panel = {
{ -8/16, -8/16, -1/16, 8/16, 8/16, 1/16 } { -8/16, -8/16, -1/16, 8/16, 8/16, 1/16 }
} }
local fountainhead_model = {
fountainhead_model = {
{ -2/64, -32/64, -6/64, 2/64, 21/64, 6/64 }, -- main segment { -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 }, { -4/64, -32/64, -5/64, 4/64, 21/64, 5/64 },
{ -5/64, -32/64, -4/64, 5/64, 21/64, 4/64 }, { -5/64, -32/64, -4/64, 5/64, 21/64, 4/64 },
@ -113,8 +114,8 @@ for s in ipairs(states) do
end end
local pumpboxes = {} local pumpboxes = {}
pipeworks_add_pipebox(pumpboxes, pipe_pumpbody) pipeworks.add_pipebox(pumpboxes, pipe_pumpbody)
pipeworks_add_pipebox(pumpboxes, pipe_topstub) pipeworks.add_pipebox(pumpboxes, pipe_topstub)
minetest.register_node("pipeworks:pump_"..states[s], { minetest.register_node("pipeworks:pump_"..states[s], {
description = "Pump/Intake Module", description = "Pump/Intake Module",
@ -141,10 +142,10 @@ for s in ipairs(states) do
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
walkable = true, walkable = true,
after_place_node = function(pos) after_place_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
after_dig_node = function(pos) after_dig_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
drop = "pipeworks:pump_off", drop = "pipeworks:pump_off",
mesecons = {effector = { mesecons = {effector = {
@ -162,14 +163,14 @@ for s in ipairs(states) do
}) })
local valveboxes = {} local valveboxes = {}
pipeworks_add_pipebox(valveboxes, pipe_leftstub) pipeworks.add_pipebox(valveboxes, pipe_leftstub)
pipeworks_add_pipebox(valveboxes, pipe_valvebody) pipeworks.add_pipebox(valveboxes, pipe_valvebody)
if states[s] == "off" then if states[s] == "off" then
pipeworks_add_pipebox(valveboxes, pipe_valvehandle_off) pipeworks.add_pipebox(valveboxes, pipe_valvehandle_off)
else else
pipeworks_add_pipebox(valveboxes, pipe_valvehandle_on) pipeworks.add_pipebox(valveboxes, pipe_valvehandle_on)
end end
pipeworks_add_pipebox(valveboxes, pipe_rightstub) pipeworks.add_pipebox(valveboxes, 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"
@ -199,12 +200,12 @@ for s in ipairs(states) do
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
walkable = true, walkable = true,
after_place_node = function(pos) after_place_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
after_dig_node = function(pos) after_dig_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
drop = "pipeworks:valve_off", drop = "pipeworks:valve_off_empty",
mesecons = {effector = { mesecons = {effector = {
action_on = function (pos, node) action_on = function (pos, node)
minetest.add_node(pos,{name="pipeworks:valve_on_empty", param2 = node.param2}) minetest.add_node(pos,{name="pipeworks:valve_on_empty", param2 = node.param2})
@ -221,10 +222,10 @@ for s in ipairs(states) do
end end
local valveboxes = {} local valveboxes = {}
pipeworks_add_pipebox(valveboxes, pipe_leftstub) pipeworks.add_pipebox(valveboxes, pipe_leftstub)
pipeworks_add_pipebox(valveboxes, pipe_valvebody) pipeworks.add_pipebox(valveboxes, pipe_valvebody)
pipeworks_add_pipebox(valveboxes, pipe_rightstub) pipeworks.add_pipebox(valveboxes, pipe_rightstub)
pipeworks_add_pipebox(valveboxes, pipe_valvehandle_on) pipeworks.add_pipebox(valveboxes, pipe_valvehandle_on)
minetest.register_node("pipeworks:valve_on_loaded", { minetest.register_node("pipeworks:valve_on_loaded", {
description = "Valve", description = "Valve",
@ -252,10 +253,10 @@ minetest.register_node("pipeworks:valve_on_loaded", {
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
walkable = true, walkable = true,
after_place_node = function(pos) after_place_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
after_dig_node = function(pos) after_dig_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
drop = "pipeworks:valve_off_empty", drop = "pipeworks:valve_off_empty",
mesecons = {effector = { mesecons = {effector = {
@ -290,25 +291,25 @@ minetest.register_node("pipeworks:grating", {
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
walkable = true, walkable = true,
after_place_node = function(pos) after_place_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
after_dig_node = function(pos) after_dig_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
}) })
-- outlet spigot -- outlet spigot
local spigotboxes = {} local spigotboxes = {}
pipeworks_add_pipebox(spigotboxes, pipe_backstub) pipeworks.add_pipebox(spigotboxes, pipe_backstub)
pipeworks_add_pipebox(spigotboxes, spigot_bottomstub) pipeworks.add_pipebox(spigotboxes, spigot_bottomstub)
pipeworks_add_pipebox(spigotboxes, pipe_bendsphere) pipeworks.add_pipebox(spigotboxes, pipe_bendsphere)
local spigotboxes_pouring = {} local spigotboxes_pouring = {}
pipeworks_add_pipebox(spigotboxes_pouring, spigot_stream) pipeworks.add_pipebox(spigotboxes_pouring, spigot_stream)
pipeworks_add_pipebox(spigotboxes_pouring, pipe_backstub) pipeworks.add_pipebox(spigotboxes_pouring, pipe_backstub)
pipeworks_add_pipebox(spigotboxes_pouring, spigot_bottomstub) pipeworks.add_pipebox(spigotboxes_pouring, spigot_bottomstub)
pipeworks_add_pipebox(spigotboxes_pouring, pipe_bendsphere) pipeworks.add_pipebox(spigotboxes_pouring, pipe_bendsphere)
minetest.register_node("pipeworks:spigot", { minetest.register_node("pipeworks:spigot", {
description = "Spigot outlet", description = "Spigot outlet",
@ -328,10 +329,10 @@ minetest.register_node("pipeworks:spigot", {
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
walkable = true, walkable = true,
after_place_node = function(pos) after_place_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
after_dig_node = function(pos) after_dig_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
node_box = { node_box = {
type = "fixed", type = "fixed",
@ -389,10 +390,10 @@ minetest.register_node("pipeworks:spigot_pouring", {
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
walkable = true, walkable = true,
after_place_node = function(pos) after_place_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
after_dig_node = function(pos) after_dig_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
node_box = { node_box = {
type = "fixed", type = "fixed",
@ -409,9 +410,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_pipebox(airtightboxes, pipe_frontstub)
pipeworks_add_pipebox(airtightboxes, pipe_backstub) pipeworks.add_pipebox(airtightboxes, pipe_backstub)
pipeworks_add_pipebox(airtightboxes, entry_panel) pipeworks.add_pipebox(airtightboxes, 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",
@ -430,10 +431,10 @@ minetest.register_node("pipeworks:entry_panel_empty", {
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
walkable = true, walkable = true,
after_place_node = function(pos) after_place_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
after_dig_node = function(pos) after_dig_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
node_box = { node_box = {
type = "fixed", type = "fixed",
@ -447,8 +448,8 @@ minetest.register_node("pipeworks:entry_panel_empty", {
} }
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
if not pipeworks_node_is_owned(pointed_thing.under, placer) if not pipeworks.node_is_owned(pointed_thing.under, placer)
and not pipeworks_node_is_owned(pointed_thing.above, placer) then and not pipeworks.node_is_owned(pointed_thing.above, placer) then
local node = minetest.get_node(pointed_thing.under) local node = minetest.get_node(pointed_thing.under)
if not minetest.registered_nodes[node.name] if not minetest.registered_nodes[node.name]
@ -485,7 +486,7 @@ minetest.register_node("pipeworks:entry_panel_empty", {
if not minetest.registered_nodes[minetest.get_node(pos1).name]["buildable_to"] then return end if not minetest.registered_nodes[minetest.get_node(pos1).name]["buildable_to"] then return end
minetest.add_node(pos1, {name = "pipeworks:entry_panel_empty", param2 = fdir }) minetest.add_node(pos1, {name = "pipeworks:entry_panel_empty", param2 = fdir })
pipe_scanforobjects(pos1) pipeworks.scan_for_pipe_objects(pos1)
if not pipeworks_expect_infinite_stacks then if not pipeworks_expect_infinite_stacks then
itemstack:take_item() itemstack:take_item()
@ -516,10 +517,10 @@ minetest.register_node("pipeworks:entry_panel_loaded", {
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
walkable = true, walkable = true,
after_place_node = function(pos) after_place_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
after_dig_node = function(pos) after_dig_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
node_box = { node_box = {
type = "fixed", type = "fixed",
@ -536,9 +537,9 @@ minetest.register_node("pipeworks:entry_panel_loaded", {
}) })
local sensorboxes = {} local sensorboxes = {}
pipeworks_add_pipebox(sensorboxes, pipe_leftstub) pipeworks.add_pipebox(sensorboxes, pipe_leftstub)
pipeworks_add_pipebox(sensorboxes, pipe_sensorbody) pipeworks.add_pipebox(sensorboxes, pipe_sensorbody)
pipeworks_add_pipebox(sensorboxes, pipe_rightstub) pipeworks.add_pipebox(sensorboxes, pipe_rightstub)
minetest.register_node("pipeworks:flow_sensor_empty", { minetest.register_node("pipeworks:flow_sensor_empty", {
description = "Flow Sensor", description = "Flow Sensor",
@ -558,10 +559,10 @@ minetest.register_node("pipeworks:flow_sensor_empty", {
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
walkable = true, walkable = true,
after_place_node = function(pos) after_place_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
after_dig_node = function(pos) after_dig_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
on_construct = function(pos) on_construct = function(pos)
if mesecon then if mesecon then
@ -599,10 +600,10 @@ minetest.register_node("pipeworks:flow_sensor_loaded", {
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
walkable = true, walkable = true,
after_place_node = function(pos) after_place_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
after_dig_node = function(pos) after_dig_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
on_construct = function(pos) on_construct = function(pos)
if mesecon then if mesecon then
@ -626,11 +627,11 @@ minetest.register_node("pipeworks:flow_sensor_loaded", {
-- tanks -- tanks
for fill = 0, 10 do for fill = 0, 10 do
if fill == 0 then local filldesc="empty"
filldesc="empty" local sgroups = {snappy=3, pipe=1, tankfill=fill+1}
sgroups = {snappy=3, pipe=1, tankfill=fill+1} local image = nil
image = nil
else if fill ~= 0 then
filldesc=fill.."0% full" filldesc=fill.."0% full"
sgroups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1} sgroups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1}
image = "pipeworks_storage_tank_fittings.png" image = "pipeworks_storage_tank_fittings.png"
@ -655,10 +656,10 @@ for fill = 0, 10 do
drop = "pipeworks:storage_tank_"..fill, drop = "pipeworks:storage_tank_"..fill,
after_place_node = function(pos) after_place_node = function(pos)
pipe_look_for_stackable_tanks(pos) pipe_look_for_stackable_tanks(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
after_dig_node = function(pos) after_dig_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
}) })
@ -680,10 +681,10 @@ for fill = 0, 10 do
walkable = true, walkable = true,
after_place_node = function(pos) after_place_node = function(pos)
pipe_look_for_stackable_tanks(pos) pipe_look_for_stackable_tanks(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
after_dig_node = function(pos) after_dig_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
}) })
end end
@ -704,10 +705,10 @@ minetest.register_node("pipeworks:fountainhead", {
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
walkable = true, walkable = true,
after_place_node = function(pos) after_place_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
after_dig_node = function(pos) after_dig_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
on_construct = function(pos) on_construct = function(pos)
if mesecon then if mesecon then
@ -738,10 +739,10 @@ minetest.register_node("pipeworks:fountainhead_pouring", {
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
walkable = true, walkable = true,
after_place_node = function(pos) after_place_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
after_dig_node = function(pos) after_dig_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
on_construct = function(pos) on_construct = function(pos)
if mesecon then if mesecon then

View File

@ -6,7 +6,7 @@
local finitewater = minetest.setting_getbool("liquid_finite") local finitewater = minetest.setting_getbool("liquid_finite")
pipeworks_check_for_liquids = function(pos) pipeworks.check_for_liquids = function(pos)
local coords = { local coords = {
{x=pos.x,y=pos.y-1,z=pos.z}, {x=pos.x,y=pos.y-1,z=pos.z},
{x=pos.x,y=pos.y+1,z=pos.z}, {x=pos.x,y=pos.y+1,z=pos.z},
@ -24,7 +24,7 @@ pipeworks_check_for_liquids = function(pos)
return false return false
end end
pipeworks_check_for_inflows = function(pos,node) pipeworks.check_for_inflows = function(pos,node)
local coords = { local coords = {
{x=pos.x,y=pos.y-1,z=pos.z}, {x=pos.x,y=pos.y-1,z=pos.z},
{x=pos.x,y=pos.y+1,z=pos.z}, {x=pos.x,y=pos.y+1,z=pos.z},
@ -37,7 +37,7 @@ pipeworks_check_for_inflows = function(pos,node)
for i =1,6 do for i =1,6 do
if newnode then break end if newnode then break end
local name = minetest.get_node(coords[i]).name local name = minetest.get_node(coords[i]).name
if name and (name == "pipeworks:pump_on" and pipeworks_check_for_liquids(coords[i])) or string.find(name,"_loaded") then if name and (name == "pipeworks:pump_on" and pipeworks.check_for_liquids(coords[i])) or string.find(name,"_loaded") then
if string.find(name,"_loaded") then if string.find(name,"_loaded") then
local source = minetest.get_meta(coords[i]):get_string("source") local source = minetest.get_meta(coords[i]):get_string("source")
if source == minetest.pos_to_string(pos) then break end if source == minetest.pos_to_string(pos) then break end
@ -52,12 +52,12 @@ pipeworks_check_for_inflows = function(pos,node)
end end
end end
pipeworks_check_sources = function(pos,node) pipeworks.check_sources = function(pos,node)
local sourcepos = minetest.string_to_pos(minetest.get_meta(pos):get_string("source")) local sourcepos = minetest.string_to_pos(minetest.get_meta(pos):get_string("source"))
if not sourcepos then return end if not sourcepos then return end
local source = minetest.get_node(sourcepos).name local source = minetest.get_node(sourcepos).name
local newnode = false local newnode = false
if source and not ((source == "pipeworks:pump_on" and pipeworks_check_for_liquids(sourcepos)) or string.find(source,"_loaded") or source == "ignore" ) then if source and not ((source == "pipeworks:pump_on" and pipeworks.check_for_liquids(sourcepos)) or string.find(source,"_loaded") or source == "ignore" ) then
newnode = string.gsub(node.name,"loaded","empty") newnode = string.gsub(node.name,"loaded","empty")
end end
@ -67,7 +67,7 @@ pipeworks_check_sources = function(pos,node)
end end
end end
pipeworks_spigot_check = function(pos, node) pipeworks.spigot_check = function(pos, node)
local belowname = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}).name local belowname = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}).name
if belowname and (belowname == "air" or belowname == "default:water_flowing" or belowname == "default:water_source") then if belowname and (belowname == "air" or belowname == "default:water_flowing" or belowname == "default:water_source") then
local spigotname = minetest.get_node(pos).name local spigotname = minetest.get_node(pos).name
@ -97,7 +97,7 @@ pipeworks_spigot_check = function(pos, node)
end end
end end
pipeworks_fountainhead_check = function(pos, node) pipeworks.fountainhead_check = function(pos, node)
local abovename = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}).name local abovename = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}).name
if abovename and (abovename == "air" or abovename == "default:water_flowing" or abovename == "default:water_source") then if abovename and (abovename == "air" or abovename == "default:water_flowing" or abovename == "default:water_source") then
local fountainhead_name = minetest.get_node(pos).name local fountainhead_name = minetest.get_node(pos).name

View File

@ -36,16 +36,17 @@ else
dofile(pipeworks.worldpath.."/pipeworks_settings.txt") dofile(pipeworks.worldpath.."/pipeworks_settings.txt")
end end
-- Helper functions 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
else
pipeworks_expect_infinite_stacks = true
end end
function pipeworks_fix_image_names(table, replacement) 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}}
outtable={}
-- Helper functions
function pipeworks.fix_image_names(table, replacement)
local outtable={}
for i in ipairs(table) do for i in ipairs(table) do
outtable[i]=string.gsub(table[i], "_XXXXX", replacement) outtable[i]=string.gsub(table[i], "_XXXXX", replacement)
end end
@ -53,13 +54,13 @@ function pipeworks_fix_image_names(table, replacement)
return outtable return outtable
end end
function pipeworks_add_pipebox(t, b) function pipeworks.add_pipebox(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
end end
function pipeworks_node_is_owned(pos, placer) function pipeworks.node_is_owned(pos, placer)
local ownername = false local ownername = false
if type(IsPlayerNodeOwner) == "function" then -- node_ownership mod if type(IsPlayerNodeOwner) == "function" then -- node_ownership mod
if HasOwner(pos, placer) then -- returns true if the node is owned if HasOwner(pos, placer) then -- returns true if the node is owned
@ -92,13 +93,13 @@ function pipeworks_node_is_owned(pos, placer)
end end
end end
function pipeworks_replace_name(tbl,tr,name) function pipeworks.replace_name(tbl,tr,name)
local ntbl={} local ntbl={}
for key,i in pairs(tbl) do for key,i in pairs(tbl) do
if type(i)=="string" then if type(i)=="string" then
ntbl[key]=string.gsub(i,tr,name) ntbl[key]=string.gsub(i,tr,name)
elseif type(i)=="table" then elseif type(i)=="table" then
ntbl[key]=pipeworks_replace_name(i,tr,name) ntbl[key]=pipeworks.replace_name(i,tr,name)
else else
ntbl[key]=i ntbl[key]=i
end end
@ -116,7 +117,7 @@ dofile(pipeworks.modpath.."/crafts.lua")
dofile(pipeworks.modpath.."/tubes.lua") dofile(pipeworks.modpath.."/tubes.lua")
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},
{x=0, y=1, z=1},{x=0, y=1, z=-1},{x=1, y=1, z=0},{x=-1, y=1, z=0}, {x=0, y=1, z=1},{x=0, y=1, z=-1},{x=1, y=1, z=0},{x=-1, y=1, z=0},
{x=0, y=-1, z=1},{x=0, y=-1, z=-1},{x=1, y=-1, z=0},{x=-1, y=-1, z=0}, {x=0, y=-1, z=1},{x=0, y=-1, z=-1},{x=1, y=-1, z=0},{x=-1, y=-1, z=0},
{x=0, y=1, z=0}, {x=0, y=-1, z=0}} {x=0, y=1, z=0}, {x=0, y=-1, z=0}}
@ -131,3 +132,4 @@ if enable_node_breaker then dofile(pipeworks.modpath.."/node_breaker.lua") end
minetest.register_alias("pipeworks:pipe", "pipeworks:pipe_110000_empty") minetest.register_alias("pipeworks:pipe", "pipeworks:pipe_110000_empty")
print("Pipeworks loaded!") print("Pipeworks loaded!")

View File

@ -99,10 +99,10 @@ minetest.register_node("pipeworks:filter", {
return inv:is_empty("main") return inv:is_empty("main")
end, end,
after_place_node = function(pos) after_place_node = function(pos)
tube_scanforobjects(pos) pipeworks.scan_for_tube_objects(pos)
end, end,
after_dig_node = function(pos) after_dig_node = function(pos)
tube_scanforobjects(pos) pipeworks.scan_for_tube_objects(pos)
end, end,
mesecons={effector={action_on=function(pos,node) mesecons={effector={action_on=function(pos,node)
minetest.registered_nodes[node.name].on_punch(pos,node,nil) minetest.registered_nodes[node.name].on_punch(pos,node,nil)
@ -167,10 +167,10 @@ minetest.register_node("pipeworks:mese_filter", {
return inv:is_empty("main") return inv:is_empty("main")
end, end,
after_place_node = function(pos) after_place_node = function(pos)
tube_scanforobjects(pos) pipeworks.scan_for_tube_objects(pos)
end, end,
after_dig_node = function(pos) after_dig_node = function(pos)
tube_scanforobjects(pos) pipeworks.scan_for_tube_objects(pos)
end, end,
mesecons={effector={action_on=function(pos,node) mesecons={effector={action_on=function(pos,node)
minetest.registered_nodes[node.name].on_punch(pos,node,nil) minetest.registered_nodes[node.name].on_punch(pos,node,nil)
@ -390,7 +390,7 @@ end
adjlist={{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}} adjlist={{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}}
function notvel(tbl,vel) function notvel(tbl,vel)
tbl2={} local tbl2={}
for _,val in ipairs(tbl) do for _,val in ipairs(tbl) do
if val.x~=-vel.x or val.y~=-vel.y or val.z~=-vel.z then table.insert(tbl2,val) end if val.x~=-vel.x or val.y~=-vel.y or val.z~=-vel.z then table.insert(tbl2,val) end
end end

View File

@ -14,7 +14,7 @@ minetest.register_craft({
} }
}) })
function hacky_swap_node(pos,name) local function hacky_swap_node(pos,name)
local node=minetest.get_node(pos) local node=minetest.get_node(pos)
local meta=minetest.get_meta(pos) local meta=minetest.get_meta(pos)
local meta0=meta:to_table() local meta0=meta:to_table()
@ -81,26 +81,11 @@ local function dir_to_facedir(dir, is6d)
end end
end end
node_breaker_on = function(pos, node)
if node.name == "pipeworks:nodebreaker_off" then
hacky_swap_node(pos,"pipeworks:nodebreaker_on")
break_node(pos,node.param2)
nodeupdate(pos)
end
end
node_breaker_off = function(pos, node)
if node.name == "pipeworks:nodebreaker_on" then
hacky_swap_node(pos,"pipeworks:nodebreaker_off")
nodeupdate(pos)
end
end
local function delay(x) local function delay(x)
return (function() return x end) return (function() return x end)
end end
function break_node (pos, facedir) local function break_node (pos, facedir)
--locate the outgoing velocity, front, and back of the node via facedir_to_dir --locate the outgoing velocity, front, and back of the node via facedir_to_dir
if type(facedir) ~= "number" or facedir < 0 or facedir > 23 then return end if type(facedir) ~= "number" or facedir < 0 or facedir > 23 then return end
@ -202,6 +187,21 @@ function break_node (pos, facedir)
end end
end end
local node_breaker_on = function(pos, node)
if node.name == "pipeworks:nodebreaker_off" then
hacky_swap_node(pos,"pipeworks:nodebreaker_on")
break_node(pos,node.param2)
nodeupdate(pos)
end
end
local node_breaker_off = function(pos, node)
if node.name == "pipeworks:nodebreaker_on" then
hacky_swap_node(pos,"pipeworks:nodebreaker_off")
nodeupdate(pos)
end
end
minetest.register_node("pipeworks:nodebreaker_off", { minetest.register_node("pipeworks:nodebreaker_off", {
description = "Node Breaker", description = "Node Breaker",
tile_images = {"pipeworks_nodebreaker_top_off.png","pipeworks_nodebreaker_bottom_off.png","pipeworks_nodebreaker_side2_off.png","pipeworks_nodebreaker_side1_off.png", tile_images = {"pipeworks_nodebreaker_top_off.png","pipeworks_nodebreaker_bottom_off.png","pipeworks_nodebreaker_side2_off.png","pipeworks_nodebreaker_side1_off.png",
@ -219,7 +219,7 @@ minetest.register_node("pipeworks:nodebreaker_off", {
inv:set_stack("pick", 1, ItemStack("default:pick_mese")) inv:set_stack("pick", 1, ItemStack("default:pick_mese"))
end, end,
after_place_node = function (pos, placer) after_place_node = function (pos, placer)
tube_scanforobjects(pos, placer) pipeworks.scan_for_tube_objects(pos, placer)
local placer_pos = placer:getpos() local placer_pos = placer:getpos()
--correct for the player's height --correct for the player's height
@ -238,7 +238,7 @@ minetest.register_node("pipeworks:nodebreaker_off", {
minetest.log("action", "real (6d) facedir: " .. node.param2) minetest.log("action", "real (6d) facedir: " .. node.param2)
end end
end, end,
after_dig_node = tube_scanforobjects, after_dig_node = pipeworks.scan_for_tube_objects,
}) })
minetest.register_node("pipeworks:nodebreaker_on", { minetest.register_node("pipeworks:nodebreaker_on", {
@ -258,7 +258,7 @@ minetest.register_node("pipeworks:nodebreaker_on", {
inv:set_stack("pick", 1, ItemStack("default:pick_mese")) inv:set_stack("pick", 1, ItemStack("default:pick_mese"))
end, end,
after_place_node = function (pos, placer) after_place_node = function (pos, placer)
tube_scanforobjects(pos, placer) pipeworks.scan_for_tube_objects(pos, placer)
local placer_pos = placer:getpos() local placer_pos = placer:getpos()
--correct for the player's height --correct for the player's height
@ -277,5 +277,5 @@ minetest.register_node("pipeworks:nodebreaker_on", {
minetest.log("action", "real (6d) facedir: " .. node.param2) minetest.log("action", "real (6d) facedir: " .. node.param2)
end end
end, end,
after_dig_node = tube_scanforobjects, after_dig_node = pipeworks.scan_for_tube_objects,
}) })

View File

@ -111,42 +111,42 @@ for zp = 0, 1 do
local outimgs = {} local outimgs = {}
if yp==1 then if yp==1 then
pipeworks_add_pipebox(outboxes, pipe_topstub) pipeworks.add_pipebox(outboxes, pipe_topstub)
table.insert(outsel, pipe_selectboxes[4]) table.insert(outsel, 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_pipebox(outboxes, pipe_bottomstub)
table.insert(outsel, pipe_selectboxes[3]) table.insert(outsel, 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_pipebox(outboxes, pipe_rightstub)
table.insert(outsel, pipe_selectboxes[2]) table.insert(outsel, 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_pipebox(outboxes, pipe_leftstub)
table.insert(outsel, pipe_selectboxes[1]) table.insert(outsel, 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_pipebox(outboxes, pipe_backstub)
table.insert(outsel, pipe_selectboxes[6]) table.insert(outsel, 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_pipebox(outboxes, pipe_frontstub)
table.insert(outsel, pipe_selectboxes[5]) table.insert(outsel, pipe_selectboxes[5])
table.insert(outimgs, "pipeworks_pipe_end.png") table.insert(outimgs, "pipeworks_pipe_end.png")
else else
@ -185,7 +185,7 @@ 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_pipebox(outboxes, pipe_bendsphere)
end end
if (jx==2 and jy~=2 and jz~=2) then if (jx==2 and jy~=2 and jz~=2) then
@ -218,7 +218,7 @@ for zp = 0, 1 do
minetest.register_node("pipeworks:pipe_"..pname.."_empty", { minetest.register_node("pipeworks:pipe_"..pname.."_empty", {
description = pipedesc, description = pipedesc,
drawtype = "nodebox", drawtype = "nodebox",
tiles = pipeworks_fix_image_names(outimgs, "_empty"), tiles = pipeworks.fix_image_names(outimgs, "_empty"),
inventory_image = image, inventory_image = image,
sunlight_propagates=true, sunlight_propagates=true,
paramtype = "light", paramtype = "light",
@ -235,17 +235,17 @@ for zp = 0, 1 do
walkable = true, walkable = true,
drop = "pipeworks:pipe_110000_empty", drop = "pipeworks:pipe_110000_empty",
after_place_node = function(pos) after_place_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
after_dig_node = function(pos) after_dig_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
}) })
minetest.register_node("pipeworks:pipe_"..pname.."_loaded", { minetest.register_node("pipeworks:pipe_"..pname.."_loaded", {
description = "Pipe segment (loaded, "..pname..")... You hacker, you.", description = "Pipe segment (loaded, "..pname..")... You hacker, you.",
drawtype = "nodebox", drawtype = "nodebox",
tiles = pipeworks_fix_image_names(outimgs, "_loaded"), tiles = pipeworks.fix_image_names(outimgs, "_loaded"),
inventory_image = image, inventory_image = image,
sunlight_propagates = true, sunlight_propagates = true,
paramtype = "light", paramtype = "light",
@ -262,10 +262,10 @@ for zp = 0, 1 do
walkable = true, walkable = true,
drop = "pipeworks:pipe_110000_empty", drop = "pipeworks:pipe_110000_empty",
after_place_node = function(pos) after_place_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
after_dig_node = function(pos) after_dig_node = function(pos)
pipe_scanforobjects(pos) pipeworks.scan_for_pipe_objects(pos)
end end
}) })
table.insert(pipes_empty_nodenames,"pipeworks:pipe_"..pname.."_empty") -- for the abms table.insert(pipes_empty_nodenames,"pipeworks:pipe_"..pname.."_empty") -- for the abms
@ -291,7 +291,7 @@ minetest.register_abm({
interval = 1, interval = 1,
chance = 1, chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
pipeworks_check_for_inflows(pos,node) pipeworks.check_for_inflows(pos,node)
end end
}) })
@ -300,7 +300,7 @@ minetest.register_abm({
interval = 1, interval = 1,
chance = 1, chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
pipeworks_check_sources(pos,node) pipeworks.check_sources(pos,node)
end end
}) })
@ -309,7 +309,7 @@ minetest.register_abm({
interval = 1, interval = 1,
chance = 1, chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
pipeworks_spigot_check(pos,node) pipeworks.spigot_check(pos,node)
end end
}) })
@ -318,7 +318,7 @@ minetest.register_abm({
interval = 1, interval = 1,
chance = 1, chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
pipeworks_fountainhead_check(pos,node) pipeworks.fountainhead_check(pos,node)
end end
}) })

View File

@ -1,7 +1,7 @@
filename=minetest.get_worldpath() .. "/teleport_tubes" local filename=minetest.get_worldpath() .. "/teleport_tubes"
function read_file() local function read_file()
local f = io.open(filename, "r") local f = io.open(filename, "r")
if f==nil then return {} end if f==nil then return {} end
local t = f:read("*all") local t = f:read("*all")
@ -10,14 +10,14 @@ function read_file()
return minetest.deserialize(t) return minetest.deserialize(t)
end end
function write_file(tbl) local function write_file(tbl)
local f = io.open(filename, "w") local f = io.open(filename, "w")
f:write(minetest.serialize(tbl)) f:write(minetest.serialize(tbl))
f:close() f:close()
end end
function add_tube_in_file(pos,channel, cr) local function add_tube_in_file(pos,channel, cr)
tbl=read_file() local tbl=read_file()
for _,val in ipairs(tbl) do for _,val in ipairs(tbl) do
if val.x==pos.x and val.y==pos.y and val.z==pos.z then if val.x==pos.x and val.y==pos.y and val.z==pos.z then
return return
@ -27,9 +27,9 @@ function add_tube_in_file(pos,channel, cr)
write_file(tbl) write_file(tbl)
end end
function remove_tube_in_file(pos) local function remove_tube_in_file(pos)
tbl=read_file() local tbl=read_file()
newtbl={} local newtbl={}
for _,val in ipairs(tbl) do for _,val in ipairs(tbl) do
if val.x~=pos.x or val.y~=pos.y or val.z~=pos.z then if val.x~=pos.x or val.y~=pos.y or val.z~=pos.z then
table.insert(newtbl,val) table.insert(newtbl,val)
@ -38,10 +38,10 @@ function remove_tube_in_file(pos)
write_file(newtbl) write_file(newtbl)
end end
function get_tubes_in_file(pos,channel) local function get_tubes_in_file(pos,channel)
tbl=read_file() local tbl=read_file()
newtbl={} local newtbl={}
changed=false local changed=false
for _,val in ipairs(tbl) do for _,val in ipairs(tbl) do
local node = minetest.get_node(val) local node = minetest.get_node(val)
local meta = minetest.get_meta(val) local meta = minetest.get_meta(val)
@ -58,14 +58,14 @@ function get_tubes_in_file(pos,channel)
return newtbl return newtbl
end end
teleport_noctr_textures={"pipeworks_teleport_tube_noctr.png","pipeworks_teleport_tube_noctr.png","pipeworks_teleport_tube_noctr.png", local teleport_noctr_textures={"pipeworks_teleport_tube_noctr.png","pipeworks_teleport_tube_noctr.png","pipeworks_teleport_tube_noctr.png",
"pipeworks_teleport_tube_noctr.png","pipeworks_teleport_tube_noctr.png","pipeworks_teleport_tube_noctr.png"} "pipeworks_teleport_tube_noctr.png","pipeworks_teleport_tube_noctr.png","pipeworks_teleport_tube_noctr.png"}
teleport_plain_textures={"pipeworks_teleport_tube_plain.png","pipeworks_teleport_tube_plain.png","pipeworks_teleport_tube_plain.png", local teleport_plain_textures={"pipeworks_teleport_tube_plain.png","pipeworks_teleport_tube_plain.png","pipeworks_teleport_tube_plain.png",
"pipeworks_teleport_tube_plain.png","pipeworks_teleport_tube_plain.png","pipeworks_teleport_tube_plain.png"} "pipeworks_teleport_tube_plain.png","pipeworks_teleport_tube_plain.png","pipeworks_teleport_tube_plain.png"}
teleport_end_textures={"pipeworks_teleport_tube_end.png","pipeworks_teleport_tube_end.png","pipeworks_teleport_tube_end.png", local teleport_end_textures={"pipeworks_teleport_tube_end.png","pipeworks_teleport_tube_end.png","pipeworks_teleport_tube_end.png",
"pipeworks_teleport_tube_end.png","pipeworks_teleport_tube_end.png","pipeworks_teleport_tube_end.png"} "pipeworks_teleport_tube_end.png","pipeworks_teleport_tube_end.png","pipeworks_teleport_tube_end.png"}
teleport_short_texture="pipeworks_teleport_tube_short.png" local teleport_short_texture="pipeworks_teleport_tube_short.png"
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, 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,
@ -81,7 +81,7 @@ register_tube("pipeworks:teleport_tube","Teleporter pneumatic tube segment",tele
pos.x=target[d].x pos.x=target[d].x
pos.y=target[d].y pos.y=target[d].y
pos.z=target[d].z pos.z=target[d].z
return meseadjlist return pipeworks.meseadjlist
end}, end},
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)

190
tubes.lua
View File

@ -6,32 +6,32 @@ tubenodes={}
minetest.register_alias("pipeworks:tube", "pipeworks:tube_000000") minetest.register_alias("pipeworks:tube", "pipeworks:tube_000000")
tube_leftstub = { local tube_leftstub = {
{ -32/64, -9/64, -9/64, 9/64, 9/64, 9/64 }, -- tube segment against -X face { -32/64, -9/64, -9/64, 9/64, 9/64, 9/64 }, -- tube segment against -X face
} }
tube_rightstub = { local tube_rightstub = {
{ -9/64, -9/64, -9/64, 32/64, 9/64, 9/64 }, -- tube segment against +X face { -9/64, -9/64, -9/64, 32/64, 9/64, 9/64 }, -- tube segment against +X face
} }
tube_bottomstub = { local tube_bottomstub = {
{ -9/64, -32/64, -9/64, 9/64, 9/64, 9/64 }, -- tube segment against -Y face { -9/64, -32/64, -9/64, 9/64, 9/64, 9/64 }, -- tube segment against -Y face
} }
tube_topstub = { local tube_topstub = {
{ -9/64, -9/64, -9/64, 9/64, 32/64, 9/64 }, -- tube segment against +Y face { -9/64, -9/64, -9/64, 9/64, 32/64, 9/64 }, -- tube segment against +Y face
} }
tube_frontstub = { local tube_frontstub = {
{ -9/64, -9/64, -32/64, 9/64, 9/64, 9/64 }, -- tube segment against -Z face { -9/64, -9/64, -32/64, 9/64, 9/64, 9/64 }, -- tube segment against -Z face
} }
tube_backstub = { local tube_backstub = {
{ -9/64, -9/64, -9/64, 9/64, 9/64, 32/64 }, -- tube segment against -Z face { -9/64, -9/64, -9/64, 9/64, 9/64, 32/64 }, -- tube segment against -Z face
} }
tube_selectboxes = { local tube_selectboxes = {
{ -32/64, -10/64, -10/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 , -10/64, -10/64, 32/64, 10/64, 10/64 },
{ -10/64 , -32/64, -10/64, 10/64, 10/64, 10/64 }, { -10/64 , -32/64, -10/64, 10/64, 10/64, 10/64 },
@ -42,14 +42,15 @@ tube_selectboxes = {
-- Functions -- Functions
function tube_addbox(t, b) local function tube_addbox(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
end end
-- now define the nodes! -- now, a function to define the tubes
function register_tube(name,desc,plain_textures,noctr_textures,end_textures,short_texture,inv_texture,special)
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
@ -63,44 +64,44 @@ for zp = 0, 1 do
if yp==1 then if yp==1 then
tube_addbox(outboxes, tube_topstub) tube_addbox(outboxes, tube_topstub)
table.insert(outsel, tube_selectboxes[4]) table.insert(outsel, tube_selectboxes[4])
table.insert(outimgs, noctr_textures[4]) table.insert(outimgs, noctrs[4])
else else
table.insert(outimgs, plain_textures[4]) table.insert(outimgs, plain[4])
end end
if ym==1 then if ym==1 then
tube_addbox(outboxes, tube_bottomstub) tube_addbox(outboxes, tube_bottomstub)
table.insert(outsel, tube_selectboxes[3]) table.insert(outsel, tube_selectboxes[3])
table.insert(outimgs, noctr_textures[3]) table.insert(outimgs, noctrs[3])
else else
table.insert(outimgs, plain_textures[3]) table.insert(outimgs, plain[3])
end end
if xp==1 then if xp==1 then
tube_addbox(outboxes, tube_rightstub) tube_addbox(outboxes, tube_rightstub)
table.insert(outsel, tube_selectboxes[2]) table.insert(outsel, tube_selectboxes[2])
table.insert(outimgs, noctr_textures[2]) table.insert(outimgs, noctrs[2])
else else
table.insert(outimgs, plain_textures[2]) table.insert(outimgs, plain[2])
end end
if xm==1 then if xm==1 then
tube_addbox(outboxes, tube_leftstub) tube_addbox(outboxes, tube_leftstub)
table.insert(outsel, tube_selectboxes[1]) table.insert(outsel, tube_selectboxes[1])
table.insert(outimgs, noctr_textures[1]) table.insert(outimgs, noctrs[1])
else else
table.insert(outimgs, plain_textures[1]) table.insert(outimgs, plain[1])
end end
if zp==1 then if zp==1 then
tube_addbox(outboxes, tube_backstub) tube_addbox(outboxes, tube_backstub)
table.insert(outsel, tube_selectboxes[6]) table.insert(outsel, tube_selectboxes[6])
table.insert(outimgs, noctr_textures[6]) table.insert(outimgs, noctrs[6])
else else
table.insert(outimgs, plain_textures[6]) table.insert(outimgs, plain[6])
end end
if zm==1 then if zm==1 then
tube_addbox(outboxes, tube_frontstub) tube_addbox(outboxes, tube_frontstub)
table.insert(outsel, tube_selectboxes[5]) table.insert(outsel, tube_selectboxes[5])
table.insert(outimgs, noctr_textures[5]) table.insert(outimgs, noctrs[5])
else else
table.insert(outimgs, plain_textures[5]) table.insert(outimgs, plain[5])
end end
local jx = xp+xm local jx = xp+xm
@ -110,46 +111,45 @@ for zp = 0, 1 do
if (jx+jy+jz) == 1 then if (jx+jy+jz) == 1 then
if xm == 1 then if xm == 1 then
table.remove(outimgs, 3) table.remove(outimgs, 3)
table.insert(outimgs, 3, end_textures[3]) table.insert(outimgs, 3, ends[3])
end end
if xp == 1 then if xp == 1 then
table.remove(outimgs, 4) table.remove(outimgs, 4)
table.insert(outimgs, 4, end_textures[4]) table.insert(outimgs, 4, ends[4])
end end
if ym == 1 then if ym == 1 then
table.remove(outimgs, 1) table.remove(outimgs, 1)
table.insert(outimgs, 1, end_textures[1]) table.insert(outimgs, 1, ends[1])
end end
if xp == 1 then if xp == 1 then
table.remove(outimgs, 2) table.remove(outimgs, 2)
table.insert(outimgs, 2, end_textures[2]) table.insert(outimgs, 2, ends[2])
end end
if zm == 1 then if zm == 1 then
table.remove(outimgs, 5) table.remove(outimgs, 5)
table.insert(outimgs, 5, end_textures[5]) table.insert(outimgs, 5, ends[5])
end end
if zp == 1 then if zp == 1 then
table.remove(outimgs, 6) table.remove(outimgs, 6)
table.insert(outimgs, 6, end_textures[6]) table.insert(outimgs, 6, ends[6])
end end
end end
local tname = xm..xp..ym..yp..zm..zp local tname = xm..xp..ym..yp..zm..zp
local tgroups = ""
if tname ~= "000000" then local tgroups = {snappy=3, tube=1, not_in_creative_inventory=1}
tgroups = {snappy=3, tube=1, not_in_creative_inventory=1} local tubedesc = desc.." ("..tname..")... You hacker, you."
tubedesc = desc.." ("..tname..")... You hacker, you." local iimg=plain[1]
iimg=plain_textures[1] local wscale = {x=1,y=1,z=1}
wscale = {x=1,y=1,z=1}
else if tname == "000000" then
tgroups = {snappy=3, tube=1} tgroups = {snappy=3, tube=1}
tubedesc = desc tubedesc = desc
iimg=inv_texture iimg=inv
outimgs = { outimgs = {
short_texture,short_texture, short,short,
end_textures[3],end_textures[4], ends[3],ends[4],
short_texture,short_texture short,short
} }
outboxes = { -24/64, -9/64, -9/64, 24/64, 9/64, 9/64 } 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 } outsel = { -24/64, -10/64, -10/64, 24/64, 10/64, 10/64 }
@ -158,10 +158,11 @@ for zp = 0, 1 do
table.insert(tubenodes,name.."_"..tname) table.insert(tubenodes,name.."_"..tname)
nodedef={ local nodedef={
description = tubedesc, description = tubedesc,
drawtype = "nodebox", drawtype = "nodebox",
tiles = outimgs, tiles = outimgs,
sunlight_propagates = true,
inventory_image=iimg, inventory_image=iimg,
wield_image=iimg, wield_image=iimg,
wield_scale=wscale, wield_scale=wscale,
@ -189,13 +190,13 @@ for zp = 0, 1 do
end end
end, end,
after_place_node = function(pos) after_place_node = function(pos)
tube_scanforobjects(pos) pipeworks.scan_for_tube_objects(pos)
if minetest.registered_nodes[name.."_"..tname].after_place_node_ then if minetest.registered_nodes[name.."_"..tname].after_place_node_ then
minetest.registered_nodes[name.."_"..tname].after_place_node_(pos) minetest.registered_nodes[name.."_"..tname].after_place_node_(pos)
end end
end, end,
after_dig_node = function(pos) after_dig_node = function(pos)
tube_scanforobjects(pos) pipeworks.scan_for_tube_objects(pos)
if minetest.registered_nodes[name.."_"..tname].after_dig_node_ then if minetest.registered_nodes[name.."_"..tname].after_dig_node_ then
minetest.registered_nodes[name.."_"..tname].after_dig_node_(pos) minetest.registered_nodes[name.."_"..tname].after_dig_node_(pos)
end end
@ -216,7 +217,7 @@ for zp = 0, 1 do
nodedef.tube[key]=val nodedef.tube[key]=val
end end
elseif type(value)=="table" then elseif type(value)=="table" then
nodedef[key]=pipeworks_replace_name(value,"#id",tname) nodedef[key]=pipeworks.replace_name(value,"#id",tname)
elseif type(value)=="string" then elseif type(value)=="string" then
nodedef[key]=string.gsub(value,"#id",tname) nodedef[key]=string.gsub(value,"#id",tname)
else else
@ -237,31 +238,30 @@ end
end end
end end
-- now let's actually call that function to get the real work done!
noctr_textures={"pipeworks_tube_noctr.png","pipeworks_tube_noctr.png","pipeworks_tube_noctr.png", local noctr_textures={"pipeworks_tube_noctr.png","pipeworks_tube_noctr.png","pipeworks_tube_noctr.png",
"pipeworks_tube_noctr.png","pipeworks_tube_noctr.png","pipeworks_tube_noctr.png"} "pipeworks_tube_noctr.png","pipeworks_tube_noctr.png","pipeworks_tube_noctr.png"}
plain_textures={"pipeworks_tube_plain.png","pipeworks_tube_plain.png","pipeworks_tube_plain.png", local plain_textures={"pipeworks_tube_plain.png","pipeworks_tube_plain.png","pipeworks_tube_plain.png",
"pipeworks_tube_plain.png","pipeworks_tube_plain.png","pipeworks_tube_plain.png"} "pipeworks_tube_plain.png","pipeworks_tube_plain.png","pipeworks_tube_plain.png"}
end_textures={"pipeworks_tube_end.png","pipeworks_tube_end.png","pipeworks_tube_end.png", local end_textures={"pipeworks_tube_end.png","pipeworks_tube_end.png","pipeworks_tube_end.png",
"pipeworks_tube_end.png","pipeworks_tube_end.png","pipeworks_tube_end.png"} "pipeworks_tube_end.png","pipeworks_tube_end.png","pipeworks_tube_end.png"}
short_texture="pipeworks_tube_short.png" local short_texture="pipeworks_tube_short.png"
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) register_tube("pipeworks:tube","Pneumatic tube segment",plain_textures,noctr_textures,end_textures,short_texture,inv_texture)
if enable_mese_tube then
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",
"pipeworks_mese_tube_noctr_4.png","pipeworks_mese_tube_noctr_5.png","pipeworks_mese_tube_noctr_6.png"} "pipeworks_mese_tube_noctr_4.png","pipeworks_mese_tube_noctr_5.png","pipeworks_mese_tube_noctr_6.png"}
mese_plain_textures={"pipeworks_mese_tube_plain_1.png","pipeworks_mese_tube_plain_2.png","pipeworks_mese_tube_plain_3.png", local mese_plain_textures={"pipeworks_mese_tube_plain_1.png","pipeworks_mese_tube_plain_2.png","pipeworks_mese_tube_plain_3.png",
"pipeworks_mese_tube_plain_4.png","pipeworks_mese_tube_plain_5.png","pipeworks_mese_tube_plain_6.png"} "pipeworks_mese_tube_plain_4.png","pipeworks_mese_tube_plain_5.png","pipeworks_mese_tube_plain_6.png"}
mese_end_textures={"pipeworks_mese_tube_end.png","pipeworks_mese_tube_end.png","pipeworks_mese_tube_end.png", local mese_end_textures={"pipeworks_mese_tube_end.png","pipeworks_mese_tube_end.png","pipeworks_mese_tube_end.png",
"pipeworks_mese_tube_end.png","pipeworks_mese_tube_end.png","pipeworks_mese_tube_end.png"} "pipeworks_mese_tube_end.png","pipeworks_mese_tube_end.png","pipeworks_mese_tube_end.png"}
mese_short_texture="pipeworks_mese_tube_short.png" local mese_short_texture="pipeworks_mese_tube_short.png"
mese_inv_texture="pipeworks_mese_tube_inv.png" local mese_inv_texture="pipeworks_mese_tube_inv.png"
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}}
if enable_mese_tube then
register_tube("pipeworks:mese_tube","Mese pneumatic tube segment",mese_plain_textures,mese_noctr_textures, 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)
@ -270,7 +270,7 @@ if enable_mese_tube then
local inv=meta:get_inventory() local inv=meta:get_inventory()
local found=false local found=false
local name=stack:get_name() local name=stack:get_name()
for i,vect in ipairs(meseadjlist) do for i,vect in ipairs(pipeworks.meseadjlist) do
if meta:get_int("l"..tostring(i).."s")==1 then if meta:get_int("l"..tostring(i).."s")==1 then
for _,st in ipairs(inv:get_list("line"..tostring(i))) do for _,st in ipairs(inv:get_list("line"..tostring(i))) do
if st:get_name()==name then if st:get_name()==name then
@ -281,7 +281,7 @@ if enable_mese_tube then
end end
end end
if found==false then if found==false then
for i,vect in ipairs(meseadjlist) do for i,vect in ipairs(pipeworks.meseadjlist) do
if meta:get_int("l"..tostring(i).."s")==1 then if meta:get_int("l"..tostring(i).."s")==1 then
if inv:is_empty("line"..tostring(i)) then if inv:is_empty("line"..tostring(i)) then
table.insert(tbl,vect) table.insert(tbl,vect)
@ -362,14 +362,14 @@ if enable_mese_tube then
}) })
end end
mesecons_rules={{x=0,y=0,z=1},{x=0,y=0,z=-1},{x=1,y=0,z=0},{x=-1,y=0,z=0},{x=0,y=1,z=0},{x=0,y=-1,z=0}} local mesecons_rules={{x=0,y=0,z=1},{x=0,y=0,z=-1},{x=1,y=0,z=0},{x=-1,y=0,z=0},{x=0,y=1,z=0},{x=0,y=-1,z=0}}
if enable_detector_tube then if enable_detector_tube then
detector_plain_textures={"pipeworks_detector_tube_plain.png","pipeworks_detector_tube_plain.png","pipeworks_detector_tube_plain.png", local detector_plain_textures={"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"} "pipeworks_detector_tube_plain.png","pipeworks_detector_tube_plain.png","pipeworks_detector_tube_plain.png"}
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, 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,
@ -379,7 +379,7 @@ if enable_detector_tube then
local nitems=meta:get_int("nitems")+1 local nitems=meta:get_int("nitems")+1
meta:set_int("nitems", nitems) meta:set_int("nitems", nitems)
minetest.after(0.1,minetest.registered_nodes[name].item_exit,pos) minetest.after(0.1,minetest.registered_nodes[name].item_exit,pos)
return notvel(meseadjlist,velocity) return notvel(pipeworks.meseadjlist,velocity)
end}, end},
groups={mesecon=2,not_in_creative_inventory=1}, groups={mesecon=2,not_in_creative_inventory=1},
drop="pipeworks:detector_tube_off_000000", drop="pipeworks:detector_tube_off_000000",
@ -409,7 +409,7 @@ if enable_detector_tube then
local name = minetest.get_node(pos).name local name = minetest.get_node(pos).name
minetest.set_node(pos,{name=string.gsub(name,"off","on")}) minetest.set_node(pos,{name=string.gsub(name,"off","on")})
mesecon:receptor_on(pos,mesecons_rules) mesecon:receptor_on(pos,mesecons_rules)
return notvel(meseadjlist,velocity) return notvel(pipeworks.meseadjlist,velocity)
end}, end},
groups={mesecon=2}, groups={mesecon=2},
mesecons={receptor={state="off", mesecons={receptor={state="off",
@ -417,24 +417,23 @@ if enable_detector_tube then
}) })
end end
if enable_conductor_tube then local conductor_plain_textures={"pipeworks_conductor_tube_plain.png","pipeworks_conductor_tube_plain.png","pipeworks_conductor_tube_plain.png",
conductor_plain_textures={"pipeworks_conductor_tube_plain.png","pipeworks_conductor_tube_plain.png","pipeworks_conductor_tube_plain.png",
"pipeworks_conductor_tube_plain.png","pipeworks_conductor_tube_plain.png","pipeworks_conductor_tube_plain.png"} "pipeworks_conductor_tube_plain.png","pipeworks_conductor_tube_plain.png","pipeworks_conductor_tube_plain.png"}
conductor_noctr_textures={"pipeworks_conductor_tube_noctr.png","pipeworks_conductor_tube_noctr.png","pipeworks_conductor_tube_noctr.png", local conductor_noctr_textures={"pipeworks_conductor_tube_noctr.png","pipeworks_conductor_tube_noctr.png","pipeworks_conductor_tube_noctr.png",
"pipeworks_conductor_tube_noctr.png","pipeworks_conductor_tube_noctr.png","pipeworks_conductor_tube_noctr.png"} "pipeworks_conductor_tube_noctr.png","pipeworks_conductor_tube_noctr.png","pipeworks_conductor_tube_noctr.png"}
conductor_end_textures={"pipeworks_conductor_tube_end.png","pipeworks_conductor_tube_end.png","pipeworks_conductor_tube_end.png", local conductor_end_textures={"pipeworks_conductor_tube_end.png","pipeworks_conductor_tube_end.png","pipeworks_conductor_tube_end.png",
"pipeworks_conductor_tube_end.png","pipeworks_conductor_tube_end.png","pipeworks_conductor_tube_end.png"} "pipeworks_conductor_tube_end.png","pipeworks_conductor_tube_end.png","pipeworks_conductor_tube_end.png"}
conductor_short_texture="pipeworks_conductor_tube_short.png" local conductor_short_texture="pipeworks_conductor_tube_short.png"
conductor_inv_texture="pipeworks_conductor_tube_inv.png" local conductor_inv_texture="pipeworks_conductor_tube_inv.png"
conductor_on_plain_textures={"pipeworks_conductor_tube_on_plain.png","pipeworks_conductor_tube_on_plain.png","pipeworks_conductor_tube_on_plain.png", local conductor_on_plain_textures={"pipeworks_conductor_tube_on_plain.png","pipeworks_conductor_tube_on_plain.png","pipeworks_conductor_tube_on_plain.png",
"pipeworks_conductor_tube_on_plain.png","pipeworks_conductor_tube_on_plain.png","pipeworks_conductor_tube_on_plain.png"} "pipeworks_conductor_tube_on_plain.png","pipeworks_conductor_tube_on_plain.png","pipeworks_conductor_tube_on_plain.png"}
conductor_on_noctr_textures={"pipeworks_conductor_tube_on_noctr.png","pipeworks_conductor_tube_on_noctr.png","pipeworks_conductor_tube_on_noctr.png", local conductor_on_noctr_textures={"pipeworks_conductor_tube_on_noctr.png","pipeworks_conductor_tube_on_noctr.png","pipeworks_conductor_tube_on_noctr.png",
"pipeworks_conductor_tube_on_noctr.png","pipeworks_conductor_tube_on_noctr.png","pipeworks_conductor_tube_on_noctr.png"} "pipeworks_conductor_tube_on_noctr.png","pipeworks_conductor_tube_on_noctr.png","pipeworks_conductor_tube_on_noctr.png"}
conductor_on_end_textures={"pipeworks_conductor_tube_on_end.png","pipeworks_conductor_tube_on_end.png","pipeworks_conductor_tube_on_end.png", local conductor_on_end_textures={"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"} "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, 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},
@ -453,22 +452,21 @@ if enable_conductor_tube then
}) })
end end
if enable_accelerator_tube then local accelerator_noctr_textures={"pipeworks_accelerator_tube_noctr.png","pipeworks_accelerator_tube_noctr.png","pipeworks_accelerator_tube_noctr.png",
accelerator_noctr_textures={"pipeworks_accelerator_tube_noctr.png","pipeworks_accelerator_tube_noctr.png","pipeworks_accelerator_tube_noctr.png",
"pipeworks_accelerator_tube_noctr.png","pipeworks_accelerator_tube_noctr.png","pipeworks_accelerator_tube_noctr.png"} "pipeworks_accelerator_tube_noctr.png","pipeworks_accelerator_tube_noctr.png","pipeworks_accelerator_tube_noctr.png"}
accelerator_plain_textures={"pipeworks_accelerator_tube_plain.png","pipeworks_accelerator_tube_plain.png","pipeworks_accelerator_tube_plain.png", local accelerator_plain_textures={"pipeworks_accelerator_tube_plain.png","pipeworks_accelerator_tube_plain.png","pipeworks_accelerator_tube_plain.png",
"pipeworks_accelerator_tube_plain.png","pipeworks_accelerator_tube_plain.png","pipeworks_accelerator_tube_plain.png"} "pipeworks_accelerator_tube_plain.png","pipeworks_accelerator_tube_plain.png","pipeworks_accelerator_tube_plain.png"}
accelerator_end_textures={"pipeworks_accelerator_tube_end.png","pipeworks_accelerator_tube_end.png","pipeworks_accelerator_tube_end.png", local accelerator_end_textures={"pipeworks_accelerator_tube_end.png","pipeworks_accelerator_tube_end.png","pipeworks_accelerator_tube_end.png",
"pipeworks_accelerator_tube_end.png","pipeworks_accelerator_tube_end.png","pipeworks_accelerator_tube_end.png"} "pipeworks_accelerator_tube_end.png","pipeworks_accelerator_tube_end.png","pipeworks_accelerator_tube_end.png"}
accelerator_short_texture="pipeworks_accelerator_tube_short.png" local accelerator_short_texture="pipeworks_accelerator_tube_short.png"
accelerator_inv_texture="pipeworks_accelerator_tube_inv.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, 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
return notvel(meseadjlist,velocity) return notvel(pipeworks.meseadjlist,velocity)
end} end}
}) })
end end
@ -482,17 +480,16 @@ if enable_crossing_tube then
}) })
end end
if enable_sand_tube then local sand_noctr_textures={"pipeworks_sand_tube_noctr.png","pipeworks_sand_tube_noctr.png","pipeworks_sand_tube_noctr.png",
sand_noctr_textures={"pipeworks_sand_tube_noctr.png","pipeworks_sand_tube_noctr.png","pipeworks_sand_tube_noctr.png",
"pipeworks_sand_tube_noctr.png","pipeworks_sand_tube_noctr.png","pipeworks_sand_tube_noctr.png"} "pipeworks_sand_tube_noctr.png","pipeworks_sand_tube_noctr.png","pipeworks_sand_tube_noctr.png"}
sand_plain_textures={"pipeworks_sand_tube_plain.png","pipeworks_sand_tube_plain.png","pipeworks_sand_tube_plain.png", local sand_plain_textures={"pipeworks_sand_tube_plain.png","pipeworks_sand_tube_plain.png","pipeworks_sand_tube_plain.png",
"pipeworks_sand_tube_plain.png","pipeworks_sand_tube_plain.png","pipeworks_sand_tube_plain.png"} "pipeworks_sand_tube_plain.png","pipeworks_sand_tube_plain.png","pipeworks_sand_tube_plain.png"}
sand_end_textures={"pipeworks_sand_tube_end.png","pipeworks_sand_tube_end.png","pipeworks_sand_tube_end.png", local sand_end_textures={"pipeworks_sand_tube_end.png","pipeworks_sand_tube_end.png","pipeworks_sand_tube_end.png",
"pipeworks_sand_tube_end.png","pipeworks_sand_tube_end.png","pipeworks_sand_tube_end.png"} "pipeworks_sand_tube_end.png","pipeworks_sand_tube_end.png","pipeworks_sand_tube_end.png"}
sand_short_texture="pipeworks_sand_tube_short.png" local sand_short_texture="pipeworks_sand_tube_short.png"
sand_inv_texture="pipeworks_sand_tube_inv.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, 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}})
@ -515,17 +512,16 @@ if enable_sand_tube then
}) })
end end
if enable_mese_sand_tube then local mese_sand_noctr_textures={"pipeworks_mese_sand_tube_noctr.png","pipeworks_mese_sand_tube_noctr.png","pipeworks_mese_sand_tube_noctr.png",
mese_sand_noctr_textures={"pipeworks_mese_sand_tube_noctr.png","pipeworks_mese_sand_tube_noctr.png","pipeworks_mese_sand_tube_noctr.png",
"pipeworks_mese_sand_tube_noctr.png","pipeworks_mese_sand_tube_noctr.png","pipeworks_mese_sand_tube_noctr.png"} "pipeworks_mese_sand_tube_noctr.png","pipeworks_mese_sand_tube_noctr.png","pipeworks_mese_sand_tube_noctr.png"}
mese_sand_plain_textures={"pipeworks_mese_sand_tube_plain.png","pipeworks_mese_sand_tube_plain.png","pipeworks_mese_sand_tube_plain.png", local mese_sand_plain_textures={"pipeworks_mese_sand_tube_plain.png","pipeworks_mese_sand_tube_plain.png","pipeworks_mese_sand_tube_plain.png",
"pipeworks_mese_sand_tube_plain.png","pipeworks_mese_sand_tube_plain.png","pipeworks_mese_sand_tube_plain.png"} "pipeworks_mese_sand_tube_plain.png","pipeworks_mese_sand_tube_plain.png","pipeworks_mese_sand_tube_plain.png"}
mese_sand_end_textures={"pipeworks_mese_sand_tube_end.png","pipeworks_mese_sand_tube_end.png","pipeworks_mese_sand_tube_end.png", local mese_sand_end_textures={"pipeworks_mese_sand_tube_end.png","pipeworks_mese_sand_tube_end.png","pipeworks_mese_sand_tube_end.png",
"pipeworks_mese_sand_tube_end.png","pipeworks_mese_sand_tube_end.png","pipeworks_mese_sand_tube_end.png"} "pipeworks_mese_sand_tube_end.png","pipeworks_mese_sand_tube_end.png","pipeworks_mese_sand_tube_end.png"}
mese_sand_short_texture="pipeworks_mese_sand_tube_short.png" local mese_sand_short_texture="pipeworks_mese_sand_tube_short.png"
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
register_tube("pipeworks:mese_sand_tube","Mese sand pneumatic tube segment",mese_sand_plain_textures,mese_sand_noctr_textures,mese_sand_end_textures, 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},
@ -608,10 +604,10 @@ if enable_one_way_tube then
legacy_facedir_simple = true, legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
after_place_node = function(pos) after_place_node = function(pos)
tube_scanforobjects(pos) pipeworks.scan_for_tube_objects(pos)
end, end,
after_dig_node = function(pos) after_dig_node = function(pos)
tube_scanforobjects(pos) pipeworks.scan_for_tube_objects(pos)
end, end,
tube={connect_sides={left=1, right=1}, tube={connect_sides={left=1, right=1},
can_go=function(pos,node,velocity,stack) can_go=function(pos,node,velocity,stack)