summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autocrafter.lua7
-rw-r--r--autoplace_pipes.lua288
-rw-r--r--autoplace_tubes.lua14
-rw-r--r--common.lua36
-rw-r--r--compat-chests.lua187
-rw-r--r--compat-furnaces.lua433
-rw-r--r--compat.lua153
-rw-r--r--default_settings.lua40
-rw-r--r--default_settings.txt24
-rw-r--r--devices.lua260
-rw-r--r--filter-injector.lua17
-rw-r--r--flowing_logic.lua23
-rw-r--r--init.lua12
-rw-r--r--item_transport.lua66
-rw-r--r--luaentity.lua74
-rw-r--r--models/pipeworks_flow_sensor.obj502
-rw-r--r--models/pipeworks_valve_off.obj537
-rw-r--r--models/pipeworks_valve_on.obj537
-rw-r--r--pipes.lua11
-rw-r--r--routing_tubes.lua54
-rw-r--r--settingtypes.txt70
-rw-r--r--signal_tubes.lua2
-rw-r--r--sorting_tubes.lua10
-rw-r--r--teleport_tube.lua2
-rw-r--r--textures/pipeworks_broken_tube_end.pngbin0 -> 1545 bytes
-rw-r--r--textures/pipeworks_broken_tube_inv.pngbin0 -> 923 bytes
-rw-r--r--textures/pipeworks_broken_tube_noctr.pngbin0 -> 1581 bytes
-rw-r--r--textures/pipeworks_broken_tube_plain.pngbin0 -> 1803 bytes
-rw-r--r--textures/pipeworks_broken_tube_short.pngbin0 -> 830 bytes
-rw-r--r--textures/pipeworks_button_interm.pngbin5409 -> 5636 bytes
-rw-r--r--textures/pipeworks_button_off.pngbin5979 -> 6397 bytes
-rw-r--r--textures/pipeworks_button_on.pngbin6064 -> 6193 bytes
-rw-r--r--tube_registration.lua24
-rw-r--r--vacuum_tubes.lua74
34 files changed, 2104 insertions, 1353 deletions
diff --git a/autocrafter.lua b/autocrafter.lua
index 738f3f2..7ddc312 100644
--- a/autocrafter.lua
+++ b/autocrafter.lua
@@ -176,7 +176,7 @@ local function update_meta(meta, enabled)
"list[context;recipe;0,0;3,3;]"..
"image[3,1;1,1;gui_hb_bg.png^[colorize:#141318:255]"..
"list[context;output;3,1;1,1;]"..
- "image_button[3,2;1,1;pipeworks_button_" .. state .. ".png;" .. state .. ";;;false;pipeworks_button_interm.png]" ..
+ "image_button[3,2;1,0.6;pipeworks_button_" .. state .. ".png;" .. state .. ";;;false;pipeworks_button_interm.png]" ..
"list[context;src;0,4.5;8,3;]"..
"list[context;dst;4,0;4,3;]"..
default.gui_bg..
@@ -186,10 +186,9 @@ local function update_meta(meta, enabled)
"list[current_player;main;0,8;8,4;]" ..
"listring[current_player;main]"..
"listring[context;src]" ..
- "listring[context;dst]" ..
"listring[current_player;main]"..
- "listring[context;recipe]" ..
- "listring[context;output]"
+ "listring[context;dst]" ..
+ "listring[current_player;main]"
if minetest.get_modpath("digilines") then
fs = fs.."field[1,3.5;4,1;channel;Channel;${channel}]"
fs = fs.."button_exit[5,3.2;2,1;save;Save]"
diff --git a/autoplace_pipes.lua b/autoplace_pipes.lua
index 4fc3665..a3f0b65 100644
--- a/autoplace_pipes.lua
+++ b/autoplace_pipes.lua
@@ -1,6 +1,71 @@
--- autorouting for pipes
+--[[
+
+ autorouting for pipes
+
+ To connect pipes to some node, include this in the node def...
+
+ pipe_connections = {
+ pattern = <string>, -- if supplied, search for this pattern instead of the exact node name
+ left = <bool>, -- true (or 1) if the left side of the node needs to connect to a pipe
+ right = <bool>, -- or from the right side, etc.
+ top = <bool>,
+ bottom = <bool>,
+ front = <bool>,
+ back = <bool>,
+ left_param2 = <num>, -- the node must have this param2 to connect from the left
+ right_param2 = <num>, -- or right, etc.
+ top_param2 = <num>, -- Omit some or all of these to skip checking param2 for those sides
+ bottom_param2 = <num>,
+ front_param2 = <num>,
+ back_param2 = <num>,
+ },
+
+ ...then add, pipeworks.scan_for_pipe_objects(pos)
+ to your node's after_dig_node and after_place_node callbacks.
+
+]]--
+
+-- get the axis dir (just 6 faces) of target node, assumes the pipe is the axis
+
+function pipeworks.get_axis_dir(nodetable, pattern)
+ local pxm,pxp,pym,pyp,pzm,pzp
+
+ if string.find(nodetable.nxm.name, pattern)
+ and minetest.facedir_to_dir(nodetable.nxm.param2).x ~= 0 then
+ pxm=1
+ end
+
+ if string.find(nodetable.nxp.name, pattern)
+ and minetest.facedir_to_dir(nodetable.nxp.param2).x ~= 0 then
+ pxp=1
+ end
+
+ if string.find(nodetable.nzm.name, pattern)
+ and minetest.facedir_to_dir(nodetable.nzm.param2).z ~= 0 then
+ pzm=1
+ end
+
+ if string.find(nodetable.nzp.name, pattern)
+ and minetest.facedir_to_dir(nodetable.nzp.param2).z ~= 0 then
+ pzp=1
+ end
+
+ if string.find(nodetable.nym.name, pattern)
+ and minetest.facedir_to_dir(nodetable.nym.param2).y ~= 0 then
+ pym=1
+ end
+
+ if string.find(nodetable.nyp.name, pattern)
+ and minetest.facedir_to_dir(nodetable.nyp.param2).y ~= 0 then
+ pyp=1
+ end
+ local match = pxm or pxp or pym or pyp or pzm or pzp
+ return match,pxm,pxp,pym,pyp,pzm,pzp
+end
+
local tube_table = {[0] = 1, 2, 2, 4, 2, 4, 4, 5, 2, 3, 4, 6, 4, 6, 5, 7, 2, 4, 3, 6, 4, 5, 6, 7, 4, 6, 6, 8, 5, 7, 7, 9, 2, 4, 4, 5, 3, 6, 6, 7, 4, 6, 5, 7, 6, 8, 7, 9, 4, 5, 6, 7, 6, 7, 8, 9, 5, 7, 7, 9, 7, 9, 9, 10}
local tube_table_facedirs = {[0] = 0, 0, 5, 0, 3, 4, 3, 0, 2, 0, 2, 0, 6, 4, 3, 0, 7, 12, 5, 12, 7, 4, 5, 5, 18, 20, 16, 0, 7, 4, 7, 0, 1, 8, 1, 1, 1, 13, 1, 1, 10, 8, 2, 2, 17, 4, 3, 6, 9, 9, 9, 9, 21, 13, 1, 1, 10, 10, 11, 2, 19, 4, 3, 0}
+
local function autoroute_pipes(pos)
local nctr = minetest.get_node(pos)
local state = "_empty"
@@ -23,7 +88,7 @@ function pipeworks.scan_for_pipe_objects(pos)
autoroute_pipes(pos)
end
--- auto-rotation code for various devices the tubes attach to
+-- auto-rotation code for various devices the pipes attach to
function pipeworks.scan_pipe_surroundings(pos)
local pxm=0
@@ -40,152 +105,102 @@ function pipeworks.scan_pipe_surroundings(pos)
local nzm = 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(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
+ local nodetable = {
+ nxm = nxm,
+ nxp = nxp,
+ nym = nym,
+ nyp = nyp,
+ nzm = nzm,
+ nzp = nzp
+ }
--- Special handling for valves...
-
- if (string.find(nxm.name, "pipeworks:valve") ~= nil)
- and (nxm.param2 == 0 or nxm.param2 == 2) then
- pxm=1
- end
+-- standard handling for pipes...
- if (string.find(nxp.name, "pipeworks:valve") ~= nil)
- and (nxp.param2 == 0 or nxp.param2 == 2) then
- pxp=1
- end
+ if string.find(nxm.name, "pipeworks:pipe_") then pxm=1 end
+ if string.find(nxp.name, "pipeworks:pipe_") then pxp=1 end
+ if string.find(nym.name, "pipeworks:pipe_") then pym=1 end
+ if string.find(nyp.name, "pipeworks:pipe_") then pyp=1 end
+ if string.find(nzm.name, "pipeworks:pipe_") then pzm=1 end
+ if string.find(nzp.name, "pipeworks:pipe_") then pzp=1 end
- if (string.find(nzm.name, "pipeworks:valve") ~= nil)
- and (nzm.param2 == 1 or nzm.param2 == 3) then
- pzm=1
- end
+-- Special handling for valves...
- if (string.find(nzp.name, "pipeworks:valve") ~= nil)
- and (nzp.param2 == 1 or nzp.param2 == 3) then
- pzp=1
+ local match,a,b,c,d,e,f = pipeworks.get_axis_dir(nodetable, "pipeworks:valve")
+ if match then
+ pxm = a or pxm
+ pxp = b or pxp
+ pym = c or pym
+ pyp = d or pyp
+ pzm = e or pzm
+ pzp = f or pzp
end
-- ...flow sensors...
- if (string.find(nxm.name, "pipeworks:flow_sensor") ~= nil)
- and (nxm.param2 == 0 or nxm.param2 == 2) then
- pxm=1
- end
-
- if (string.find(nxp.name, "pipeworks:flow_sensor") ~= nil)
- and (nxp.param2 == 0 or nxp.param2 == 2) then
- pxp=1
- end
-
- if (string.find(nzm.name, "pipeworks:flow_sensor") ~= nil)
- and (nzm.param2 == 1 or nzm.param2 == 3) then
- pzm=1
- end
-
- if (string.find(nzp.name, "pipeworks:flow_sensor") ~= nil)
- and (nzp.param2 == 1 or nzp.param2 == 3) then
- pzp=1
- end
-
--- ...spigots...
-
- if (string.find(nxm.name, "pipeworks:spigot") ~= nil)
- and nxm.param2 == 1 then
- pxm=1
- end
-
- if (string.find(nxp.name, "pipeworks:spigot") ~= nil)
- and nxp.param2 == 3 then
- pxp=1
- end
-
- if (string.find(nzm.name, "pipeworks:spigot") ~= nil)
- and nzm.param2 == 0 then
- pzm=1
- end
-
- if (string.find(nzp.name, "pipeworks:spigot") ~= nil)
- and nzp.param2 == 2 then
- pzp=1
+ local match,a,b,c,d,e,f = pipeworks.get_axis_dir(nodetable, "pipeworks:flow_sensor")
+ if match then
+ pxm = a or pxm
+ pxp = b or pxp
+ pym = c or pym
+ pyp = d or pyp
+ pzm = e or pzm
+ pzp = f or pzp
end
-- ...sealed pipe entry/exit...
- if (string.find(nxm.name, "pipeworks:entry_panel") ~= nil)
- and (nxm.param2 == 1 or nxm.param2 == 3) then
- pxm=1
- end
-
- if (string.find(nxp.name, "pipeworks:entry_panel") ~= nil)
- and (nxp.param2 == 1 or nxp.param2 == 3) then
- pxp=1
- end
-
- if (string.find(nzm.name, "pipeworks:entry_panel") ~= nil)
- and (nzm.param2 == 0 or nzm.param2 == 2) then
- pzm=1
- end
-
- if (string.find(nzp.name, "pipeworks:entry_panel") ~= nil)
- and (nzp.param2 == 0 or nzp.param2 == 2) then
- pzp=1
- end
-
- if (string.find(nym.name, "pipeworks:entry_panel") ~= nil)
- and nym.param2 == 13 then
- pym=1
- end
-
- if (string.find(nyp.name, "pipeworks:entry_panel") ~= nil)
- and nyp.param2 == 13 then
- pyp=1
- end
-
-
--- ...pumps, grates...
-
- if (string.find(nym.name, "pipeworks:grating") ~= nil) or
- (string.find(nym.name, "pipeworks:pump") ~= nil) then
- pym=1
- end
-
--- ...fountainheads...
-
- if (string.find(nyp.name, "pipeworks:fountainhead") ~= nil) then
- pyp=1
- end
-
--- ... and storage tanks.
-
- if (string.find(nym.name, "pipeworks:storage_tank_") ~= nil) then
- pym=1
- end
-
- if (string.find(nyp.name, "pipeworks:storage_tank_") ~= nil) then
- pyp=1
- end
-
--- ...extra devices specified via the function's parameters
--- ...except that this part is not implemented yet
---
--- xxx = nxm, nxp, nym, nyp, nzm, or nzp depending on the direction to check
--- yyy = pxm, pxp, pym, pyp, pzm, or pzp accordingly.
---
--- if string.find(xxx.name, "modname:nodename") ~= nil then
--- yyy = 1
--- end
---
--- for example:
---
--- if string.find(nym.name, "aero:outlet") ~= nil then
--- pym = 1
--- end
---
-
+ local match,a,b,c,d,e,f = pipeworks.get_axis_dir(nodetable, "pipeworks:entry_panel")
+ if match then
+ pxm = a or pxm
+ pxp = b or pxp
+ pym = c or pym
+ pyp = d or pyp
+ pzm = e or pzm
+ pzp = f or pzp
+ end
+
+-- ... other nodes
+
+ local def_left = minetest.registered_nodes[nxp.name] -- the node that {pos} is to the left of (not the
+ local def_right = minetest.registered_nodes[nxm.name] -- ...note that is AT the left!), etc.
+ local def_bottom = minetest.registered_nodes[nyp.name]
+ local def_top = minetest.registered_nodes[nym.name]
+ local def_front = minetest.registered_nodes[nzp.name]
+ local def_back = minetest.registered_nodes[nzm.name]
+
+ if def_left and def_left.pipe_connections and def_left.pipe_connections.left
+ and (not def_left.pipe_connections.pattern or string.find(nxp.name, def_left.pipe_connections.pattern))
+ and (not def_left.pipe_connections.left_param2 or (nxp.param2 == def_left.pipe_connections.left_param2)) then
+ pxp = 1
+ end
+ if def_right and def_right.pipe_connections and def_right.pipe_connections.right
+ and (not def_right.pipe_connections.pattern or string.find(nxm.name, def_right.pipe_connections.pattern))
+ and (not def_right.pipe_connections.right_param2 or (nxm.param2 == def_right.pipe_connections.right_param2)) then
+ pxm = 1
+ end
+ if def_top and def_top.pipe_connections and def_top.pipe_connections.top
+ and (not def_top.pipe_connections.pattern or string.find(nym.name, def_top.pipe_connections.pattern))
+ and (not def_top.pipe_connections.top_param2 or (nym.param2 == def_top.pipe_connections.top_param2)) then
+ pym = 1
+ end
+ if def_bottom and def_bottom.pipe_connections and def_bottom.pipe_connections.bottom
+ and (not def_bottom.pipe_connections.pattern or string.find(nyp.name, def_bottom.pipe_connections.pattern))
+ and (not def_bottom.pipe_connections.bottom_param2 or (nyp.param2 == def_bottom.pipe_connections.bottom_param2)) then
+ pyp = 1
+ end
+ if def_front and def_front.pipe_connections and def_front.pipe_connections.front
+ and (not def_front.pipe_connections.pattern or string.find(nzp.name, def_front.pipe_connections.pattern))
+ and (not def_front.pipe_connections.front_param2 or (nzp.param2 == def_front.pipe_connections.front_param2)) then
+ pzp = 1
+ end
+ if def_back and def_back.pipe_connections and def_back.pipe_connections.back
+ and (not def_back.pipe_connections.pattern or string.find(nzm.name, def_back.pipe_connections.pattern))
+ and (not def_back.pipe_connections.back_param2 or (nzm.param2 == def_back.pipe_connections.back_param2)) then
+ pzm = 1
+ end
+
+ print("stage 2 returns "..pxm+8*pxp+2*pym+16*pyp+4*pzm+32*pzp..
+ " for nodes surrounding "..minetest.get_node(pos).name.." at "..minetest.pos_to_string(pos))
return pxm+8*pxp+2*pym+16*pyp+4*pzm+32*pzp
end
@@ -197,4 +212,3 @@ function pipeworks.look_for_stackable_tanks(pos)
minetest.add_node(pos, { name = "pipeworks:expansion_tank_0", param2 = tym.param2})
end
end
-
diff --git a/autoplace_tubes.lua b/autoplace_tubes.lua
index 280bd60..0d28e64 100644
--- a/autoplace_tubes.lua
+++ b/autoplace_tubes.lua
@@ -1,7 +1,7 @@
-- autorouting for pneumatic tubes
local function is_tube(nodename)
- return table.contains(pipeworks.tubenodes, nodename)
+ return pipeworks.table_contains(pipeworks.tubenodes, nodename)
end
--a function for determining which side of the node we are on
@@ -11,23 +11,23 @@ local function nodeside(node, tubedir)
end
local backdir = minetest.facedir_to_dir(node.param2)
- local back = vector.dot(backdir, tubedir)
+ local back = pipeworks.vector_dot(backdir, tubedir)
if back == 1 then
return "back"
elseif back == -1 then
return "front"
end
- local topdir = minetest.facedir_to_top_dir(node.param2)
- local top = vector.dot(topdir, tubedir)
+ local topdir = pipeworks.facedir_to_top_dir(node.param2)
+ local top = pipeworks.vector_dot(topdir, tubedir)
if top == 1 then
return "top"
elseif top == -1 then
return "bottom"
end
- local rightdir = minetest.facedir_to_right_dir(node.param2)
- local right = vector.dot(rightdir, tubedir)
+ local rightdir = pipeworks.facedir_to_right_dir(node.param2)
+ local right = pipeworks.vector_dot(rightdir, tubedir)
if right == 1 then
return "right"
else
@@ -99,7 +99,7 @@ end
function pipeworks.scan_for_tube_objects(pos)
for side = 0, 6 do
- tube_autoroute(vector.add(pos, directions.side_to_dir(side)))
+ tube_autoroute(vector.add(pos, pipeworks.directions.side_to_dir(side)))
end
end
diff --git a/common.lua b/common.lua
index 1ee734f..5574bb2 100644
--- a/common.lua
+++ b/common.lua
@@ -2,7 +2,7 @@
-- Vector functions --
----------------------
-function vector.cross(a, b)
+function pipeworks.vector_cross(a, b)
return {
x = a.y * b.z - a.z * b.y,
y = a.z * b.x - a.x * b.z,
@@ -10,7 +10,7 @@ function vector.cross(a, b)
}
end
-function vector.dot(a, b)
+function pipeworks.vector_dot(a, b)
return a.x * b.x + a.y * b.y + a.z * b.z
end
@@ -18,7 +18,7 @@ end
-- Facedir functions --
-----------------------
-function minetest.facedir_to_top_dir(facedir)
+function pipeworks.facedir_to_top_dir(facedir)
return ({[0] = {x = 0, y = 1, z = 0},
{x = 0, y = 0, z = 1},
{x = 0, y = 0, z = -1},
@@ -28,14 +28,15 @@ function minetest.facedir_to_top_dir(facedir)
[math.floor(facedir / 4)]
end
-function minetest.facedir_to_right_dir(facedir)
- return vector.cross(
- minetest.facedir_to_top_dir(facedir),
+function pipeworks.facedir_to_right_dir(facedir)
+ return pipeworks.vector_cross(
+ pipeworks.facedir_to_top_dir(facedir),
minetest.facedir_to_dir(facedir)
)
end
-directions = {}
+local directions = {}
+pipeworks.directions = directions
function directions.side_to_dir(side)
return ({[0] = vector.new(),
vector.new( 0, 1, 0),
@@ -48,7 +49,7 @@ function directions.side_to_dir(side)
end
function directions.dir_to_side(dir)
- local c = vector.dot(dir, vector.new(1, 2, 3)) + 4
+ local c = pipeworks.vector_dot(dir, vector.new(1, 2, 3)) + 4
return ({6, 2, 4, 0, 3, 1, 5})[c]
end
@@ -56,7 +57,7 @@ end
-- String functions --
----------------------
---[[function string.split(str, sep)
+--[[function pipeworks.string_split(str, sep)
local fields = {}
local index = 1
local expr = "([^"..sep.."])+"
@@ -67,7 +68,7 @@ end
return fields
end]]
-function string.startswith(str, substr)
+function pipeworks.string_startswith(str, substr)
return str:sub(1, substr:len()) == substr
end
@@ -75,7 +76,7 @@ end
-- Table functions --
---------------------
-function table.contains(tbl, element)
+function pipeworks.table_contains(tbl, element)
for _, elt in pairs(tbl) do
if elt == element then
return true
@@ -84,7 +85,7 @@ function table.contains(tbl, element)
return false
end
-function table.extend(tbl, tbl2)
+function pipeworks.table_extend(tbl, tbl2)
local index = #tbl + 1
for _, elt in ipairs(tbl2) do
tbl[index] = elt
@@ -92,11 +93,11 @@ function table.extend(tbl, tbl2)
end
end
-function table.recursive_replace(tbl, pattern, replace_with)
+function pipeworks.table_recursive_replace(tbl, pattern, replace_with)
if type(tbl) == "table" then
local tbl2 = {}
for key, value in pairs(tbl) do
- tbl2[key] = table.recursive_replace(value, pattern, replace_with)
+ tbl2[key] = pipeworks.table_recursive_replace(value, pattern, replace_with)
end
return tbl2
elseif type(tbl) == "string" then
@@ -110,11 +111,12 @@ end
-- Formspec functions --
------------------------
-fs_helpers = {}
+local fs_helpers = {}
+pipeworks.fs_helpers = fs_helpers
function fs_helpers.on_receive_fields(pos, fields)
local meta = minetest.get_meta(pos)
for field, value in pairs(fields) do
- if field:startswith("fs_helpers_cycling:") then
+ if pipeworks.string_startswith(field, "fs_helpers_cycling:") then
local l = field:split(":")
local new_value = tonumber(l[2])
local meta_name = l[3]
@@ -146,7 +148,7 @@ end
-- Env --
---------
-function minetest.load_position(pos)
+function pipeworks.load_position(pos)
if pos.x < -30912 or pos.y < -30912 or pos.z < -30912 or
pos.x > 30927 or pos.y > 30927 or pos.z > 30927 then return end
if minetest.get_node_or_nil(pos) then
diff --git a/compat-chests.lua b/compat-chests.lua
new file mode 100644
index 0000000..ac5c219
--- /dev/null
+++ b/compat-chests.lua
@@ -0,0 +1,187 @@
+-- this bit of code modifies the default chests and furnaces to be compatible
+-- with pipeworks.
+--
+-- the formspecs found here are basically copies of the ones from minetest_game
+-- plus bits from pipeworks' sorting tubes
+
+local fs_helpers = pipeworks.fs_helpers
+
+tube_entry = "^pipeworks_tube_connection_wooden.png"
+
+local base_chest_formspec = "size[8,9]" ..
+ default.gui_bg ..
+ default.gui_bg_img ..
+ default.gui_slots ..
+ "list[current_player;main;0,4.85;8,1;]" ..
+ "list[current_player;main;0,6.08;8,3;8]" ..
+ "listring[current_player;main]" ..
+ default.get_hotbar_bg(0,4.85)
+
+local function update_chest_formspec(pos)
+ local meta = minetest.get_meta(pos)
+ local formspec = base_chest_formspec ..
+ "list[current_name;main;0,0.3;8,4;]" ..
+ "listring[current_name;main]" ..
+ fs_helpers.cycling_button(
+ meta,
+ pipeworks.button_base,
+ "splitstacks",
+ {
+ pipeworks.button_off,
+ pipeworks.button_on
+ }
+ )..pipeworks.button_label
+ meta:set_string("formspec", formspec)
+end
+
+minetest.override_item("default:chest", {
+ tiles = {
+ "default_chest_top.png"..tube_entry,
+ "default_chest_top.png"..tube_entry,
+ "default_chest_side.png"..tube_entry,
+ "default_chest_side.png"..tube_entry,
+ "default_chest_side.png"..tube_entry,
+ "default_chest_front.png"
+ },
+ groups = {choppy = 2, oddly_breakable_by_hand = 2, tubedevice = 1, tubedevice_receiver = 1},
+ tube = {
+ insert_object = function(pos, node, stack, direction)
+ local meta = minetest.get_meta(pos)
+ local inv = meta:get_inventory()
+ return inv:add_item("main", stack)
+ end,
+ can_insert = function(pos, node, stack, direction)
+ local meta = minetest.get_meta(pos)
+ local inv = meta:get_inventory()
+ if meta:get_int("splitstacks") == 1 then
+ stack = stack:peek_item(1)
+ end
+ return inv:room_for_item("main", stack)
+ end,
+ input_inventory = "main",
+ connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1}
+ },
+ after_place_node = pipeworks.after_place,
+ after_dig_node = pipeworks.after_dig,
+ on_construct = function(pos)
+ local meta = minetest.get_meta(pos)
+ local inv = meta:get_inventory()
+ inv:set_size("main", 8*4)
+ update_chest_formspec(pos)
+ end,
+ on_receive_fields = function(pos, formname, fields, sender)
+ if not pipeworks.may_configure(pos, sender) then return end
+ fs_helpers.on_receive_fields(pos, fields)
+ update_chest_formspec(pos)
+ end,
+})
+
+-- =====================
+
+local function get_locked_chest_formspec(pos)
+ local spos = pos.x .. "," .. pos.y .. "," .. pos.z
+ local formspec = base_chest_formspec ..
+ "list[nodemeta:" .. spos .. ";main;0,0.3;8,4;]" ..
+ "listring[nodemeta:" .. spos .. ";main]"
+ return formspec
+end
+
+local function setup_locked_formspec(pos, meta)
+ meta:set_string("formspec",
+ get_locked_chest_formspec(pos) ..
+ fs_helpers.cycling_button(
+ meta,
+ pipeworks.button_base,
+ "splitstacks",
+ {
+ pipeworks.button_off,
+ pipeworks.button_on
+ }
+ )..pipeworks.button_label
+ )
+end
+
+minetest.override_item("default:chest_locked", {
+ tiles = {
+ "default_chest_top.png"..tube_entry,
+ "default_chest_top.png"..tube_entry,
+ "default_chest_side.png"..tube_entry,
+ "default_chest_side.png"..tube_entry,
+ "default_chest_side.png"..tube_entry,
+ "default_chest_lock.png"
+ },
+ groups = {choppy = 2, oddly_breakable_by_hand = 2, tubedevice = 1, tubedevice_receiver = 1},
+ tube = {
+ insert_object = function(pos, node, stack, direction)
+ local meta = minetest.get_meta(pos)
+ local inv = meta:get_inventory()
+ return inv:add_item("main", stack)
+ end,
+ can_insert = function(pos, node, stack, direction)
+ local meta = minetest.get_meta(pos)
+ local inv = meta:get_inventory()
+ if meta:get_int("splitstacks") == 1 then
+ stack = stack:peek_item(1)
+ end
+ return inv:room_for_item("main", stack)
+ end,
+ connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1}
+ },
+ after_place_node = function (pos, placer)
+ local meta = minetest.get_meta(pos)
+ meta:set_string("owner", placer:get_player_name() or "")
+ meta:set_string("infotext", "Locked Chest (owned by "..
+ meta:get_string("owner")..")")
+ pipeworks.after_place(pos)
+ end,
+ on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
+ if default.can_interact_with_node(clicker, pos) then
+ local meta = minetest.get_meta(pos)
+ local formspec = meta:get_string("formspec")
+ print("on_rightclick")
+ print(dump(formspec))
+ setup_locked_formspec(pos, meta, clicker)
+ minetest.show_formspec(
+ clicker:get_player_name(),
+ "default:chest_locked",
+ get_locked_chest_formspec(pos)
+ )
+ end
+ return itemstack
+ end,
+ on_key_use = function(pos, player)
+ local secret = minetest.get_meta(pos):get_string("key_lock_secret")
+ local itemstack = player:get_wielded_item()
+ local key_meta = itemstack:get_meta()
+
+ if key_meta:get_string("secret") == "" then
+ key_meta:set_string("secret", minetest.parse_json(itemstack:get_metadata()).secret)
+ itemstack:set_metadata("")
+ end
+
+ if secret ~= key_meta:get_string("secret") then
+ return
+ end
+ setup_locked_formspec(pos, minetest.get_meta(pos))
+ end,
+ on_construct = function(pos)
+ local meta = minetest.get_meta(pos)
+ local inv = meta:get_inventory()
+ inv:set_size("main", 8*4)
+ setup_locked_formspec(pos, meta)
+ end,
+ on_receive_fields = function(pos, formname, fields, sender)
+ if not pipeworks.may_configure(pos, sender) then return end
+ fs_helpers.on_receive_fields(pos, fields)
+ local formspec = get_locked_chest_formspec(pos)
+ print("on_receive_fields")
+ print(dump(formspec))
+
+ if formspec == "" then
+ meta:set_string("formspec", formspec)
+ else
+ setup_locked_formspec(pos, minetest.get_meta(pos))
+ end
+ end,
+ after_dig_node = pipeworks.after_dig
+})
diff --git a/compat-furnaces.lua b/compat-furnaces.lua
new file mode 100644
index 0000000..492332a
--- /dev/null
+++ b/compat-furnaces.lua
@@ -0,0 +1,433 @@
+
+-- this file is basically a modified copy of
+-- minetest_game/mods/default/furnaces.lua
+
+local fs_helpers = pipeworks.fs_helpers
+
+tube_entry = "^pipeworks_tube_connection_stony.png"
+
+local function active_formspec(fuel_percent, item_percent, pos, meta)
+ local formspec =
+ "size[8,8.5]"..
+ default.gui_bg..
+ default.gui_bg_img..
+ default.gui_slots..
+ "list[current_name;src;2.75,0.5;1,1;]"..
+ "list[current_name;fuel;2.75,2.5;1,1;]"..
+ "image[2.75,1.5;1,1;default_furnace_fire_bg.png^[lowpart:"..
+ (100-fuel_percent)..":default_furnace_fire_fg.png]"..
+ "image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[lowpart:"..
+ (item_percent)..":gui_furnace_arrow_fg.png^[transformR270]"..
+ "list[current_name;dst;4.75,0.96;2,2;]"..
+ "list[current_player;main;0,4.25;8,1;]"..
+ "list[current_player;main;0,5.5;8,3;8]"..
+ "listring[current_name;dst]"..
+ "listring[current_player;main]"..
+ "listring[current_name;src]"..
+ "listring[current_player;main]"..
+ "listring[current_name;fuel]"..
+ "listring[current_player;main]"..
+ default.get_hotbar_bg(0, 4.25) ..
+ fs_helpers.cycling_button(
+ meta,
+ "image_button[0,3.5;1,0.6",
+ "split_material_stacks",
+ {
+ pipeworks.button_off,
+ pipeworks.button_on
+ }
+ ).."label[0.9,3.51;Allow splitting incoming material (not fuel) stacks from tubes]"
+ return formspec
+end
+
+local function inactive_formspec(pos, meta)
+ local formspec = "size[8,8.5]"..
+ default.gui_bg..
+ default.gui_bg_img..
+ default.gui_slots..
+ "list[current_name;src;2.75,0.5;1,1;]"..
+ "list[current_name;fuel;2.75,2.5;1,1;]"..
+ "image[2.75,1.5;1,1;default_furnace_fire_bg.png]"..
+ "image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]"..
+ "list[current_name;dst;4.75,0.96;2,2;]"..
+ "list[current_player;main;0,4.25;8,1;]"..
+ "list[current_player;main;0,5.5;8,3;8]"..
+ "listring[current_name;dst]"..
+ "listring[current_player;main]"..
+ "listring[current_name;src]"..
+ "listring[current_player;main]"..
+ "listring[current_name;fuel]"..
+ "listring[current_player;main]"..
+ default.get_hotbar_bg(0, 4.25) ..
+ fs_helpers.cycling_button(
+ meta,
+ "image_button[0,3.5;1,0.6",
+ "split_material_stacks",
+ {
+ pipeworks.button_off,
+ pipeworks.button_on
+ }
+ ).."label[0.9,3.51;Allow splitting incoming material (not fuel) stacks from tubes]"
+ return formspec
+end
+
+--
+-- Node callback functions that are the same for active and inactive furnace
+--
+
+local function can_dig(pos, player)
+ local meta = minetest.get_meta(pos);
+ local inv = meta:get_inventory()
+ return inv:is_empty("fuel") and inv:is_empty("dst") and inv:is_empty("src")
+end
+
+local function allow_metadata_inventory_put(pos, listname, index, stack, player)
+ if minetest.is_protected(pos, player:get_player_name()) then
+ return 0
+ end
+ local meta = minetest.get_meta(pos)
+ local inv = meta:get_inventory()
+ if listname == "fuel" then
+ if minetest.get_craft_result({method="fuel", width=1, items={stack}}).time ~= 0 then
+ if inv:is_empty("src") then
+ meta:set_string("infotext", "Furnace is empty")
+ end
+ return stack:get_count()
+ else
+ return 0
+ end
+ elseif listname == "src" then
+ return stack:get_count()
+ elseif listname == "dst" then
+ return 0
+ end
+end
+
+local function allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
+ local meta = minetest.get_meta(pos)
+ local inv = meta:get_inventory()
+ local stack = inv:get_stack(from_list, from_index)
+ return allow_metadata_inventory_put(pos, to_list, to_index, stack, player)
+end
+
+local function allow_metadata_inventory_take(pos, listname, index, stack, player)
+ if minetest.is_protected(pos, player:get_player_name()) then
+ return 0
+ end
+ return stack:get_count()
+end
+
+local function swap_node(pos, name)
+ local node = minetest.get_node(pos)
+ if node.name == name then
+ return
+ end
+ node.name = name
+ minetest.swap_node(pos, node)
+end
+
+local function furnace_node_timer(pos, elapsed)
+ --
+ -- Inizialize metadata
+ --
+ local meta = minetest.get_meta(pos)
+ local fuel_time = meta:get_float("fuel_time") or 0
+ local src_time = meta:get_float("src_time") or 0
+ local fuel_totaltime = meta:get_float("fuel_totaltime") or 0
+
+ local inv = meta:get_inventory()
+ local srclist, fuellist
+
+ local cookable, cooked
+ local fuel
+
+ local update = true
+ while update do
+ update = false
+
+ srclist = inv:get_list("src")
+ fuellist = inv:get_list("fuel")
+
+ --
+ -- Cooking
+ --
+
+ -- Check if we have cookable content
+ local aftercooked
+ cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
+ cookable = cooked.time ~= 0
+
+ -- Check if we have enough fuel to burn
+ if fuel_time < fuel_totaltime then
+ -- The furnace is currently active and has enough fuel
+ fuel_time = fuel_time + elapsed
+ -- If there is a cookable item then check if it is ready yet
+ if cookable then
+ src_time = src_time + elapsed
+ if src_time >= cooked.time then
+ -- Place result in dst list if possible
+ if inv:room_for_item("dst", cooked.item) then
+ inv:add_item("dst", cooked.item)
+ inv:set_stack("src", 1, aftercooked.items[1])
+ src_time = src_time - cooked.time
+ update = true
+ end
+ end
+ end
+ else
+ -- Furnace ran out of fuel
+ if cookable then
+ -- We need to get new fuel
+ local afterfuel
+ fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
+
+ if fuel.time == 0 then
+ -- No valid fuel in fuel list
+ fuel_totaltime = 0
+ src_time = 0
+ else
+ -- Take fuel from fuel list
+ inv:set_stack("fuel", 1, afterfuel.items[1])
+ update = true
+ fuel_totaltime = fuel.time + (fuel_time - fuel_totaltime)
+ src_time = src_time + elapsed
+ end
+ else
+ -- We don't need to get new fuel since there is no cookable item
+ fuel_totaltime = 0
+ src_time = 0
+ end
+ fuel_time = 0
+ end
+
+ elapsed = 0
+ end
+
+ if fuel and fuel_totaltime > fuel.time then
+ fuel_totaltime = fuel.time
+ end
+ if srclist[1]:is_empty() then
+ src_time = 0
+ end
+
+ --
+ -- Update formspec, infotext and node
+ --
+ local formspec = inactive_formspec(pos, meta)
+ local item_state
+ local item_percent = 0
+ if cookable then
+ item_percent = math.floor(src_time / cooked.time * 100)
+ if item_percent > 100 then
+ item_state = "100% (output full)"
+ else
+ item_state = item_percent .. "%"
+ end
+ else
+ if srclist[1]:is_empty() then
+ item_state = "Empty"
+ else
+ item_state = "Not cookable"
+ end
+ end
+
+ local fuel_state = "Empty"
+ local active = "inactive "
+ local result = false
+
+ if fuel_totaltime ~= 0 then
+ active = "active "
+ local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100)
+ fuel_state = fuel_percent .. "%"
+ formspec = active_formspec(fuel_percent, item_percent, pos, meta)
+ swap_node(pos, "default:furnace_active")
+ -- make sure timer restarts automatically
+ result = true
+ else
+ if not fuellist[1]:is_empty() then
+ fuel_state = "0%"
+ end
+ swap_node(pos, "default:furnace")
+ -- stop timer on the inactive furnace
+ minetest.get_node_timer(pos):stop()
+ end
+
+ local infotext = "Furnace " .. active .. "(Item: " .. item_state .. "; Fuel: " .. fuel_state .. ")"
+
+ --
+ -- Set meta values
+ --
+ meta:set_float("fuel_totaltime", fuel_totaltime)
+ meta:set_float("fuel_time", fuel_time)
+ meta:set_float("src_time", src_time)
+ meta:set_string("formspec", formspec)
+ meta:set_string("infotext", infotext)
+
+ return result
+end
+
+--
+-- Node definitions
+--
+
+minetest.register_node(":default:furnace", {
+ description = "Furnace",
+ tiles = {
+ "default_furnace_top.png"..tube_entry,
+ "default_furnace_bottom.png"..tube_entry,
+ "default_furnace_side.png"..tube_entry,
+ "default_furnace_side.png"..tube_entry,
+ "default_furnace_side.png"..tube_entry,
+ "default_furnace_front.png"
+ },
+ groups = {cracky = 2, tubedevice = 1, tubedevice_receiver = 1},
+ tube = {
+ insert_object = function(pos, node, stack, direction)
+ local meta = minetest.get_meta(pos)
+ local inv = meta:get_inventory()
+ local timer = minetest.get_node_timer(pos)
+ if not timer:is_started() then
+ timer:start(1.0)
+ end
+ if direction.y == 1 then
+ return inv:add_item("fuel", stack)
+ else
+ return inv:add_item("src", stack)
+ end
+ end,
+ can_insert = function(pos,node,stack,direction)
+ local meta = minetest.get_meta(pos)
+ local inv = meta:get_inventory()
+ if direction.y == 1 then
+ return inv:room_for_item("fuel", stack)
+ else
+ if meta:get_int("split_material_stacks") == 1 then
+ stack = stack:peek_item(1)
+ end
+ return inv:room_for_item("src", stack)
+ end
+ end,
+ input_inventory = "dst",
+ connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1}
+ },
+ paramtype2 = "facedir",
+ legacy_facedir_simple = true,
+ is_ground_content = false,
+ sounds = default.node_sound_stone_defaults(),
+
+ can_dig = can_dig,
+
+ on_timer = furnace_node_timer,
+
+ on_construct = function(pos)
+ local meta = minetest.get_meta(pos)
+ meta:set_string("formspec", inactive_formspec(pos, meta))
+ local inv = meta:get_inventory()
+ inv:set_size('src', 1)
+ inv:set_size('fuel', 1)
+ inv:set_size('dst', 4)
+ end,
+
+ on_metadata_inventory_move = function(pos)
+ minetest.get_node_timer(pos):start(1.0)
+ end,
+ on_metadata_inventory_put = function(pos)
+ -- start timer function, it will sort out whether furnace can burn or not.
+ minetest.get_node_timer(pos):start(1.0)
+ end,
+ on_blast = function(pos)
+ local drops = {}
+ default.get_inventory_drops(pos, "src", drops)
+ default.get_inventory_drops(pos, "fuel", drops)
+ default.get_inventory_drops(pos, "dst", drops)
+ drops[#drops+1] = "default:furnace"
+ minetest.remove_node(pos)
+ return drops
+ end,
+ allow_metadata_inventory_put = allow_metadata_inventory_put,
+ allow_metadata_inventory_move = allow_metadata_inventory_move,
+ allow_metadata_inventory_take = allow_metadata_inventory_take,
+ on_receive_fields = function(pos, formname, fields, sender)
+ if not pipeworks.may_configure(pos, sender) then return end
+ fs_helpers.on_receive_fields(pos, fields)
+ local meta = minetest.get_meta(pos)
+ local formspec = inactive_formspec(pos, meta)
+ meta:set_string("formspec", formspec)
+ end,
+ after_place_node = pipeworks.after_place,
+ after_dig_node = pipeworks.after_dig
+})
+
+minetest.register_node(":default:furnace_active", {
+ description = "Furnace",
+ tiles = {
+ "default_furnace_top.png"..tube_entry,
+ "default_furnace_bottom.png"..tube_entry,
+ "default_furnace_side.png"..tube_entry,
+ "default_furnace_side.png"..tube_entry,
+ "default_furnace_side.png"..tube_entry,
+ {
+ image = "default_furnace_front_active.png",
+ backface_culling = false,
+ animation = {
+ type = "vertical_frames",
+ aspect_w = 16,
+ aspect_h = 16,
+ length = 1.5
+ },
+ }
+ },
+ groups = {cracky = 2, tubedevice = 1, tubedevice_receiver = 1, not_in_creative_inventory = 1},
+ tube = {
+ insert_object = function(pos,node,stack,direction)
+ local meta = minetest.get_meta(pos)
+ local inv = meta:get_inventory()
+ local timer = minetest.get_node_timer(pos)
+ if not timer:is_started() then
+ timer:start(1.0)
+ end
+ if direction.y == 1 then
+ return inv:add_item("fuel", stack)
+ else
+ return inv:add_item("src", stack)
+ end
+ end,
+ can_insert = function(pos, node, stack, direction)
+ local meta = minetest.get_meta(pos)
+ local inv = meta:get_inventory()
+ if direction.y == 1 then
+ return inv:room_for_item("fuel", stack)
+ else
+ if meta:get_int("split_material_stacks") == 1 then
+ stack = stack:peek_item(1)
+ end
+ return inv:room_for_item("src", stack)
+ end
+ end,
+ input_inventory = "dst",
+ connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1}
+ },
+ paramtype2 = "facedir",
+ light_source = 8,
+ drop = "default:furnace",
+ legacy_facedir_simple = true,
+ is_ground_content = false,
+ sounds = default.node_sound_stone_defaults(),
+ on_timer = furnace_node_timer,
+
+ can_dig = can_dig,
+
+ allow_metadata_inventory_put = allow_metadata_inventory_put,
+ allow_metadata_inventory_move = allow_metadata_inventory_move,
+ allow_metadata_inventory_take = allow_metadata_inventory_take,
+ on_receive_fields = function(pos, formname, fields, sender)
+ if not pipeworks.may_configure(pos, sender) then return end
+ fs_helpers.on_receive_fields(pos, fields)
+ local meta = minetest.get_meta(pos)
+ local formspec = active_formspec(0, 0, pos, meta)
+ meta:set_string("formspec", formspec)
+ end,
+ after_place_node = pipeworks.after_place,
+ after_dig_node = pipeworks.after_dig
+})
+
diff --git a/compat.lua b/compat.lua
deleted file mode 100644
index 9c956e6..0000000
--- a/compat.lua
+++ /dev/null
@@ -1,153 +0,0 @@
--- this bit of code modifies the default chests and furnaces to be compatible
--- with pipeworks.
-
-minetest.override_item("default:furnace", {
- tiles = {
- "default_furnace_top.png^pipeworks_tube_connection_stony.png",
- "default_furnace_bottom.png^pipeworks_tube_connection_stony.png",
- "default_furnace_side.png^pipeworks_tube_connection_stony.png",
- "default_furnace_side.png^pipeworks_tube_connection_stony.png",
- "default_furnace_side.png^pipeworks_tube_connection_stony.png",
- "default_furnace_front.png"
- },
- groups = {cracky = 2, tubedevice = 1, tubedevice_receiver = 1},
- tube = {
- insert_object = function(pos, node, stack, direction)
- local meta = minetest.get_meta(pos)
- local inv = meta:get_inventory()
- local timer = minetest.get_node_timer(pos)
- if not timer:is_started() then
- timer:start(1.0)
- end
- if direction.y == 1 then
- return inv:add_item("fuel",stack)
- else
- return inv:add_item("src",stack)
- end
- end,
- can_insert = function(pos,node,stack,direction)
- local meta = minetest.get_meta(pos)
- local inv = meta:get_inventory()
- if direction.y == 1 then
- return inv:room_for_item("fuel", stack)
- else
- return inv:room_for_item("src", stack)
- end
- end,
- input_inventory = "dst",
- connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1}
- },
- after_place_node = pipeworks.after_place,
- after_dig_node = pipeworks.after_dig
-})
-
-minetest.override_item("default:furnace_active", {
- tiles = {
- "default_furnace_top.png^pipeworks_tube_connection_stony.png",
- "default_furnace_bottom.png^pipeworks_tube_connection_stony.png",
- "default_furnace_side.png^pipeworks_tube_connection_stony.png",
- "default_furnace_side.png^pipeworks_tube_connection_stony.png",
- "default_furnace_side.png^pipeworks_tube_connection_stony.png",
- {
- image = "default_furnace_front_active.png",
- backface_culling = false,
- animation = {
- type = "vertical_frames",
- aspect_w = 16,
- aspect_h = 16,
- length = 1.5
- },
- }
- },
- groups = {cracky = 2, tubedevice = 1, tubedevice_receiver = 1, not_in_creative_inventory = 1},
- tube = {
- insert_object = function(pos,node,stack,direction)
- local meta = minetest.get_meta(pos)
- local inv = meta:get_inventory()
- local timer = minetest.get_node_timer(pos)
- if not timer:is_started() then
- timer:start(1.0)
- end
- if direction.y == 1 then
- return inv:add_item("fuel", stack)
- else
- return inv:add_item("src", stack)
- end
- end,
- can_insert = function(pos, node, stack, direction)
- local meta = minetest.get_meta(pos)
- local inv = meta:get_inventory()
- if direction.y == 1 then
- return inv:room_for_item("fuel", stack)
- else
- return inv:room_for_item("src", stack)
- end
- end,
- input_inventory = "dst",
- connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1}
- },
- after_place_node = pipeworks.after_place,
- after_dig_node = pipeworks.after_dig
-})
-
-minetest.override_item("default:chest", {
- tiles = {
- "default_chest_top.png^pipeworks_tube_connection_wooden.png",
- "default_chest_top.png^pipeworks_tube_connection_wooden.png",
- "default_chest_side.png^pipeworks_tube_connection_wooden.png",
- "default_chest_side.png^pipeworks_tube_connection_wooden.png",
- "default_chest_side.png^pipeworks_tube_connection_wooden.png",
- "default_chest_front.png"
- },
- groups = {choppy = 2, oddly_breakable_by_hand = 2, tubedevice = 1, tubedevice_receiver = 1},
- tube = {
- insert_object = function(pos, node, stack, direction)
- local meta = minetest.get_meta(pos)
- local inv = meta:get_inventory()
- return inv:add_item("main", stack)
- end,
- can_insert = function(pos, node, stack, direction)
- local meta = minetest.get_meta(pos)
- local inv = meta:get_inventory()
- return inv:room_for_item("main", stack)
- end,
- input_inventory = "main",
- connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1}
- },
- after_place_node = pipeworks.after_place,
- after_dig_node = pipeworks.after_dig
-})
-
-minetest.override_item("default:chest_locked", {
- tiles = {
- "default_chest_top.png^pipeworks_tube_connection_wooden.png",
- "default_chest_top.png^pipeworks_tube_connection_wooden.png",
- "default_chest_side.png^pipeworks_tube_connection_wooden.png",
- "default_chest_side.png^pipeworks_tube_connection_wooden.png",
- "default_chest_side.png^pipeworks_tube_connection_wooden.png",
- "default_chest_lock.png"
- },
- groups = {choppy = 2, oddly_breakable_by_hand = 2, tubedevice = 1, tubedevice_receiver = 1},
- tube = {
- insert_object = function(pos, node, stack, direction)
- local meta = minetest.get_meta(pos)
- local inv = meta:get_inventory()
- return inv:add_item("main", stack)
- end,
- can_insert = function(pos, node, stack, direction)
- local meta = minetest.get_meta(pos)
- local inv = meta:get_inventory()
- return inv:room_for_item("main", stack)
- end,
- connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1}
- },
- after_place_node = function (pos, placer)
- local meta = minetest.get_meta(pos)
- meta:set_string("owner", placer:get_player_name() or "")
- meta:set_string("infotext", "Locked Chest (owned by "..
- meta:get_string("owner")..")")
- pipeworks.after_place(pos)
- end,
- after_dig_node = pipeworks.after_dig
-})
-
diff --git a/default_settings.lua b/default_settings.lua
new file mode 100644
index 0000000..6f661b5
--- /dev/null
+++ b/default_settings.lua
@@ -0,0 +1,40 @@
+-- Various settings
+
+local prefix = "pipeworks_"
+
+local settings = {
+ enable_pipes = true,
+ enable_autocrafter = true,
+ enable_deployer = true,
+ enable_dispenser = true,
+ enable_node_breaker = true,
+ enable_teleport_tube = true,
+ enable_pipe_devices = true,
+ enable_redefines = true,
+ enable_mese_tube = true,
+ enable_detector_tube = true,
+ enable_digiline_detector_tube = true,
+ enable_conductor_tube = true,
+ enable_accelerator_tube = true,
+ enable_crossing_tube = true,
+ enable_sand_tube = true,
+ enable_mese_sand_tube = true,
+ enable_one_way_tube = true,
+ enable_priority_tube = true,
+ enable_cyclic_mode = true,
+ drop_on_routing_fail = false,
+
+ delete_item_on_clearobject = true,
+}
+
+for name, value in pairs(settings) do
+ local setting_type = type(value)
+ if setting_type == "boolean" then
+ pipeworks[name] = minetest.setting_getbool(prefix..name)
+ if pipeworks[name] == nil then
+ pipeworks[name] = value
+ end
+ else
+ pipeworks[name] = value
+ end
+end
diff --git a/default_settings.txt b/default_settings.txt
deleted file mode 100644
index b1aa331..0000000
--- a/default_settings.txt
+++ /dev/null
@@ -1,24 +0,0 @@
--- Various settings
-
-pipeworks.enable_pipes = true
-pipeworks.enable_autocrafter = true
-pipeworks.enable_deployer = true
-pipeworks.enable_dispenser = true
-pipeworks.enable_node_breaker = true
-pipeworks.enable_teleport_tube = true
-pipeworks.enable_pipe_devices = true
-pipeworks.enable_redefines = true
-pipeworks.enable_mese_tube = true
-pipeworks.enable_detector_tube = true
-pipeworks.enable_digiline_detector_tube = true
-pipeworks.enable_conductor_tube = true
-pipeworks.enable_accelerator_tube = true
-pipeworks.enable_crossing_tube = true
-pipeworks.enable_sand_tube = true
-pipeworks.enable_mese_sand_tube = true
-pipeworks.enable_one_way_tube = true
-pipeworks.enable_priority_tube = true
-pipeworks.enable_cyclic_mode = true
-pipeworks.drop_on_routing_fail = false
-
-pipeworks.delete_item_on_clearobject = true
diff --git a/devices.lua b/devices.lua
index e4c5f43..0121e2f 100644
--- a/devices.lua
+++ b/devices.lua
@@ -1,3 +1,84 @@
+
+-- rotation handlers
+
+function pipeworks.fix_after_rotation(pos, node, user, mode, new_param2)
+
+ if string.find(node.name, "spigot") then new_param2 = new_param2 % 4 end
+
+ newnode = string.gsub(node.name, "_on", "_off")
+ minetest.swap_node(pos, { name = newnode, param2 = new_param2 })
+ pipeworks.scan_for_pipe_objects(pos)
+
+ return true
+end
+
+function pipeworks.rotate_on_place(itemstack, placer, pointed_thing)
+
+ local playername = placer:get_player_name()
+ if not minetest.is_protected(pointed_thing.under, playername)
+ and not minetest.is_protected(pointed_thing.above, playername) then
+
+ local node = minetest.get_node(pointed_thing.under)
+
+ if (not placer:get_player_control().sneak)
+ and minetest.registered_nodes[node.name]
+ and minetest.registered_nodes[node.name].on_rightclick then
+ minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack)
+ else
+
+ local pitch = placer:get_look_pitch()
+ local above = pointed_thing.above
+ local under = pointed_thing.under
+ local fdir = minetest.dir_to_facedir(placer:get_look_dir())
+ local undernode = minetest.get_node(under)
+ local abovenode = minetest.get_node(above)
+ local uname = undernode.name
+ local aname = abovenode.name
+ local isabove = (above.x == under.x) and (above.z == under.z) and (pitch > 0)
+ local pos1 = above
+
+ -- check if the object should be turned vertically
+ if above.x == under.x
+ and above.z == under.z
+ and (
+ string.find(uname, "pipeworks:pipe_")
+ or string.find(uname, "pipeworks:storage_")
+ or string.find(uname, "pipeworks:expansion_")
+ or ( string.find(uname, "pipeworks:grating") and not isabove )
+ or ( string.find(uname, "pipeworks:pump_") and not isabove )
+
+ or (
+ ( string.find(uname, "pipeworks:valve")
+ or string.find(uname, "pipeworks:entry_panel")
+ or string.find(uname, "pipeworks:flow_sensor") )
+ and minetest.facedir_to_dir(undernode.param2).y ~= 0 )
+ )
+ then
+ fdir = 17
+ end
+
+ if minetest.registered_nodes[uname]
+ and minetest.registered_nodes[uname]["buildable_to"] then
+ pos1 = under
+ end
+
+ if minetest.registered_nodes[minetest.get_node(pos1).name]
+ and not minetest.registered_nodes[minetest.get_node(pos1).name]["buildable_to"] then return end
+
+ local placednode = string.gsub(itemstack:get_name(), "_loaded", "_empty")
+ placednode = string.gsub(placednode, "_on", "_off")
+
+ minetest.add_node(pos1, {name = placednode, param2 = fdir })
+ pipeworks.scan_for_pipe_objects(pos1)
+
+ if not pipeworks.expect_infinite_stacks then
+ itemstack:take_item()
+ end
+ end
+ end
+ return itemstack
+end
+
-- List of devices that should participate in the autoplace algorithm
local pipereceptor_on = nil
@@ -58,6 +139,7 @@ for s in ipairs(states) do
groups = dgroups,
sounds = default.node_sound_wood_defaults(),
walkable = true,
+ pipe_connections = { top = 1 },
after_place_node = function(pos)
pipeworks.scan_for_pipe_objects(pos)
end,
@@ -73,10 +155,11 @@ for s in ipairs(states) do
minetest.add_node(pos,{name="pipeworks:pump_off", param2 = node.param2})
end
}},
- on_punch = function(pos, node, puncher)
- local fdir = minetest.get_node(pos).param2
+ on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
+ local fdir = node.param2
minetest.add_node(pos, { name = "pipeworks:pump_"..states[3-s], param2 = fdir })
- end
+ end,
+ on_rotate = screwdriver.rotate_simple
})
minetest.register_node("pipeworks:valve_"..states[s].."_empty", {
@@ -89,22 +172,20 @@ for s in ipairs(states) do
paramtype2 = "facedir",
selection_box = {
type = "fixed",
- fixed = { -8/16, -4/16, -5/16, 8/16, 5/16, 5/16 }
+ fixed = { -5/16, -4/16, -8/16, 5/16, 5/16, 8/16 }
},
collision_box = {
type = "fixed",
- fixed = { -8/16, -4/16, -5/16, 8/16, 5/16, 5/16 }
+ fixed = { -5/16, -4/16, -8/16, 5/16, 5/16, 8/16 }
},
groups = dgroups,
sounds = default.node_sound_wood_defaults(),
walkable = true,
- after_place_node = function(pos)
- pipeworks.scan_for_pipe_objects(pos)
- end,
+ on_place = pipeworks.rotate_on_place,
after_dig_node = function(pos)
pipeworks.scan_for_pipe_objects(pos)
end,
- drop = "pipeworks:valve_off_empty",
+ drop = "pipeworks:valve_off_empty",
mesecons = {effector = {
action_on = function (pos, node)
minetest.add_node(pos,{name="pipeworks:valve_on_empty", param2 = node.param2})
@@ -113,10 +194,11 @@ for s in ipairs(states) do
minetest.add_node(pos,{name="pipeworks:valve_off_empty", param2 = node.param2})
end
}},
- on_punch = function(pos, node, puncher)
- local fdir = minetest.get_node(pos).param2
+ on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
+ local fdir = node.param2
minetest.add_node(pos, { name = "pipeworks:valve_"..states[3-s].."_empty", param2 = fdir })
- end
+ end,
+ on_rotate = pipeworks.fix_after_rotation
})
end
@@ -130,18 +212,16 @@ minetest.register_node("pipeworks:valve_on_loaded", {
paramtype2 = "facedir",
selection_box = {
type = "fixed",
- fixed = { -8/16, -4/16, -5/16, 8/16, 5/16, 5/16 }
+ fixed = { -5/16, -4/16, -8/16, 5/16, 5/16, 8/16 }
},
collision_box = {
type = "fixed",
- fixed = { -8/16, -4/16, -5/16, 8/16, 5/16, 5/16 }
+ fixed = { -5/16, -4/16, -8/16, 5/16, 5/16, 8/16 }
},
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
- after_place_node = function(pos)
- pipeworks.scan_for_pipe_objects(pos)
- end,
+ on_place = pipeworks.rotate_on_place,
after_dig_node = function(pos)
pipeworks.scan_for_pipe_objects(pos)
end,
@@ -154,10 +234,11 @@ minetest.register_node("pipeworks:valve_on_loaded", {
minetest.add_node(pos,{name="pipeworks:valve_off_empty", param2 = node.param2})
end
}},
- on_punch = function(pos, node, puncher)
- local fdir = minetest.get_node(pos).param2
+ on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
+ local fdir = node.param2
minetest.add_node(pos, { name = "pipeworks:valve_off_empty", param2 = fdir })
- end
+ end,
+ on_rotate = pipeworks.fix_after_rotation
})
-- grating
@@ -172,17 +253,24 @@ minetest.register_node("pipeworks:grating", {
"pipeworks_grating_sides.png",
"pipeworks_grating_sides.png"
},
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = { -0.49, -0.49, -0.49, 0.49, 0.5, 0.49 }
+ },
sunlight_propagates = true,
paramtype = "light",
groups = {snappy=3, pipe=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
+ pipe_connections = { top = 1 },
after_place_node = function(pos)
pipeworks.scan_for_pipe_objects(pos)
end,
after_dig_node = function(pos)
pipeworks.scan_for_pipe_objects(pos)
end,
+ on_rotate = false
})
-- outlet spigot
@@ -198,6 +286,8 @@ minetest.register_node("pipeworks:spigot", {
groups = {snappy=3, pipe=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
+ pipe_connections = { left=1, right=1, front=1, back=1,
+ left_param2 = 3, right_param2 = 1, front_param2 = 2, back_param2 = 0 },
after_place_node = function(pos)
pipeworks.scan_for_pipe_objects(pos)
end,
@@ -211,7 +301,8 @@ minetest.register_node("pipeworks:spigot", {
collision_box = {
type = "fixed",
fixed = { -2/16, -6/16, -2/16, 2/16, 2/16, 8/16 }
- }
+ },
+ on_rotate = pipeworks.fix_after_rotation
})
minetest.register_node("pipeworks:spigot_pouring", {
@@ -236,7 +327,10 @@ minetest.register_node("pipeworks:spigot_pouring", {
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
+ pipe_connections = { left=1, right=1, front=1, back=1,
+ left_param2 = 3, right_param2 = 1, front_param2 = 2, back_param2 = 0 },
after_place_node = function(pos)
+ minetest.set_node(pos, { name = "pipeworks:spigot", param2 = minetest.get_node(pos).param2 })
pipeworks.scan_for_pipe_objects(pos)
end,
after_dig_node = function(pos)
@@ -251,6 +345,7 @@ minetest.register_node("pipeworks:spigot_pouring", {
fixed = { -2/16, -6/16, -2/16, 2/16, 2/16, 8/16 }
},
drop = "pipeworks:spigot",
+ on_rotate = pipeworks.fix_after_rotation
})
-- sealed pipe entry/exit (horizontal pipe passing through a metal
@@ -274,66 +369,13 @@ minetest.register_node("pipeworks:entry_panel_empty", {
groups = {snappy=3, pipe=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
- after_place_node = function(pos)
- pipeworks.scan_for_pipe_objects(pos)
- end,
+ on_place = pipeworks.rotate_on_place,
after_dig_node = function(pos)
pipeworks.scan_for_pipe_objects(pos)
end,
selection_box = panel_cbox,
collision_box = panel_cbox,
- on_place = function(itemstack, placer, pointed_thing)
- local playername = placer:get_player_name()
- if not minetest.is_protected(pointed_thing.under, playername)
- and not minetest.is_protected(pointed_thing.above, playername) then
- local node = minetest.get_node(pointed_thing.under)
-
- if not minetest.registered_nodes[node.name]
- or not minetest.registered_nodes[node.name].on_rightclick then
- local pitch = placer:get_look_pitch()
- local above = pointed_thing.above
- local under = pointed_thing.under
- local fdir = minetest.dir_to_facedir(placer:get_look_dir())
- local undernode = minetest.get_node(under)
- local abovenode = minetest.get_node(above)
- local uname = undernode.name
- local aname = abovenode.name
- local isabove = (above.x == under.x) and (above.z == under.z) and (pitch > 0)
- local pos1 = above
-
- if above.x == under.x
- and above.z == under.z
- and ( string.find(uname, "pipeworks:pipe_")
- or string.find(uname, "pipeworks:storage_")
- or string.find(uname, "pipeworks:expansion_")
- or ( string.find(uname, "pipeworks:grating") and not isabove )
- or ( string.find(uname, "pipeworks:pump_") and not isabove )
- or ( string.find(uname, "pipeworks:entry_panel")
- and undernode.param2 == 13 )
- )
- then
- fdir = 13
- end
-
- if minetest.registered_nodes[uname]["buildable_to"] then
- pos1 = under
- 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 })
- pipeworks.scan_for_pipe_objects(pos1)
-
- if not pipeworks.expect_infinite_stacks then
- itemstack:take_item()
- end
-
- else
- minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack)
- end
- end
- return itemstack
- end
+ on_rotate = pipeworks.fix_after_rotation
})
minetest.register_node("pipeworks:entry_panel_loaded", {
@@ -346,15 +388,14 @@ minetest.register_node("pipeworks:entry_panel_loaded", {
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
- after_place_node = function(pos)
- pipeworks.scan_for_pipe_objects(pos)
- end,
+ on_place = pipeworks.rotate_on_place,
after_dig_node = function(pos)
pipeworks.scan_for_pipe_objects(pos)
end,
selection_box = panel_cbox,
collision_box = panel_cbox,
- drop = "pipeworks:entry_panel_empty"
+ drop = "pipeworks:entry_panel_empty",
+ on_rotate = pipeworks.fix_after_rotation
})
minetest.register_node("pipeworks:flow_sensor_empty", {
@@ -368,9 +409,7 @@ minetest.register_node("pipeworks:flow_sensor_empty", {
groups = {snappy=3, pipe=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
- after_place_node = function(pos)
- pipeworks.scan_for_pipe_objects(pos)
- end,
+ on_place = pipeworks.rotate_on_place,
after_dig_node = function(pos)
pipeworks.scan_for_pipe_objects(pos)
end,
@@ -382,18 +421,19 @@ minetest.register_node("pipeworks:flow_sensor_empty", {
selection_box = {
type = "fixed",
fixed = {
- { -8/16, -2/16, -2/16, 8/16, 2/16, 2/16 },
- { -4/16, -3/16, -3/16, 4/16, 3/16, 3/16 },
+ { -2/16, -2/16, -8/16, 2/16, 2/16, 8/16 },
+ { -3/16, -3/16, -4/16, 3/16, 3/16, 4/16 },
}
},
collision_box = {
type = "fixed",
fixed = {
- { -8/16, -2/16, -2/16, 8/16, 2/16, 2/16 },
- { -4/16, -3/16, -3/16, 4/16, 3/16, 3/16 },
+ { -2/16, -2/16, -8/16, 2/16, 2/16, 8/16 },
+ { -3/16, -3/16, -4/16, 3/16, 3/16, 4/16 },
}
},
- mesecons = pipereceptor_off
+ mesecons = pipereceptor_off,
+ on_rotate = pipeworks.fix_after_rotation
})
minetest.register_node("pipeworks:flow_sensor_loaded", {
@@ -407,9 +447,7 @@ minetest.register_node("pipeworks:flow_sensor_loaded", {
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
- after_place_node = function(pos)
- pipeworks.scan_for_pipe_objects(pos)
- end,
+ on_place = pipeworks.rotate_on_place,
after_dig_node = function(pos)
pipeworks.scan_for_pipe_objects(pos)
end,
@@ -421,19 +459,20 @@ minetest.register_node("pipeworks:flow_sensor_loaded", {
selection_box = {
type = "fixed",
fixed = {
- { -8/16, -2/16, -2/16, 8/16, 2/16, 2/16 },
- { -4/16, -3/16, -3/16, 4/16, 3/16, 3/16 },
+ { -2/16, -2/16, -8/16, 2/16, 2/16, 8/16 },
+ { -3/16, -3/16, -4/16, 3/16, 3/16, 4/16 },
}
},
collision_box = {
type = "fixed",
fixed = {
- { -8/16, -2/16, -2/16, 8/16, 2/16, 2/16 },
- { -4/16, -3/16, -3/16, 4/16, 3/16, 3/16 },
+ { -2/16, -2/16, -8/16, 2/16, 2/16, 8/16 },
+ { -3/16, -3/16, -4/16, 3/16, 3/16, 4/16 },
}
},
drop = "pipeworks:flow_sensor_empty",
- mesecons = pipereceptor_on
+ mesecons = pipereceptor_on,
+ on_rotate = pipeworks.fix_after_rotation
})
-- tanks
@@ -466,6 +505,7 @@ for fill = 0, 10 do
sounds = default.node_sound_wood_defaults(),
walkable = true,
drop = "pipeworks:storage_tank_0",
+ pipe_connections = { top = 1, bottom = 1},
after_place_node = function(pos)
pipeworks.look_for_stackable_tanks(pos)
pipeworks.scan_for_pipe_objects(pos)
@@ -473,6 +513,7 @@ for fill = 0, 10 do
after_dig_node = function(pos)
pipeworks.scan_for_pipe_objects(pos)
end,
+ on_rotate = false
})
minetest.register_node("pipeworks:storage_tank_"..fill, {
@@ -492,6 +533,7 @@ for fill = 0, 10 do
sounds = default.node_sound_wood_defaults(),
walkable = true,
drop = "pipeworks:storage_tank_0",
+ pipe_connections = { top = 1, bottom = 1},
after_place_node = function(pos)
pipeworks.look_for_stackable_tanks(pos)
pipeworks.scan_for_pipe_objects(pos)
@@ -499,6 +541,7 @@ for fill = 0, 10 do
after_dig_node = function(pos)
pipeworks.scan_for_pipe_objects(pos)
end,
+ on_rotate = false
})
end
@@ -514,6 +557,7 @@ minetest.register_node("pipeworks:fountainhead", {
groups = {snappy=3, pipe=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
+ pipe_connections = { bottom = 1 },
after_place_node = function(pos)
pipeworks.scan_for_pipe_objects(pos)
end,
@@ -533,6 +577,7 @@ minetest.register_node("pipeworks:fountainhead", {
type = "fixed",
fixed = { -2/16, -8/16, -2/16, 2/16, 8/16, 2/16 }
},
+ on_rotate = false
})
minetest.register_node("pipeworks:fountainhead_pouring", {
@@ -545,7 +590,9 @@ minetest.register_node("pipeworks:fountainhead_pouring", {
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
+ pipe_connections = { bottom = 1 },
after_place_node = function(pos)
+ minetest.set_node(pos, { name = "pipeworks:fountainhead", param2 = minetest.get_node(pos).param2 })
pipeworks.scan_for_pipe_objects(pos)
end,
after_dig_node = function(pos)
@@ -564,9 +611,28 @@ minetest.register_node("pipeworks:fountainhead_pouring", {
type = "fixed",
fixed = { -2/16, -8/16, -2/16, 2/16, 8/16, 2/16 }
},
- drop = "pipeworks:fountainhead"
+ drop = "pipeworks:fountainhead",
+ on_rotate = false
})
minetest.register_alias("pipeworks:valve_off_loaded", "pipeworks:valve_off_empty")
minetest.register_alias("pipeworks:entry_panel", "pipeworks:entry_panel_empty")
+minetest.register_lbm({
+ name = "pipeworks:rotate_valves_flowsensors",
+ label = "Flip pipeworks valves and flow sensors around X/Z",
+ run_at_every_load = false,
+ nodenames = {
+ "pipeworks:flow_sensor_empty",
+ "pipeworks:flow_sensor_loaded",
+ "pipeworks:valve_off_empty",
+ "pipeworks:valve_on_empty",
+ "pipeworks:valve_off_loaded",
+ },
+ action = function(pos, node)
+ local dir = minetest.facedir_to_dir(node.param2)
+ local newdir = { x=dir.z, y=dir.y, z=dir.x }
+ local newfdir = minetest.dir_to_facedir(newdir)
+ minetest.swap_node(pos, { name = node.name, param2 = newfdir })
+ end
+})
diff --git a/filter-injector.lua b/filter-injector.lua
index 72f7bad..4870501 100644
--- a/filter-injector.lua
+++ b/filter-injector.lua
@@ -1,3 +1,5 @@
+local fs_helpers = pipeworks.fs_helpers
+
local function delay(x)
return (function() return x end)
end
@@ -169,7 +171,7 @@ local function punch_filter(data, filtpos, filtnode, msg)
is_fake_player = ":pipeworks",
get_wielded_item = delay(ItemStack(nil))
} -- TODO: use a mechanism as the wielder one
- local dir = minetest.facedir_to_right_dir(filtnode.param2)
+ local dir = pipeworks.facedir_to_right_dir(filtnode.param2)
local frompos = vector.subtract(filtpos, dir)
local fromnode = minetest.get_node(frompos)
if not fromnode then return end
@@ -194,6 +196,19 @@ local function punch_filter(data, filtpos, filtnode, msg)
["technic:tool_workshop"] = "src",
}
+ -- make sure there's something appropriate to inject the item into
+ local todir = pipeworks.facedir_to_right_dir(filtnode.param2)
+ local topos = vector.add(filtpos, todir)
+ local tonode = minetest.get_node(topos)
+ local todef = minetest.registered_nodes[tonode.name]
+
+ if not todef
+ or not (minetest.get_item_group(tonode.name, "tube") == 1
+ or minetest.get_item_group(tonode.name, "tubedevice") == 1
+ or minetest.get_item_group(tonode.name, "tubedevice_receiver") == 1) then
+ return
+ end
+
if fromtube then fromtube.input_inventory = input_special_cases[fromnode.name] or fromtube.input_inventory end
if not (fromtube and fromtube.input_inventory) then return end
diff --git a/flowing_logic.lua b/flowing_logic.lua
index 5166b15..e1c0bf5 100644
--- a/flowing_logic.lua
+++ b/flowing_logic.lua
@@ -31,19 +31,32 @@ pipeworks.check_for_inflows = function(pos,node)
{x=pos.x-1,y=pos.y,z=pos.z},
{x=pos.x+1,y=pos.y,z=pos.z},
{x=pos.x,y=pos.y,z=pos.z-1},
- {x=pos.x,y=pos.y,z=pos.z+1}, }
+ {x=pos.x,y=pos.y,z=pos.z+1},
+ }
local newnode = false
local source = false
- for i =1,6 do
+ for i = 1, 6 do
if newnode then break end
- local name = minetest.get_node(coords[i]).name
+ local testnode = minetest.get_node(coords[i])
+ local name = testnode.name
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
source = minetest.get_meta(coords[i]):get_string("source")
if source == minetest.pos_to_string(pos) then break end
end
- newnode = string.gsub(node.name,"empty","loaded")
- source = {x=coords[i].x,y=coords[i].y,z=coords[i].z}
+ if string.find(name, "valve") or string.find(name, "sensor") then
+
+ if ((i == 3 or i == 4) and minetest.facedir_to_dir(testnode.param2).x ~= 0)
+ or ((i == 5 or i == 6) and minetest.facedir_to_dir(testnode.param2).z ~= 0)
+ or ((i == 1 or i == 2) and minetest.facedir_to_dir(testnode.param2).y ~= 0) then
+
+ newnode = string.gsub(node.name,"empty","loaded")
+ source = {x=coords[i].x,y=coords[i].y,z=coords[i].z}
+ end
+ else
+ newnode = string.gsub(node.name,"empty","loaded")
+ source = {x=coords[i].x,y=coords[i].y,z=coords[i].z}
+ end
end
end
if newnode then
diff --git a/init.lua b/init.lua
index 499f6ba..1766e2d 100644
--- a/init.lua
+++ b/init.lua
@@ -13,7 +13,7 @@ local DEBUG = false
pipeworks.worldpath = minetest.get_worldpath()
pipeworks.modpath = minetest.get_modpath("pipeworks")
-dofile(pipeworks.modpath.."/default_settings.txt")
+dofile(pipeworks.modpath.."/default_settings.lua")
-- Read the external config file if it exists.
local worldsettingspath = pipeworks.worldpath.."/pipeworks_settings.txt"
@@ -41,6 +41,11 @@ pipeworks.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
pipeworks.liquid_texture = "default_water.png"
+pipeworks.button_off = {text="", texture="pipeworks_button_off.png", addopts="false;false;pipeworks_button_interm.png"}
+pipeworks.button_on = {text="", texture="pipeworks_button_on.png", addopts="false;false;pipeworks_button_interm.png"}
+pipeworks.button_base = "image_button[0,4.3;1,0.6"
+pipeworks.button_label = "label[0.9,4.31;Allow splitting incoming stacks from tubes]"
+
-- Helper functions
function pipeworks.fix_image_names(table, replacement)
@@ -108,7 +113,10 @@ dofile(pipeworks.modpath.."/wielder.lua")
if pipeworks.enable_pipes then dofile(pipeworks.modpath.."/pipes.lua") end
if pipeworks.enable_teleport_tube then dofile(pipeworks.modpath.."/teleport_tube.lua") end
if pipeworks.enable_pipe_devices then dofile(pipeworks.modpath.."/devices.lua") end
-if pipeworks.enable_redefines then dofile(pipeworks.modpath.."/compat.lua") end
+if pipeworks.enable_redefines then
+ dofile(pipeworks.modpath.."/compat-chests.lua")
+ dofile(pipeworks.modpath.."/compat-furnaces.lua")
+end
if pipeworks.enable_autocrafter then dofile(pipeworks.modpath.."/autocrafter.lua") end
minetest.register_alias("pipeworks:pipe", "pipeworks:pipe_110000_empty")
diff --git a/item_transport.lua b/item_transport.lua
index ab1ce55..43adeea 100644
--- a/item_transport.lua
+++ b/item_transport.lua
@@ -1,3 +1,8 @@
+local luaentity = pipeworks.luaentity
+local enable_max_limit = minetest.setting_get("pipeworks_enable_items_per_tube_limit")
+local max_tube_limit = tonumber(minetest.setting_get("pipeworks_max_items_per_tube")) or 30
+if enable_max_limit == nil then enable_max_limit = true end
+
function pipeworks.tube_item(pos, item)
error("obsolete pipeworks.tube_item() called; change caller to use pipeworks.tube_inject_item() instead")
end
@@ -29,6 +34,21 @@ function pipeworks.notvel(tbl, vel)
return tbl2
end
+local tube_item_count = {}
+
+minetest.register_globalstep(function(dtime)
+ if not luaentity.entities then
+ return
+ end
+ tube_item_count = {}
+ for id, entity in pairs(luaentity.entities) do
+ if entity.name == "pipeworks:tubed_item" then
+ local h = minetest.hash_node_position(vector.round(entity._pos))
+ tube_item_count[h] = (tube_item_count[h] or 0) + 1
+ end
+ end
+end)
+
local function go_next(pos, velocity, stack)
local next_positions = {}
local max_priority = 0
@@ -55,7 +75,7 @@ local function go_next(pos, velocity, stack)
end
for _, vect in ipairs(can_go) do
local npos = vector.add(pos, vect)
- minetest.load_position(npos)
+ pipeworks.load_position(npos)
local node = minetest.get_node(npos)
local reg_node = minetest.registered_nodes[node.name]
if reg_node then
@@ -75,6 +95,17 @@ local function go_next(pos, velocity, stack)
end
end
+ if enable_max_limit then
+ local h = minetest.hash_node_position(pos)
+ local itemcount = tube_item_count[h] or 0
+ if itemcount > max_tube_limit then
+ cmeta:set_string("the_tube_was", minetest.serialize(cnode))
+ print("[Pipeworks] Warning - a tube at "..minetest.pos_to_string(pos).." broke due to too many items ("..itemcount..")")
+ minetest.swap_node(pos, {name = "pipeworks:broken_tube_1"})
+ pipeworks.scan_for_tube_objects(pos)
+ end
+ end
+
if not next_positions[1] then
return false, nil
end
@@ -200,15 +231,13 @@ luaentity.register_entity("pipeworks:tubed_item", {
end,
on_step = function(self, dtime)
+ local pos = self:getpos()
if self.start_pos == nil then
- local pos = self:getpos()
self.start_pos = vector.round(pos)
self:setpos(pos)
end
- local pos = self:getpos()
local stack = ItemStack(self.itemstring)
- local drop_pos
local velocity = self:getvelocity()
@@ -219,13 +248,14 @@ luaentity.register_entity("pipeworks:tubed_item", {
moved = true
end
local vel = {x = velocity.x / speed, y = velocity.y / speed, z = velocity.z / speed, speed = speed}
+ local moved_by = vector.distance(pos, self.start_pos)
- if vector.distance(pos, self.start_pos) >= 1 then
+ if moved_by >= 1 then
self.start_pos = vector.add(self.start_pos, vel)
moved = true
end
- minetest.load_position(self.start_pos)
+ pipeworks.load_position(self.start_pos)
local node = minetest.get_node(self.start_pos)
if moved and minetest.get_item_group(node.name, "tubedevice_receiver") == 1 then
local leftover
@@ -239,6 +269,7 @@ luaentity.register_entity("pipeworks:tubed_item", {
return
end
velocity = vector.multiply(velocity, -1)
+ self:setpos(vector.subtract(self.start_pos, vector.multiply(vel, moved_by - 1)))
self:setvelocity(velocity)
self:set_item(leftover:to_string())
return
@@ -251,24 +282,25 @@ luaentity.register_entity("pipeworks:tubed_item", {
local rev_node = minetest.get_node(vector.round(vector.add(self.start_pos,rev_dir)))
local tube_present = minetest.get_item_group(rev_node.name,"tubedevice") == 1
if not found_next then
- if pipeworks.drop_on_routing_fail or not tube_present then
- drop_pos = minetest.find_node_near(vector.add(self.start_pos, velocity), 1, "air")
- if drop_pos then
- -- Using add_item instead of item_drop since this makes pipeworks backward
- -- compatible with Minetest 0.4.13.
- -- Using item_drop here makes Minetest 0.4.13 crash.
- minetest.add_item(drop_pos, stack)
- self:remove()
- return
- end
+ if pipeworks.drop_on_routing_fail or not tube_present or
+ minetest.get_item_group(rev_node.name,"tube") ~= 1 then
+ -- Using add_item instead of item_drop since this makes pipeworks backward
+ -- compatible with Minetest 0.4.13.
+ -- Using item_drop here makes Minetest 0.4.13 crash.
+ local dropped_item = minetest.add_item(self.start_pos, stack)
+ dropped_item:setvelocity(vector.multiply(velocity, 5))
+ self:remove()
+ return
else
velocity = vector.multiply(velocity, -1)
+ self:setpos(vector.subtract(self.start_pos, vector.multiply(vel, moved_by - 1)))
self:setvelocity(velocity)
end
end
if new_velocity and not vector.equals(velocity, new_velocity) then
- self:setpos(self.start_pos)
+ local nvelr = math.abs(new_velocity.x + new_velocity.y + new_velocity.z)
+ self:setpos(vector.add(self.start_pos, vector.multiply(new_velocity, (moved_by - 1) / nvelr)))
self:setvelocity(new_velocity)
end
end
diff --git a/luaentity.lua b/luaentity.lua
index 665e055..ab7280c 100644
--- a/luaentity.lua
+++ b/luaentity.lua
@@ -1,6 +1,7 @@
local max_entity_id = 1000000000000 -- If you need more, there's a problem with your code
-luaentity = {}
+local luaentity = {}
+pipeworks.luaentity = luaentity
luaentity.registered_entities = {}
@@ -23,6 +24,22 @@ end
local function read_entities()
local t = read_file()
for _, entity in pairs(t) do
+
+ local x=entity.start_pos.x
+ local y=entity.start_pos.y
+ local z=entity.start_pos.z
+
+ x=math.max(-30912,x)
+ y=math.max(-30912,y)
+ z=math.max(-30912,z)
+ x=math.min(30927,x)
+ y=math.min(30927,y)
+ z=math.min(30927,z)
+
+ entity.start_pos.x = x
+ entity.start_pos.y = y
+ entity.start_pos.z = z
+
setmetatable(entity, luaentity.registered_entities[entity.name])
end
return t
@@ -52,32 +69,27 @@ local function get_blockpos(pos)
end
local active_blocks = {} -- These only contain active blocks near players (i.e., not forceloaded ones)
-local handle_active_blocks_step = 2
-local handle_active_blocks_timer = 0
-minetest.register_globalstep(function(dtime)
- handle_active_blocks_timer = handle_active_blocks_timer + dtime
- if handle_active_blocks_timer >= handle_active_blocks_step then
- handle_active_blocks_timer = handle_active_blocks_timer - handle_active_blocks_step
- local active_block_range = tonumber(minetest.setting_get("active_block_range")) or 2
- local new_active_blocks = {}
- for _, player in ipairs(minetest.get_connected_players()) do
- local blockpos = get_blockpos(player:getpos())
- local minp = vector.subtract(blockpos, active_block_range)
- local maxp = vector.add(blockpos, active_block_range)
- for x = minp.x, maxp.x do
- for y = minp.y, maxp.y do
- for z = minp.z, maxp.z do
- local pos = {x = x, y = y, z = z}
- new_active_blocks[minetest.hash_node_position(pos)] = pos
- end
- end
- end
+local move_entities_globalstep_part1 = function(dtime)
+ local active_block_range = tonumber(minetest.setting_get("active_block_range")) or 2
+ local new_active_blocks = {}
+ for _, player in ipairs(minetest.get_connected_players()) do
+ local blockpos = get_blockpos(player:getpos())
+ local minp = vector.subtract(blockpos, active_block_range)
+ local maxp = vector.add(blockpos, active_block_range)
+
+ for x = minp.x, maxp.x do
+ for y = minp.y, maxp.y do
+ for z = minp.z, maxp.z do
+ local pos = {x = x, y = y, z = z}
+ new_active_blocks[minetest.hash_node_position(pos)] = pos
+ end
+ end
end
- active_blocks = new_active_blocks
- -- todo: callbacks on block load/unload
end
-end)
+ active_blocks = new_active_blocks
+ -- todo: callbacks on block load/unload
+end
local function is_active(pos)
return active_blocks[minetest.hash_node_position(get_blockpos(pos))] ~= nil
@@ -309,7 +321,7 @@ function luaentity.get_objects_inside_radius(pos, radius)
end
end
-minetest.register_globalstep(function(dtime)
+local move_entities_globalstep_part2 = function(dtime)
if not luaentity.entities then
luaentity.entities = read_entities()
end
@@ -348,4 +360,16 @@ minetest.register_globalstep(function(dtime)
end
end
end
+end
+
+local handle_active_blocks_step = 0.2
+local handle_active_blocks_timer = 0.1
+
+minetest.register_globalstep(function(dtime)
+ handle_active_blocks_timer = handle_active_blocks_timer + dtime
+ if handle_active_blocks_timer >= handle_active_blocks_step then
+ handle_active_blocks_timer = handle_active_blocks_timer - handle_active_blocks_step
+ move_entities_globalstep_part1(dtime)
+ move_entities_globalstep_part2(dtime)
+ end
end)
diff --git a/models/pipeworks_flow_sensor.obj b/models/pipeworks_flow_sensor.obj
index f0ba87e..56ba370 100644
--- a/models/pipeworks_flow_sensor.obj
+++ b/models/pipeworks_flow_sensor.obj
@@ -1,114 +1,114 @@
-# Blender v2.69 (sub 0) OBJ File: 'pipe-flow-sensor.blend'
+# Blender v2.72 (sub 0) OBJ File: 'pipe-flow-sensor.blend'
# www.blender.org
o Cube.001
-v -0.468750 -0.153248 -0.030483
-v -0.500000 -0.153248 -0.030483
-v -0.468750 -0.153248 0.030483
-v -0.500000 -0.153248 0.030483
-v -0.468750 -0.129917 0.086808
-v -0.500000 -0.129917 0.086808
-v -0.468750 -0.086808 0.129917
-v -0.500000 -0.086808 0.129917
-v -0.468750 -0.030483 0.153248
-v -0.500000 -0.030483 0.153248
-v -0.468750 0.030483 0.153248
-v -0.500000 0.030483 0.153248
-v -0.468750 0.086808 0.129917
-v -0.500000 0.086808 0.129917
-v -0.468750 0.129917 0.086808
-v -0.500000 0.129917 0.086808
-v -0.468750 0.153248 0.030483
-v -0.500000 0.153247 0.030483
-v -0.468750 0.153248 -0.030483
-v -0.500000 0.153248 -0.030483
-v -0.468750 0.129917 -0.086808
-v -0.500000 0.129917 -0.086808
-v -0.468750 0.086808 -0.129917
-v -0.500000 0.086808 -0.129917
-v -0.468750 0.030483 -0.153248
-v -0.500000 0.030483 -0.153248
-v -0.468750 -0.030483 -0.153248
-v -0.500000 -0.030483 -0.153248
-v -0.468750 -0.086808 -0.129917
-v -0.500000 -0.086808 -0.129917
-v -0.468750 -0.129917 -0.086808
-v -0.500000 -0.129917 -0.086808
-v -0.468750 -0.122598 -0.024386
-v -0.468750 -0.122598 0.024386
-v -0.468750 -0.103934 0.069446
-v -0.468750 -0.069446 0.103934
-v -0.468750 -0.024386 0.122598
-v -0.468750 0.024386 0.122598
-v -0.468750 0.069446 0.103934
-v -0.468750 0.103934 0.069446
-v -0.468750 0.122598 0.024386
-v -0.468750 0.122598 -0.024386
-v -0.468750 0.103934 -0.069446
-v -0.468750 0.069446 -0.103934
-v -0.468750 0.024386 -0.122598
-v -0.468750 -0.024387 -0.122598
-v -0.468750 -0.069447 -0.103934
-v -0.468750 -0.103934 -0.069446
-v -0.468750 -0.000000 -0.000000
-v -0.500000 -0.000000 -0.000000
-v 0.468750 -0.069446 0.103934
-v 0.468750 -0.103933 0.069447
-v 0.468750 -0.122598 0.024387
-v 0.468750 -0.122598 -0.024386
-v 0.500000 -0.129917 -0.086807
-v 0.468750 -0.129917 -0.086807
-v 0.500000 -0.086808 -0.129917
-v 0.468750 -0.086808 -0.129917
-v 0.500000 -0.030483 -0.153247
-v 0.468750 -0.030483 -0.153247
-v 0.500000 0.030483 -0.153247
-v 0.468750 0.030483 -0.153247
-v 0.500000 0.086808 -0.129917
-v 0.468750 0.086808 -0.129917
-v 0.500000 0.129917 -0.086808
-v 0.468750 0.129917 -0.086808
-v 0.500000 0.153248 -0.030483
-v 0.468750 0.153248 -0.030483
-v 0.500000 0.153248 0.030483
-v 0.468750 0.153248 0.030483
-v 0.500000 0.129917 0.086808
-v 0.468750 0.129917 0.086808
-v 0.500000 0.086808 0.129917
-v 0.468750 0.086808 0.129917
-v 0.500000 0.030483 0.153248
-v 0.468750 0.030483 0.153248
-v 0.500000 -0.030483 0.153248
-v 0.468750 -0.030483 0.153248
-v 0.500000 -0.086808 0.129917
-v 0.468750 -0.086808 0.129917
-v 0.500000 -0.129917 0.086808
-v 0.468750 -0.129917 0.086808
-v 0.500000 -0.153247 0.030483
-v 0.468750 -0.153247 0.030483
-v 0.500000 -0.153247 -0.030483
-v 0.468750 -0.153247 -0.030483
-v 0.468750 -0.024386 0.122598
-v 0.468750 0.024387 0.122598
-v 0.468750 0.069447 0.103934
-v 0.468750 0.103934 0.069447
-v 0.468750 0.122598 0.024387
-v 0.468750 0.122598 -0.024386
-v 0.468750 0.103934 -0.069446
-v 0.468750 0.069447 -0.103933
-v 0.468750 0.024387 -0.122598
-v 0.468750 -0.024386 -0.122598
-v 0.468750 -0.069446 -0.103933
-v 0.468750 -0.103933 -0.069446
-v 0.468750 0.000000 0.000000
-v 0.500000 0.000000 0.000000
-v 0.250000 -0.187500 0.187500
-v -0.250000 -0.187500 0.187500
-v -0.250000 -0.187500 -0.187500
-v 0.250000 -0.187500 -0.187500
-v 0.250000 0.187500 0.187500
-v -0.250000 0.187500 0.187500
-v -0.250000 0.187500 -0.187500
-v 0.250000 0.187500 -0.187500
+v -0.030483 -0.153248 0.468750
+v -0.030483 -0.153248 0.500000
+v 0.030483 -0.153248 0.468750
+v 0.030483 -0.153248 0.500000
+v 0.086808 -0.129917 0.468750
+v 0.086808 -0.129917 0.500000
+v 0.129917 -0.086808 0.468750
+v 0.129917 -0.086808 0.500000
+v 0.153248 -0.030483 0.468750
+v 0.153248 -0.030483 0.500000
+v 0.153248 0.030483 0.468750
+v 0.153248 0.030483 0.500000
+v 0.129917 0.086808 0.468750
+v 0.129917 0.086808 0.500000
+v 0.086808 0.129917 0.468750
+v 0.086808 0.129917 0.500000
+v 0.030483 0.153248 0.468750
+v 0.030483 0.153247 0.500000
+v -0.030483 0.153248 0.468750
+v -0.030483 0.153248 0.500000
+v -0.086808 0.129917 0.468750
+v -0.086808 0.129917 0.500000
+v -0.129917 0.086808 0.468750
+v -0.129917 0.086808 0.500000
+v -0.153248 0.030483 0.468750
+v -0.153248 0.030483 0.500000
+v -0.153248 -0.030483 0.468750
+v -0.153248 -0.030483 0.500000
+v -0.129917 -0.086808 0.468750
+v -0.129917 -0.086808 0.500000
+v -0.086808 -0.129917 0.468750
+v -0.086808 -0.129917 0.500000
+v -0.024386 -0.122598 0.468750
+v 0.024386 -0.122598 0.468750
+v 0.069446 -0.103934 0.468750
+v 0.103934 -0.069446 0.468750
+v 0.122598 -0.024386 0.468750
+v 0.122598 0.024386 0.468750
+v 0.103934 0.069446 0.468750
+v 0.069446 0.103934 0.468750
+v 0.024386 0.122598 0.468750
+v -0.024386 0.122598 0.468750
+v -0.069446 0.103934 0.468750
+v -0.103934 0.069446 0.468750
+v -0.122598 0.024386 0.468750
+v -0.122598 -0.024387 0.468750
+v -0.103934 -0.069447 0.468750
+v -0.069446 -0.103934 0.468750
+v -0.000000 -0.000000 0.468750
+v -0.000000 -0.000000 0.500000
+v 0.103934 -0.069446 -0.468750
+v 0.069446 -0.103933 -0.468750
+v 0.024386 -0.122598 -0.468750
+v -0.024386 -0.122598 -0.468750
+v -0.086808 -0.129917 -0.500000
+v -0.086808 -0.129917 -0.468750
+v -0.129917 -0.086808 -0.500000
+v -0.129917 -0.086808 -0.468750
+v -0.153248 -0.030483 -0.500000
+v -0.153248 -0.030483 -0.468750
+v -0.153248 0.030483 -0.500000
+v -0.153248 0.030483 -0.468750
+v -0.129917 0.086808 -0.500000
+v -0.129917 0.086808 -0.468750
+v -0.086808 0.129917 -0.500000
+v -0.086808 0.129917 -0.468750
+v -0.030483 0.153248 -0.500000
+v -0.030483 0.153248 -0.468750
+v 0.030483 0.153248 -0.500000
+v 0.030483 0.153248 -0.468750
+v 0.086808 0.129917 -0.500000
+v 0.086808 0.129917 -0.468750
+v 0.129917 0.086808 -0.500000
+v 0.129917 0.086808 -0.468750
+v 0.153248 0.030483 -0.500000
+v 0.153248 0.030483 -0.468750
+v 0.153248 -0.030483 -0.500000
+v 0.153248 -0.030483 -0.468750
+v 0.129917 -0.086808 -0.500000
+v 0.129917 -0.086808 -0.468750
+v 0.086808 -0.129917 -0.500000
+v 0.086808 -0.129917 -0.468750
+v 0.030483 -0.153247 -0.500000
+v 0.030483 -0.153247 -0.468750
+v -0.030483 -0.153247 -0.500000
+v -0.030483 -0.153247 -0.468750
+v 0.122598 -0.024386 -0.468750
+v 0.122598 0.024387 -0.468750
+v 0.103934 0.069447 -0.468750
+v 0.069446 0.103934 -0.468750
+v 0.024386 0.122598 -0.468750
+v -0.024386 0.122598 -0.468750
+v -0.069446 0.103934 -0.468750
+v -0.103934 0.069447 -0.468750
+v -0.122598 0.024387 -0.468750
+v -0.122598 -0.024386 -0.468750
+v -0.103934 -0.069446 -0.468750
+v -0.069446 -0.103933 -0.468750
+v 0.000000 0.000000 -0.468750
+v 0.000000 0.000000 -0.500000
+v 0.187500 -0.187500 -0.250000
+v 0.187500 -0.187500 0.250000
+v -0.187500 -0.187500 0.250000
+v -0.187500 -0.187500 -0.250000
+v 0.187500 0.187500 -0.250000
+v 0.187500 0.187500 0.250000
+v -0.187500 0.187500 0.250000
+v -0.187500 0.187500 -0.250000
vt 0.813725 0.460784
vt 0.774510 0.460784
vt 0.774510 0.500000
@@ -181,40 +181,11 @@ vt 0.460784 0.441176
vt 0.460784 0.127451
vt 0.500000 0.127451
vt 0.500000 0.441176
-vt 0.402558 0.546671
-vt 0.440212 0.531167
-vt 0.460591 0.633009
-vt 0.373738 0.575320
-vt 0.358141 0.612752
-vt 0.358141 0.653267
-vt 0.373738 0.690699
vt 0.402558 0.719348
-vt 0.440212 0.734852
-vt 0.480969 0.734852
vt 0.518623 0.719348
-vt 0.547443 0.690699
-vt 0.563040 0.653267
-vt 0.563040 0.612752
-vt 0.547443 0.575320
-vt 0.518623 0.546671
-vt 0.480969 0.531167
-vt 0.639882 0.546671
-vt 0.677537 0.531167
-vt 0.697915 0.633009
-vt 0.611063 0.575320
-vt 0.595466 0.612752
-vt 0.595466 0.653267
-vt 0.611063 0.690699
vt 0.639882 0.719347
-vt 0.677537 0.734852
-vt 0.718293 0.734852
vt 0.755947 0.719347
-vt 0.784767 0.690699
-vt 0.800364 0.653267
-vt 0.800364 0.612752
-vt 0.784767 0.575320
vt 0.755948 0.546671
-vt 0.718293 0.531167
vt 0.892157 0.441176
vt 0.892157 0.127451
vt 0.931373 0.127451
@@ -269,122 +240,141 @@ vt 0.009804 0.254902
vt 0.323529 0.254902
vt 0.323529 0.490196
vt 0.009804 0.490196
+vn 0.000000 -1.000000 -0.000000
+vn 0.382700 -0.923900 -0.000000
+vn 0.707100 -0.707100 -0.000000
+vn 0.923900 -0.382700 -0.000000
+vn 1.000000 0.000000 0.000000
+vn 0.923900 0.382700 0.000000
+vn 0.707100 0.707100 0.000000
+vn 0.382700 0.923900 0.000000
+vn 0.000000 1.000000 0.000000
+vn -0.382700 0.923900 0.000000
+vn -0.707100 0.707100 0.000000
+vn -0.923900 0.382700 0.000000
+vn -1.000000 -0.000000 0.000000
+vn -0.923900 -0.382700 -0.000000
+vn -0.382700 -0.923900 -0.000000
+vn -0.707100 -0.707100 -0.000000
+vn 0.000000 -0.000000 1.000000
+vn 0.000000 0.000000 -1.000000
+g Cube.001_Cube.001_None
s off
-f 1/1 3/2 4/3 2/4
-f 3/2 5/5 6/6 4/3
-f 5/5 7/7 8/8 6/6
-f 7/7 9/9 10/10 8/8
-f 9/9 11/11 12/12 10/10
-f 11/11 13/13 14/14 12/12
-f 13/13 15/15 16/16 14/14
-f 15/15 17/17 18/18 16/16
-f 17/17 19/19 20/20 18/18
-f 19/19 21/21 22/22 20/20
-f 21/21 23/23 24/24 22/22
-f 23/23 25/25 26/26 24/24
-f 25/27 27/28 28/29 26/30
-f 27/28 29/31 30/32 28/29
-f 31/33 1/1 2/4 32/34
-f 29/31 31/33 32/34 30/32
-f 4/35 50/36 2/37
-f 1/38 49/39 3/40
-f 3/40 49/39 5/41
-f 5/41 49/39 7/42
-f 7/42 49/39 9/43
-f 9/43 49/39 11/44
-f 11/44 49/39 13/45
-f 13/45 49/39 15/46
-f 15/46 49/39 17/47
-f 17/47 49/39 19/48
-f 19/48 49/39 21/49
-f 21/49 49/39 23/50
-f 23/50 49/39 25/51
-f 25/51 49/39 27/52
-f 27/52 49/39 29/53
-f 29/53 49/39 31/54
-f 31/54 49/39 1/38
-f 2/37 50/36 32/55
-f 32/55 50/36 30/56
-f 30/56 50/36 28/57
-f 28/57 50/36 26/58
-f 26/58 50/36 24/59
-f 24/59 50/36 22/60
-f 22/60 50/36 20/61
-f 20/61 50/36 18/62
-f 18/62 50/36 16/63
-f 16/63 50/36 14/64
-f 14/64 50/36 12/65
-f 12/65 50/36 10/66
-f 10/66 50/36 8/67
-f 8/67 50/36 6/68
-f 6/68 50/36 4/35
-f 41/69 91/70 92/71 42/72
-f 81/73 83/74 100/75
-f 79/76 81/73 100/75
-f 77/77 79/76 100/75
-f 75/78 77/77 100/75
-f 73/79 75/78 100/75
-f 71/80 73/79 100/75
-f 69/81 71/80 100/75
-f 67/82 69/81 100/75
-f 65/83 67/82 100/75
-f 63/84 65/83 100/75
-f 61/85 63/84 100/75
-f 59/86 61/85 100/75
-f 57/87 59/86 100/75
-f 55/88 57/87 100/75
-f 85/89 55/88 100/75
-f 56/90 86/91 99/92
-f 58/93 56/90 99/92
-f 60/94 58/93 99/92
-f 62/95 60/94 99/92
-f 64/96 62/95 99/92
-f 66/97 64/96 99/92
-f 68/98 66/97 99/92
-f 70/99 68/98 99/92
-f 72/100 70/99 99/92
-f 74/101 72/100 99/92
-f 76/102 74/101 99/92
-f 78/103 76/102 99/92
-f 80/104 78/103 99/92
-f 82/105 80/104 99/92
-f 84/106 82/105 99/92
-f 86/91 84/106 99/92
-f 83/74 85/89 100/75
-f 58/22 57/21 55/19 56/20
-f 56/20 55/19 85/17 86/18
-f 60/24 59/23 57/21 58/22
-f 62/26 61/25 59/23 60/24
-f 64/29 63/28 61/27 62/30
-f 66/32 65/31 63/28 64/29
-f 68/34 67/33 65/31 66/32
-f 70/4 69/1 67/33 68/34
-f 72/3 71/2 69/1 70/4
-f 74/6 73/5 71/2 72/3
-f 76/8 75/7 73/5 74/6
-f 78/10 77/9 75/7 76/8
-f 80/12 79/11 77/9 78/10
-f 82/14 81/13 79/11 80/12
-f 84/16 83/15 81/13 82/14
-f 86/18 85/17 83/15 84/16
-f 36/107 51/108 87/109 37/110
-f 34/111 53/112 52/113 35/114
-f 47/115 97/116 98/117 48/118
-f 33/119 54/120 53/112 34/111
-f 35/114 52/113 51/108 36/107
-f 48/118 98/117 54/120 33/119
-f 46/121 96/122 97/116 47/115
-f 45/123 95/124 96/122 46/121
-f 44/125 94/126 95/124 45/123
-f 43/127 93/128 94/126 44/125
-f 42/72 92/71 93/128 43/127
-f 40/129 90/130 91/70 41/69
-f 39/131 89/132 90/130 40/129
-f 38/133 88/134 89/132 39/131
-f 37/110 87/109 88/135 38/136
-f 105/137 106/138 102/139 101/140
-f 106/141 107/142 103/143 102/144
-f 107/145 108/146 104/147 103/148
-f 108/149 105/150 101/151 104/152
-f 101/153 102/154 103/155 104/156
-f 108/157 107/158 106/159 105/160
+f 1/1/1 3/2/1 4/3/1 2/4/1
+f 3/2/2 5/5/2 6/6/2 4/3/2
+f 5/5/3 7/7/3 8/8/3 6/6/3
+f 7/7/4 9/9/4 10/10/4 8/8/4
+f 9/9/5 11/11/5 12/12/5 10/10/5
+f 11/11/6 13/13/6 14/14/6 12/12/6
+f 13/13/7 15/15/7 16/16/7 14/14/7
+f 15/15/8 17/17/8 18/18/8 16/16/8
+f 17/17/9 19/19/9 20/20/9 18/18/9
+f 19/19/10 21/21/10 22/22/10 20/20/10
+f 21/21/11 23/23/11 24/24/11 22/22/11
+f 23/23/12 25/25/12 26/26/12 24/24/12
+f 25/27/13 27/28/13 28/29/13 26/30/13
+f 27/28/14 29/31/14 30/32/14 28/29/14
+f 31/33/15 1/1/15 2/4/15 32/34/15
+f 29/31/16 31/33/16 32/34/16 30/32/16
+f 4/35/17 50/36/17 2/37/17
+f 1/38/18 49/39/18 3/40/18
+f 3/40/18 49/39/18 5/41/18
+f 5/41/18 49/39/18 7/42/18
+f 7/42/18 49/39/18 9/43/18
+f 9/43/18 49/39/18 11/44/18
+f 11/44/18 49/39/18 13/45/18
+f 13/45/18 49/39/18 15/46/18
+f 15/46/18 49/39/18 17/47/18
+f 17/47/18 49/39/18 19/48/18
+f 19/48/18 49/39/18 21/49/18
+f 21/49/18 49/39/18 23/50/18
+f 23/50/18 49/39/18 25/51/18
+f 25/51/18 49/39/18 27/52/18
+f 27/52/18 49/39/18 29/53/18
+f 29/53/18 49/39/18 31/54/18
+f 31/54/18 49/39/18 1/38/18
+f 2/37/17 50/36/17 32/55/17
+f 32/55/17 50/36/17 30/56/17
+f 30/56/17 50/36/17 28/57/17
+f 28/57/17 50/36/17 26/58/17
+f 26/58/17 50/36/17 24/59/17
+f 24/59/17 50/36/17 22/60/17
+f 22/60/17 50/36/17 20/61/17
+f 20/61/17 50/36/17 18/62/17
+f 18/62/17 50/36/17 16/63/17
+f 16/63/17 50/36/17 14/64/17
+f 14/64/17 50/36/17 12/65/17
+f 12/65/17 50/36/17 10/66/17
+f 10/66/17 50/36/17 8/67/17
+f 8/67/17 50/36/17 6/68/17
+f 6/68/17 50/36/17 4/35/17
+f 41/69/9 91/70/9 92/71/9 42/72/9
+f 81/55/18 83/37/18 100/36/18
+f 79/56/18 81/55/18 100/36/18
+f 77/57/18 79/56/18 100/36/18
+f 75/58/18 77/57/18 100/36/18
+f 73/59/18 75/58/18 100/36/18
+f 71/73/18 73/59/18 100/36/18
+f 69/61/18 71/73/18 100/36/18
+f 67/62/18 69/61/18 100/36/18
+f 65/74/18 67/62/18 100/36/18
+f 63/64/18 65/74/18 100/36/18
+f 61/65/18 63/64/18 100/36/18
+f 59/66/18 61/65/18 100/36/18
+f 57/67/18 59/66/18 100/36/18
+f 55/68/18 57/67/18 100/36/18
+f 85/35/18 55/68/18 100/36/18
+f 56/54/17 86/38/17 99/39/17
+f 58/53/17 56/54/17 99/39/17
+f 60/52/17 58/53/17 99/39/17
+f 62/51/17 60/52/17 99/39/17
+f 64/50/17 62/51/17 99/39/17
+f 66/75/17 64/50/17 99/39/17
+f 68/48/17 66/75/17 99/39/17
+f 70/47/17 68/48/17 99/39/17
+f 72/76/17 70/47/17 99/39/17
+f 74/45/17 72/76/17 99/39/17
+f 76/44/17 74/45/17 99/39/17
+f 78/43/17 76/44/17 99/39/17
+f 80/42/17 78/43/17 99/39/17
+f 82/77/17 80/42/17 99/39/17
+f 84/40/17 82/77/17 99/39/17
+f 86/38/17 84/40/17 99/39/17
+f 83/37/18 85/35/18 100/36/18
+f 58/22/16 57/21/16 55/19/16 56/20/16
+f 56/20/15 55/19/15 85/17/15 86/18/15
+f 60/24/14 59/23/14 57/21/14 58/22/14
+f 62/26/13 61/25/13 59/23/13 60/24/13
+f 64/29/12 63/28/12 61/27/12 62/30/12
+f 66/32/11 65/31/11 63/28/11 64/29/11
+f 68/34/10 67/33/10 65/31/10 66/32/10
+f 70/4/9 69/1/9 67/33/9 68/34/9
+f 72/3/8 71/2/8 69/1/8 70/4/8
+f 74/6/7 73/5/7 71/2/7 72/3/7
+f 76/8/6 75/7/6 73/5/6 74/6/6
+f 78/10/5 77/9/5 75/7/5 76/8/5
+f 80/12/4 79/11/4 77/9/4 78/10/4
+f 82/14/3 81/13/3 79/11/3 80/12/3
+f 84/16/2 83/15/2 81/13/2 82/14/2
+f 86/18/1 85/17/1 83/15/1 84/16/1
+f 36/78/4 51/79/4 87/80/4 37/81/4
+f 34/82/2 53/83/2 52/84/2 35/85/2
+f 47/86/16 97/87/16 98/88/16 48/89/16
+f 33/90/1 54/91/1 53/83/1 34/82/1
+f 35/85/3 52/84/3 51/79/3 36/78/3
+f 48/89/15 98/88/15 54/91/15 33/90/15
+f 46/92/14 96/93/14 97/87/14 47/86/14
+f 45/94/13 95/95/13 96/93/13 46/92/13
+f 44/96/12 94/97/12 95/95/12 45/94/12
+f 43/98/11 93/99/11 94/97/11 44/96/11
+f 42/72/10 92/71/10 93/99/10 43/98/10
+f 40/100/8 90/101/8 91/70/8 41/69/8
+f 39/102/7 89/103/7 90/101/7 40/100/7
+f 38/104/6 88/105/6 89/103/6 39/102/6
+f 37/81/5 87/80/5 88/106/5 38/107/5
+f 105/108/5 106/109/5 102/110/5 101/111/5
+f 106/112/17 107/113/17 103/114/17 102/115/17
+f 107/116/13 108/117/13 104/118/13 103/119/13
+f 108/120/18 105/121/18 101/122/18 104/123/18
+f 101/124/1 102/125/1 103/126/1 104/127/1
+f 108/128/9 107/129/9 106/130/9 105/131/9
diff --git a/models/pipeworks_valve_off.obj b/models/pipeworks_valve_off.obj
index c5f71be..fef2394 100644
--- a/models/pipeworks_valve_off.obj
+++ b/models/pipeworks_valve_off.obj
@@ -1,131 +1,130 @@
-# Blender v2.69 (sub 0) OBJ File: 'pipe-valve-off.blend'
+# Blender v2.72 (sub 0) OBJ File: 'pipe-valve-off.blend'
# www.blender.org
-mtllib pipeworks_valve_off.mtl
o Cube.003
-v 0.062500 0.281250 -0.312500
-v 0.062500 0.281250 0.093750
-v -0.062500 0.281250 0.093750
-v -0.062500 0.281250 -0.312500
-v 0.062500 0.343750 -0.312500
-v 0.062500 0.343750 0.093750
-v -0.062500 0.343750 0.093750
-v -0.062500 0.343750 -0.312500
+v -0.312500 0.281250 -0.062500
+v 0.093750 0.281250 -0.062500
+v 0.093750 0.281250 0.062500
+v -0.312500 0.281250 0.062500
+v -0.312500 0.343750 -0.062500
+v 0.093750 0.343750 -0.062500
+v 0.093750 0.343750 0.062500
+v -0.312500 0.343750 0.062500
+v -0.031250 0.250000 -0.031250
v 0.031250 0.250000 -0.031250
v 0.031250 0.250000 0.031250
v -0.031250 0.250000 0.031250
-v -0.031250 0.250000 -0.031250
+v -0.031250 0.281250 -0.031250
v 0.031250 0.281250 -0.031250
v 0.031250 0.281250 0.031250
v -0.031250 0.281250 0.031250
-v -0.031250 0.281250 -0.031250
+v -0.250000 -0.250000 -0.250000
v 0.250000 -0.250000 -0.250000
v 0.250000 -0.250000 0.250000
v -0.250000 -0.250000 0.250000
-v -0.250000 -0.250000 -0.250000
+v -0.250000 0.250000 -0.250000
v 0.250000 0.250000 -0.250000
v 0.250000 0.250000 0.250000
v -0.250000 0.250000 0.250000
-v -0.250000 0.250000 -0.250000
-v -0.468750 -0.153248 -0.030483
-v -0.500000 -0.153248 -0.030483
-v -0.468750 -0.153248 0.030483
-v -0.500000 -0.153248 0.030483
-v -0.468750 -0.129917 0.086808
-v -0.500000 -0.129917 0.086808
-v -0.468750 -0.086808 0.129917
-v -0.500000 -0.086808 0.129917
-v -0.468750 -0.030483 0.153248
-v -0.500000 -0.030483 0.153248
-v -0.468750 0.030483 0.153248
-v -0.500000 0.030483 0.153248
-v -0.468750 0.086808 0.129917
-v -0.500000 0.086808 0.129917
-v -0.468750 0.129917 0.086808
-v -0.500000 0.129917 0.086808
-v -0.468750 0.153248 0.030483
-v -0.500000 0.153247 0.030483
-v -0.468750 0.153248 -0.030483
-v -0.500000 0.153248 -0.030483
-v -0.468750 0.129917 -0.086808
-v -0.500000 0.129917 -0.086808
-v -0.468750 0.086808 -0.129917
-v -0.500000 0.086808 -0.129917
-v -0.468750 0.030483 -0.153248
-v -0.500000 0.030483 -0.153248
-v -0.468750 -0.030483 -0.153248
-v -0.500000 -0.030483 -0.153248
-v -0.468750 -0.086808 -0.129917
-v -0.500000 -0.086808 -0.129917
-v -0.468750 -0.129917 -0.086808
-v -0.500000 -0.129917 -0.086808
-v -0.468750 -0.122598 -0.024386
-v -0.468750 -0.122598 0.024386
-v -0.468750 -0.103934 0.069446
-v -0.468750 -0.069446 0.103934
-v -0.468750 -0.024386 0.122598
-v -0.468750 0.024386 0.122598
-v -0.468750 0.069446 0.103934
-v -0.468750 0.103934 0.069446
-v -0.468750 0.122598 0.024386
-v -0.468750 0.122598 -0.024386
-v -0.468750 0.103934 -0.069446
-v -0.468750 0.069446 -0.103934
-v -0.468750 0.024386 -0.122598
-v -0.468750 -0.024387 -0.122598
-v -0.468750 -0.069447 -0.103934
-v -0.468750 -0.103934 -0.069446
-v -0.468750 -0.000000 -0.000000
-v -0.500000 -0.000000 -0.000000
-v 0.468750 -0.069446 0.103934
-v 0.468750 -0.103933 0.069447
-v 0.468750 -0.122598 0.024387
-v 0.468750 -0.122598 -0.024386
-v 0.500000 -0.129917 -0.086807
-v 0.468750 -0.129917 -0.086807
-v 0.500000 -0.086808 -0.129917
-v 0.468750 -0.086808 -0.129917
-v 0.500000 -0.030483 -0.153247
-v 0.468750 -0.030483 -0.153247
-v 0.500000 0.030483 -0.153247
-v 0.468750 0.030483 -0.153247
-v 0.500000 0.086808 -0.129917
-v 0.468750 0.086808 -0.129917
-v 0.500000 0.129917 -0.086808
-v 0.468750 0.129917 -0.086808
-v 0.500000 0.153248 -0.030483
-v 0.468750 0.153248 -0.030483
-v 0.500000 0.153248 0.030483
-v 0.468750 0.153248 0.030483
-v 0.500000 0.129917 0.086808
-v 0.468750 0.129917 0.086808
-v 0.500000 0.086808 0.129917
-v 0.468750 0.086808 0.129917
-v 0.500000 0.030483 0.153248
-v 0.468750 0.030483 0.153248
-v 0.500000 -0.030483 0.153248
-v 0.468750 -0.030483 0.153248
-v 0.500000 -0.086807 0.129917
-v 0.468750 -0.086808 0.129917
-v 0.500000 -0.129917 0.086808
-v 0.468750 -0.129917 0.086808
-v 0.500000 -0.153247 0.030483
-v 0.468750 -0.153247 0.030483
-v 0.500000 -0.153247 -0.030483
-v 0.468750 -0.153247 -0.030483
-v 0.468750 -0.024386 0.122598
-v 0.468750 0.024387 0.122598
-v 0.468750 0.069447 0.103934
-v 0.468750 0.103934 0.069447
-v 0.468750 0.122598 0.024387
-v 0.468750 0.122598 -0.024386
-v 0.468750 0.103934 -0.069446
-v 0.468750 0.069447 -0.103933
-v 0.468750 0.024387 -0.122598
-v 0.468750 -0.024386 -0.122598
-v 0.468750 -0.069446 -0.103933
-v 0.468750 -0.103933 -0.069446
-v 0.468750 0.000000 0.000000
-v 0.500000 0.000000 0.000000
+v -0.030483 -0.153248 0.468750
+v -0.030483 -0.153248 0.500000
+v 0.030483 -0.153248 0.468750
+v 0.030483 -0.153248 0.500000
+v 0.086808 -0.129917 0.468750
+v 0.086808 -0.129917 0.500000
+v 0.129917 -0.086808 0.468750
+v 0.129917 -0.086808 0.500000
+v 0.153248 -0.030483 0.468750
+v 0.153248 -0.030483 0.500000
+v 0.153248 0.030483 0.468750
+v 0.153248 0.030483 0.500000
+v 0.129917 0.086808 0.468750
+v 0.129917 0.086808 0.500000
+v 0.086808 0.129917 0.468750
+v 0.086808 0.129917 0.500000
+v 0.030483 0.153248 0.468750
+v 0.030483 0.153247 0.500000
+v -0.030483 0.153248 0.468750
+v -0.030483 0.153248 0.500000
+v -0.086808 0.129917 0.468750
+v -0.086808 0.129917 0.500000
+v -0.129917 0.086808 0.468750
+v -0.129917 0.086808 0.500000
+v -0.153248 0.030483 0.468750
+v -0.153248 0.030483 0.500000
+v -0.153248 -0.030483 0.468750
+v -0.153248 -0.030483 0.500000
+v -0.129917 -0.086808 0.468750
+v -0.129917 -0.086808 0.500000
+v -0.086808 -0.129917 0.468750
+v -0.086808 -0.129917 0.500000
+v -0.024386 -0.122598 0.468750
+v 0.024386 -0.122598 0.468750
+v 0.069446 -0.103934 0.468750
+v 0.103934 -0.069446 0.468750
+v 0.122598 -0.024386 0.468750
+v 0.122598 0.024386 0.468750
+v 0.103934 0.069446 0.468750
+v 0.069446 0.103934 0.468750
+v 0.024386 0.122598 0.468750
+v -0.024386 0.122598 0.468750
+v -0.069446 0.103934 0.468750
+v -0.103934 0.069446 0.468750
+v -0.122598 0.024386 0.468750
+v -0.122598 -0.024387 0.468750
+v -0.103934 -0.069447 0.468750
+v -0.069446 -0.103934 0.468750
+v -0.000000 -0.000000 0.468750
+v -0.000000 -0.000000 0.500000
+v 0.103934 -0.069446 -0.468750
+v 0.069447 -0.103933 -0.468750
+v 0.024387 -0.122598 -0.468750
+v -0.024386 -0.122598 -0.468750
+v -0.086808 -0.129917 -0.500000
+v -0.086808 -0.129917 -0.468750
+v -0.129917 -0.086808 -0.500000
+v -0.129917 -0.086808 -0.468750
+v -0.153247 -0.030483 -0.500000
+v -0.153247 -0.030483 -0.468750
+v -0.153247 0.030483 -0.500000
+v -0.153247 0.030483 -0.468750
+v -0.129917 0.086808 -0.500000
+v -0.129917 0.086808 -0.468750
+v -0.086808 0.129917 -0.500000
+v -0.086808 0.129917 -0.468750
+v -0.030483 0.153248 -0.500000
+v -0.030483 0.153248 -0.468750
+v 0.030483 0.153248 -0.500000
+v 0.030483 0.153248 -0.468750
+v 0.086808 0.129917 -0.500000
+v 0.086808 0.129917 -0.468750
+v 0.129917 0.086808 -0.500000
+v 0.129917 0.086808 -0.468750
+v 0.153248 0.030483 -0.500000
+v 0.153248 0.030483 -0.468750
+v 0.153248 -0.030483 -0.500000
+v 0.153248 -0.030483 -0.468750
+v 0.129917 -0.086807 -0.500000
+v 0.129917 -0.086808 -0.468750
+v 0.086808 -0.129917 -0.500000
+v 0.086808 -0.129917 -0.468750
+v 0.030483 -0.153247 -0.500000
+v 0.030483 -0.153247 -0.468750
+v -0.030483 -0.153247 -0.500000
+v -0.030483 -0.153247 -0.468750
+v 0.122598 -0.024386 -0.468750
+v 0.122598 0.024387 -0.468750
+v 0.103934 0.069447 -0.468750
+v 0.069447 0.103934 -0.468750
+v 0.024387 0.122598 -0.468750
+v -0.024386 0.122598 -0.468750
+v -0.069446 0.103934 -0.468750
+v -0.103933 0.069447 -0.468750
+v -0.122598 0.024387 -0.468750
+v -0.122598 -0.024386 -0.468750
+v -0.103933 -0.069446 -0.468750
+v -0.069446 -0.103933 -0.468750
+v 0.000000 0.000000 -0.468750
+v 0.000000 0.000000 -0.500000
vt 0.265625 0.234375
vt 0.468750 0.234375
vt 0.468750 0.265625
@@ -262,40 +261,6 @@ vt 0.585938 0.257812
vt 0.585938 0.007812
vt 0.617188 0.007812
vt 0.617188 0.257812
-vt 0.538433 0.340928
-vt 0.568449 0.328495
-vt 0.584693 0.410160
-vt 0.515460 0.363901
-vt 0.503028 0.393916
-vt 0.503028 0.426405
-vt 0.515460 0.456420
-vt 0.538433 0.479393
-vt 0.568449 0.491826
-vt 0.600937 0.491826
-vt 0.630952 0.479393
-vt 0.653925 0.456420
-vt 0.666358 0.426405
-vt 0.666358 0.393916
-vt 0.653925 0.363901
-vt 0.630952 0.340928
-vt 0.600937 0.328495
-vt 0.727611 0.340928
-vt 0.757626 0.328495
-vt 0.773870 0.410160
-vt 0.704638 0.363901
-vt 0.692205 0.393916
-vt 0.692205 0.426405
-vt 0.704638 0.456420
-vt 0.727611 0.479393
-vt 0.757626 0.491826
-vt 0.790115 0.491826
-vt 0.820130 0.479393
-vt 0.843103 0.456420
-vt 0.855535 0.426405
-vt 0.855535 0.393916
-vt 0.843103 0.363901
-vt 0.820130 0.340928
-vt 0.790115 0.328495
vt 0.929688 0.257812
vt 0.929688 0.007812
vt 0.960938 0.007812
@@ -326,133 +291,151 @@ vt 0.492188 0.257812
vt 0.492188 0.007812
vt 0.992188 0.007812
vt 0.992188 0.257812
-usemtl None
+vn 0.000000 0.000000 -1.000000
+vn 1.000000 0.000000 0.000000
+vn -0.000000 0.000000 1.000000
+vn -1.000000 0.000000 -0.000000
+vn 0.000000 -1.000000 0.000000
+vn 0.000000 1.000000 0.000000
+vn 0.382700 -0.923900 -0.000000
+vn 0.707100 -0.707100 -0.000000
+vn 0.923900 -0.382700 0.000000
+vn 0.923900 0.382700 0.000000
+vn 0.707100 0.707100 0.000000
+vn 0.382700 0.923900 0.000000
+vn -0.382700 0.923900 0.000000
+vn -0.707100 0.707100 0.000000
+vn -0.923900 0.382700 -0.000000
+vn -0.923900 -0.382700 -0.000000
+vn -0.382700 -0.923900 -0.000000
+vn -0.707100 -0.707100 -0.000000
+g Cube.003_Cube.003_None
s off
-f 5/1 6/2 2/3 1/4
-f 6/5 7/6 3/7 2/8
-f 7/9 8/10 4/11 3/12
-f 8/13 5/14 1/15 4/16
-f 1/17 2/18 3/19 4/20
-f 8/21 7/22 6/23 5/24
-f 13/25 14/26 10/27 9/28
-f 14/29 15/30 11/31 10/32
-f 15/33 16/34 12/35 11/36
-f 16/37 13/38 9/39 12/40
-f 21/41 22/42 18/43 17/44
-f 22/45 23/46 19/47 18/48
-f 23/49 24/50 20/51 19/52
-f 24/53 21/54 17/55 20/56
-f 17/57 18/58 19/59 20/60
-f 24/61 23/62 22/63 21/64
-f 25/65 27/66 28/67 26/68
-f 27/66 29/69 30/70 28/67
-f 29/69 31/71 32/72 30/70
-f 31/71 33/73 34/74 32/72
-f 33/73 35/75 36/76 34/74
-f 35/75 37/77 38/78 36/76
-f 37/77 39/79 40/80 38/78
-f 39/79 41/81 42/82 40/80
-f 41/81 43/83 44/84 42/82
-f 43/83 45/85 46/86 44/84
-f 45/85 47/87 48/88 46/86
-f 47/87 49/89 50/90 48/88
-f 49/91 51/92 52/93 50/94
-f 51/92 53/95 54/96 52/93
-f 55/97 25/65 26/68 56/98
-f 53/95 55/97 56/98 54/96
-f 28/99 74/100 26/101
-f 25/102 73/103 27/104
-f 27/104 73/103 29/105
-f 29/105 73/103 31/106
-f 31/106 73/103 33/107
-f 33/107 73/103 35/108
-f 35/108 73/103 37/109
-f 37/109 73/103 39/110
-f 39/110 73/103 41/111
-f 41/111 73/103 43/112
-f 43/112 73/103 45/113
-f 45/113 73/103 47/114
-f 47/114 73/103 49/115
-f 49/115 73/103 51/116
-f 51/116 73/103 53/117
-f 53/117 73/103 55/118
-f 55/118 73/103 25/102
-f 26/101 74/100 56/119
-f 56/119 74/100 54/120
-f 54/120 74/100 52/121
-f 52/121 74/100 50/122
-f 50/122 74/100 48/123
-f 48/123 74/100 46/124
-f 46/124 74/100 44/125
-f 44/125 74/100 42/126
-f 42/126 74/100 40/127
-f 40/127 74/100 38/128
-f 38/128 74/100 36/129
-f 36/129 74/100 34/130
-f 34/130 74/100 32/131
-f 32/131 74/100 30/132
-f 30/132 74/100 28/99
-f 65/133 115/134 116/135 66/136
-f 105/137 107/138 124/139
-f 103/140 105/137 124/139
-f 101/141 103/140 124/139
-f 99/142 101/141 124/139
-f 97/143 99/142 124/139
-f 95/144 97/143 124/139
-f 93/145 95/144 124/139
-f 91/146 93/145 124/139
-f 89/147 91/146 124/139
-f 87/148 89/147 124/139
-f 85/149 87/148 124/139
-f 83/150 85/149 124/139
-f 81/151 83/150 124/139
-f 79/152 81/151 124/139
-f 109/153 79/152 124/139
-f 80/154 110/155 123/156
-f 82/157 80/154 123/156
-f 84/158 82/157 123/156
-f 86/159 84/158 123/156
-f 88/160 86/159 123/156
-f 90/161 88/160 123/156
-f 92/162 90/161 123/156
-f 94/163 92/162 123/156
-f 96/164 94/163 123/156
-f 98/165 96/164 123/156
-f 100/166 98/165 123/156
-f 102/167 100/166 123/156
-f 104/168 102/167 123/156
-f 106/169 104/168 123/156
-f 108/170 106/169 123/156
-f 110/155 108/170 123/156
-f 107/138 109/153 124/139
-f 82/86 81/85 79/83 80/84
-f 80/84 79/83 109/81 110/82
-f 84/88 83/87 81/85 82/86
-f 86/90 85/89 83/87 84/88
-f 88/93 87/92 85/91 86/94
-f 90/96 89/95 87/92 88/93
-f 92/98 91/97 89/95 90/96
-f 94/68 93/65 91/97 92/98
-f 96/67 95/66 93/65 94/68
-f 98/70 97/69 95/66 96/67
-f 100/72 99/71 97/69 98/70
-f 102/74 101/73 99/71 100/72
-f 104/76 103/75 101/73 102/74
-f 106/78 105/77 103/75 104/76
-f 108/80 107/79 105/77 106/78
-f 110/82 109/81 107/79 108/80
-f 60/171 75/172 111/173 61/174
-f 58/175 77/176 76/177 59/178
-f 71/179 121/180 122/181 72/182
-f 57/183 78/184 77/176 58/175
-f 59/178 76/177 75/172 60/171
-f 72/182 122/181 78/184 57/183
-f 70/185 120/186 121/180 71/179
-f 69/187 119/188 120/186 70/185
-f 68/189 118/190 119/188 69/187
-f 67/191 117/192 118/190 68/189
-f 66/136 116/135 117/192 67/191
-f 64/193 114/194 115/134 65/133
-f 63/195 113/196 114/194 64/193
-f 62/197 112/198 113/196 63/195
-f 61/174 111/173 112/199 62/200
+f 5/1/1 6/2/1 2/3/1 1/4/1
+f 6/5/2 7/6/2 3/7/2 2/8/2
+f 7/9/3 8/10/3 4/11/3 3/12/3
+f 8/13/4 5/14/4 1/15/4 4/16/4
+f 1/17/5 2/18/5 3/19/5 4/20/5
+f 8/21/6 7/22/6 6/23/6 5/24/6
+f 13/25/1 14/26/1 10/27/1 9/28/1
+f 14/29/2 15/30/2 11/31/2 10/32/2
+f 15/33/3 16/34/3 12/35/3 11/36/3
+f 16/37/4 13/38/4 9/39/4 12/40/4
+f 21/41/1 22/42/1 18/43/1 17/44/1
+f 22/45/2 23/46/2 19/47/2 18/48/2
+f 23/49/3 24/50/3 20/51/3 19/52/3
+f 24/53/4 21/54/4 17/55/4 20/56/4
+f 17/57/5 18/58/5 19/59/5 20/60/5
+f 24/61/6 23/62/6 22/63/6 21/64/6
+f 25/65/5 27/66/5 28/67/5 26/68/5
+f 27/66/7 29/69/7 30/70/7 28/67/7
+f 29/69/8 31/71/8 32/72/8 30/70/8
+f 31/71/9 33/73/9 34/74/9 32/72/9
+f 33/73/2 35/75/2 36/76/2 34/74/2
+f 35/75/10 37/77/10 38/78/10 36/76/10
+f 37/77/11 39/79/11 40/80/11 38/78/11
+f 39/79/12 41/81/12 42/82/12 40/80/12
+f 41/81/6 43/83/6 44/84/6 42/82/6
+f 43/83/13 45/85/13 46/86/13 44/84/13
+f 45/85/14 47/87/14 48/88/14 46/86/14
+f 47/87/15 49/89/15 50/90/15 48/88/15
+f 49/91/4 51/92/4 52/93/4 50/94/4
+f 51/92/16 53/95/16 54/96/16 52/93/16
+f 55/97/17 25/65/17 26/68/17 56/98/17
+f 53/95/18 55/97/18 56/98/18 54/96/18
+f 28/99/3 74/100/3 26/101/3
+f 25/102/1 73/103/1 27/104/1
+f 27/104/1 73/103/1 29/105/1
+f 29/105/1 73/103/1 31/106/1
+f 31/106/1 73/103/1 33/107/1
+f 33/107/1 73/103/1 35/108/1
+f 35/108/1 73/103/1 37/109/1
+f 37/109/1 73/103/1 39/110/1
+f 39/110/1 73/103/1 41/111/1
+f 41/111/1 73/103/1 43/112/1
+f 43/112/1 73/103/1 45/113/1
+f 45/113/1 73/103/1 47/114/1
+f 47/114/1 73/103/1 49/115/1
+f 49/115/1 73/103/1 51/116/1
+f 51/116/1 73/103/1 53/117/1
+f 53/117/1 73/103/1 55/118/1
+f 55/118/1 73/103/1 25/102/1
+f 26/101/3 74/100/3 56/119/3
+f 56/119/3 74/100/3 54/120/3
+f 54/120/3 74/100/3 52/121/3
+f 52/121/3 74/100/3 50/122/3
+f 50/122/3 74/100/3 48/123/3
+f 48/123/3 74/100/3 46/124/3
+f 46/124/3 74/100/3 44/125/3
+f 44/125/3 74/100/3 42/126/3
+f 42/126/3 74/100/3 40/127/3
+f 40/127/3 74/100/3 38/128/3
+f 38/128/3 74/100/3 36/129/3
+f 36/129/3 74/100/3 34/130/3
+f 34/130/3 74/100/3 32/131/3
+f 32/131/3 74/100/3 30/132/3
+f 30/132/3 74/100/3 28/99/3
+f 65/133/6 115/134/6 116/135/6 66/136/6
+f 105/119/1 107/101/1 124/100/1
+f 103/120/1 105/119/1 124/100/1
+f 101/121/1 103/120/1 124/100/1
+f 99/122/1 101/121/1 124/100/1
+f 97/123/1 99/122/1 124/100/1
+f 95/124/1 97/123/1 124/100/1
+f 93/125/1 95/124/1 124/100/1
+f 91/126/1 93/125/1 124/100/1
+f 89/127/1 91/126/1 124/100/1
+f 87/128/1 89/127/1 124/100/1
+f 85/129/1 87/128/1 124/100/1
+f 83/130/1 85/129/1 124/100/1
+f 81/131/1 83/130/1 124/100/1
+f 79/132/1 81/131/1 124/100/1
+f 109/99/1 79/132/1 124/100/1
+f 80/118/3 110/102/3 123/103/3
+f 82/117/3 80/118/3 123/103/3
+f 84/116/3 82/117/3 123/103/3
+f 86/115/3 84/116/3 123/103/3
+f 88/114/3 86/115/3 123/103/3
+f 90/113/3 88/114/3 123/103/3
+f 92/112/3 90/113/3 123/103/3
+f 94/111/3 92/112/3 123/103/3
+f 96/110/3 94/111/3 123/103/3
+f 98/109/3 96/110/3 123/103/3
+f 100/108/3 98/109/3 123/103/3
+f 102/107/3 100/108/3 123/103/3
+f 104/106/3 102/107/3 123/103/3
+f 106/105/3 104/106/3 123/103/3
+f 108/104/3 106/105/3 123/103/3
+f 110/102/3 108/104/3 123/103/3
+f 107/101/1 109/99/1 124/100/1
+f 82/86/18 81/85/18 79/83/18 80/84/18
+f 80/84/17 79/83/17 109/81/17 110/82/17
+f 84/88/16 83/87/16 81/85/16 82/86/16
+f 86/90/4 85/89/4 83/87/4 84/88/4
+f 88/93/15 87/92/15 85/91/15 86/94/15
+f 90/96/14 89/95/14 87/92/14 88/93/14
+f 92/98/13 91/97/13 89/95/13 90/96/13
+f 94/68/6 93/65/6 91/97/6 92/98/6
+f 96/67/12 95/66/12 93/65/12 94/68/12
+f 98/70/11 97/69/11 95/66/11 96/67/11
+f 100/72/10 99/71/10 97/69/10 98/70/10
+f 102/74/2 101/73/2 99/71/2 100/72/2
+f 104/76/9 103/75/9 101/73/9 102/74/9
+f 106/78/8 105/77/8 103/75/8 104/76/8
+f 108/80/7 107/79/7 105/77/7 106/78/7
+f 110/82/5 109/81/5 107/79/5 108/80/5
+f 60/137/9 75/138/9 111/139/9 61/140/9
+f 58/141/7 77/142/7 76/143/7 59/144/7
+f 71/145/18 121/146/18 122/147/18 72/148/18
+f 57/149/5 78/150/5 77/142/5 58/141/5
+f 59/144/8 76/143/8 75/138/8 60/137/8
+f 72/148/17 122/147/17 78/150/17 57/149/17
+f 70/151/16 120/152/16 121/146/16 71/145/16
+f 69/153/4 119/154/4 120/152/4 70/151/4
+f 68/155/15 118/156/15 119/154/15 69/153/15
+f 67/157/14 117/158/14 118/156/14 68/155/14
+f 66/136/13 116/135/13 117/158/13 67/157/13
+f 64/159/12 114/160/12 115/134/12 65/133/12
+f 63/161/11 113/162/11 114/160/11 64/159/11
+f 62/163/10 112/164/10 113/162/10 63/161/10
+f 61/140/2 111/139/2 112/165/2 62/166/2
diff --git a/models/pipeworks_valve_on.obj b/models/pipeworks_valve_on.obj
index ba08b30..0c8f8b0 100644
--- a/models/pipeworks_valve_on.obj
+++ b/models/pipeworks_valve_on.obj
@@ -1,131 +1,130 @@
-# Blender v2.69 (sub 0) OBJ File: 'pipe-valve-on.blend'
+# Blender v2.72 (sub 0) OBJ File: 'pipe-valve-on.blend'
# www.blender.org
-mtllib pipeworks_valve_on.mtl
o Cube.003
-v 0.312500 0.281250 0.062500
-v -0.093750 0.281250 0.062500
-v -0.093750 0.281250 -0.062500
-v 0.312500 0.281250 -0.062500
-v 0.312500 0.343750 0.062500
-v -0.093750 0.343750 0.062500
-v -0.093750 0.343750 -0.062500
-v 0.312500 0.343750 -0.062500
+v 0.062500 0.281250 -0.312500
+v 0.062500 0.281250 0.093750
+v -0.062500 0.281250 0.093750
+v -0.062500 0.281250 -0.312500
+v 0.062500 0.343750 -0.312500
+v 0.062500 0.343750 0.093750
+v -0.062500 0.343750 0.093750
+v -0.062500 0.343750 -0.312500
+v -0.031250 0.250000 -0.031250
v 0.031250 0.250000 -0.031250
v 0.031250 0.250000 0.031250
v -0.031250 0.250000 0.031250
-v -0.031250 0.250000 -0.031250
+v -0.031250 0.281250 -0.031250
v 0.031250 0.281250 -0.031250
v 0.031250 0.281250 0.031250
v -0.031250 0.281250 0.031250
-v -0.031250 0.281250 -0.031250
+v -0.250000 -0.250000 -0.250000
v 0.250000 -0.250000 -0.250000
v 0.250000 -0.250000 0.250000
v -0.250000 -0.250000 0.250000
-v -0.250000 -0.250000 -0.250000
+v -0.250000 0.250000 -0.250000
v 0.250000 0.250000 -0.250000
v 0.250000 0.250000 0.250000
v -0.250000 0.250000 0.250000
-v -0.250000 0.250000 -0.250000
-v -0.468750 -0.153248 -0.030483
-v -0.500000 -0.153248 -0.030483
-v -0.468750 -0.153248 0.030483
-v -0.500000 -0.153248 0.030483
-v -0.468750 -0.129917 0.086808
-v -0.500000 -0.129917 0.086808
-v -0.468750 -0.086808 0.129917
-v -0.500000 -0.086808 0.129917
-v -0.468750 -0.030483 0.153248
-v -0.500000 -0.030483 0.153248
-v -0.468750 0.030483 0.153248
-v -0.500000 0.030483 0.153248
-v -0.468750 0.086808 0.129917
-v -0.500000 0.086808 0.129917
-v -0.468750 0.129917 0.086808
-v -0.500000 0.129917 0.086808
-v -0.468750 0.153248 0.030483
-v -0.500000 0.153247 0.030483
-v -0.468750 0.153248 -0.030483
-v -0.500000 0.153248 -0.030483
-v -0.468750 0.129917 -0.086808
-v -0.500000 0.129917 -0.086808
-v -0.468750 0.086808 -0.129917
-v -0.500000 0.086808 -0.129917
-v -0.468750 0.030483 -0.153248
-v -0.500000 0.030483 -0.153248
-v -0.468750 -0.030483 -0.153248
-v -0.500000 -0.030483 -0.153248
-v -0.468750 -0.086808 -0.129917
-v -0.500000 -0.086808 -0.129917
-v -0.468750 -0.129917 -0.086808
-v -0.500000 -0.129917 -0.086808
-v -0.468750 -0.122598 -0.024386
-v -0.468750 -0.122598 0.024386
-v -0.468750 -0.103934 0.069446
-v -0.468750 -0.069446 0.103934
-v -0.468750 -0.024386 0.122598
-v -0.468750 0.024386 0.122598
-v -0.468750 0.069446 0.103934
-v -0.468750 0.103934 0.069446
-v -0.468750 0.122598 0.024386
-v -0.468750 0.122598 -0.024386
-v -0.468750 0.103934 -0.069446
-v -0.468750 0.069446 -0.103934
-v -0.468750 0.024386 -0.122598
-v -0.468750 -0.024387 -0.122598
-v -0.468750 -0.069447 -0.103934
-v -0.468750 -0.103934 -0.069446
-v -0.468750 -0.000000 -0.000000
-v -0.500000 -0.000000 -0.000000
-v 0.468750 -0.069446 0.103934
-v 0.468750 -0.103933 0.069447
-v 0.468750 -0.122598 0.024387
-v 0.468750 -0.122598 -0.024386
-v 0.500000 -0.129917 -0.086807
-v 0.468750 -0.129917 -0.086807
-v 0.500000 -0.086808 -0.129917
-v 0.468750 -0.086808 -0.129917
-v 0.500000 -0.030483 -0.153247
-v 0.468750 -0.030483 -0.153247
-v 0.500000 0.030483 -0.153247
-v 0.468750 0.030483 -0.153247
-v 0.500000 0.086808 -0.129917
-v 0.468750 0.086808 -0.129917
-v 0.500000 0.129917 -0.086808
-v 0.468750 0.129917 -0.086808
-v 0.500000 0.153248 -0.030483
-v 0.468750 0.153248 -0.030483
-v 0.500000 0.153248 0.030483
-v 0.468750 0.153248 0.030483
-v 0.500000 0.129917 0.086808
-v 0.468750 0.129917 0.086808
-v 0.500000 0.086808 0.129917
-v 0.468750 0.086808 0.129917
-v 0.500000 0.030483 0.153248
-v 0.468750 0.030483 0.153248
-v 0.500000 -0.030483 0.153248
-v 0.468750 -0.030483 0.153248
-v 0.500000 -0.086807 0.129917
-v 0.468750 -0.086808 0.129917
-v 0.500000 -0.129917 0.086808
-v 0.468750 -0.129917 0.086808
-v 0.500000 -0.153247 0.030483
-v 0.468750 -0.153247 0.030483
-v 0.500000 -0.153247 -0.030483
-v 0.468750 -0.153247 -0.030483
-v 0.468750 -0.024386 0.122598
-v 0.468750 0.024387 0.122598
-v 0.468750 0.069447 0.103934
-v 0.468750 0.103934 0.069447
-v 0.468750 0.122598 0.024387
-v 0.468750 0.122598 -0.024386
-v 0.468750 0.103934 -0.069446
-v 0.468750 0.069447 -0.103933
-v 0.468750 0.024387 -0.122598
-v 0.468750 -0.024386 -0.122598
-v 0.468750 -0.069446 -0.103933
-v 0.468750 -0.103933 -0.069446
-v 0.468750 0.000000 0.000000
-v 0.500000 0.000000 0.000000
+v -0.030483 -0.153248 0.468750
+v -0.030483 -0.153248 0.500000
+v 0.030483 -0.153248 0.468750
+v 0.030483 -0.153248 0.500000
+v 0.086808 -0.129917 0.468750
+v 0.086808 -0.129917 0.500000
+v 0.129917 -0.086808 0.468750
+v 0.129917 -0.086808 0.500000
+v 0.153248 -0.030483 0.468750
+v 0.153248 -0.030483 0.500000
+v 0.153248 0.030483 0.468750
+v 0.153248 0.030483 0.500000
+v 0.129917 0.086808 0.468750
+v 0.129917 0.086808 0.500000
+v 0.086808 0.129917 0.468750
+v 0.086808 0.129917 0.500000
+v 0.030483 0.153248 0.468750
+v 0.030483 0.153247 0.500000
+v -0.030483 0.153248 0.468750
+v -0.030483 0.153248 0.500000
+v -0.086808 0.129917 0.468750
+v -0.086808 0.129917 0.500000
+v -0.129917 0.086808 0.468750
+v -0.129917 0.086808 0.500000
+v -0.153248 0.030483 0.468750
+v -0.153248 0.030483 0.500000
+v -0.153248 -0.030483 0.468750
+v -0.153248 -0.030483 0.500000
+v -0.129917 -0.086808 0.468750
+v -0.129917 -0.086808 0.500000
+v -0.086808 -0.129917 0.468750
+v -0.086808 -0.129917 0.500000
+v -0.024386 -0.122598 0.468750
+v 0.024386 -0.122598 0.468750
+v 0.069446 -0.103934 0.468750
+v 0.103934 -0.069446 0.468750
+v 0.122598 -0.024386 0.468750
+v 0.122598 0.024386 0.468750
+v 0.103934 0.069446 0.468750
+v 0.069446 0.103934 0.468750
+v 0.024386 0.122598 0.468750
+v -0.024386 0.122598 0.468750
+v -0.069446 0.103934 0.468750
+v -0.103934 0.069446 0.468750
+v -0.122598 0.024386 0.468750
+v -0.122598 -0.024387 0.468750
+v -0.103934 -0.069447 0.468750
+v -0.069446 -0.103934 0.468750
+v -0.000000 -0.000000 0.468750
+v -0.000000 -0.000000 0.500000
+v 0.103934 -0.069446 -0.468750
+v 0.069447 -0.103933 -0.468750
+v 0.024387 -0.122598 -0.468750
+v -0.024386 -0.122598 -0.468750
+v -0.086808 -0.129917 -0.500000
+v -0.086808 -0.129917 -0.468750
+v -0.129917 -0.086808 -0.500000
+v -0.129917 -0.086808 -0.468750
+v -0.153247 -0.030483 -0.500000
+v -0.153247 -0.030483 -0.468750
+v -0.153247 0.030483 -0.500000
+v -0.153247 0.030483 -0.468750
+v -0.129917 0.086808 -0.500000
+v -0.129917 0.086808 -0.468750
+v -0.086808 0.129917 -0.500000
+v -0.086808 0.129917 -0.468750
+v -0.030483 0.153248 -0.500000
+v -0.030483 0.153248 -0.468750
+v 0.030483 0.153248 -0.500000
+v 0.030483 0.153248 -0.468750
+v 0.086808 0.129917 -0.500000
+v 0.086808 0.129917 -0.468750
+v 0.129917 0.086808 -0.500000
+v 0.129917 0.086808 -0.468750
+v 0.153248 0.030483 -0.500000
+v 0.153248 0.030483 -0.468750
+v 0.153248 -0.030483 -0.500000
+v 0.153248 -0.030483 -0.468750
+v 0.129917 -0.086807 -0.500000
+v 0.129917 -0.086808 -0.468750
+v 0.086808 -0.129917 -0.500000
+v 0.086808 -0.129917 -0.468750
+v 0.030483 -0.153247 -0.500000
+v 0.030483 -0.153247 -0.468750
+v -0.030483 -0.153247 -0.500000
+v -0.030483 -0.153247 -0.468750
+v 0.122598 -0.024386 -0.468750
+v 0.122598 0.024387 -0.468750
+v 0.103934 0.069447 -0.468750
+v 0.069447 0.103934 -0.468750
+v 0.024387 0.122598 -0.468750
+v -0.024386 0.122598 -0.468750
+v -0.069446 0.103934 -0.468750
+v -0.103933 0.069447 -0.468750
+v -0.122598 0.024387 -0.468750
+v -0.122598 -0.024386 -0.468750
+v -0.103933 -0.069446 -0.468750
+v -0.069446 -0.103933 -0.468750
+v 0.000000 0.000000 -0.468750
+v 0.000000 0.000000 -0.500000
vt 0.265625 0.234375
vt 0.468750 0.234375
vt 0.468750 0.265625
@@ -262,40 +261,6 @@ vt 0.585938 0.257812
vt 0.585938 0.007812
vt 0.617188 0.007812
vt 0.617188 0.257812
-vt 0.538433 0.340928
-vt 0.568449 0.328495
-vt 0.584693 0.410160
-vt 0.515460 0.363901
-vt 0.503028 0.393916
-vt 0.503028 0.426405
-vt 0.515460 0.456420
-vt 0.538433 0.479393
-vt 0.568449 0.491826
-vt 0.600937 0.491826
-vt 0.630952 0.479393
-vt 0.653925 0.456420
-vt 0.666358 0.426405
-vt 0.666358 0.393916
-vt 0.653925 0.363901
-vt 0.630952 0.340928
-vt 0.600937 0.328495
-vt 0.727611 0.340928
-vt 0.757626 0.328495
-vt 0.773870 0.410160
-vt 0.704638 0.363901
-vt 0.692205 0.393916
-vt 0.692205 0.426405
-vt 0.704638 0.456420
-vt 0.727611 0.479393
-vt 0.757626 0.491826
-vt 0.790115 0.491826
-vt 0.820130 0.479393
-vt 0.843103 0.456420
-vt 0.855535 0.426405
-vt 0.855535 0.393916
-vt 0.843103 0.363901
-vt 0.820130 0.340928
-vt 0.790115 0.328495
vt 0.929688 0.257812
vt 0.929688 0.007812
vt 0.960938 0.007812
@@ -326,133 +291,151 @@ vt 0.492188 0.257812
vt 0.492188 0.007812
vt 0.992188 0.007812
vt 0.992188 0.257812
-usemtl None
+vn 1.000000 0.000000 0.000000
+vn -0.000000 0.000000 1.000000
+vn -1.000000 0.000000 -0.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.000000 -1.000000 -0.000000
+vn 0.000000 1.000000 -0.000000
+vn 0.382700 -0.923900 -0.000000
+vn 0.707100 -0.707100 -0.000000
+vn 0.923900 -0.382700 0.000000
+vn 0.923900 0.382700 0.000000
+vn 0.707100 0.707100 0.000000
+vn 0.382700 0.923900 0.000000
+vn -0.382700 0.923900 0.000000
+vn -0.707100 0.707100 0.000000
+vn -0.923900 0.382700 -0.000000
+vn -0.923900 -0.382700 -0.000000
+vn -0.382700 -0.923900 -0.000000
+vn -0.707100 -0.707100 -0.000000
+g Cube.003_Cube.003_None
s off
-f 5/1 6/2 2/3 1/4
-f 6/5 7/6 3/7 2/8
-f 7/9 8/10 4/11 3/12
-f 8/13 5/14 1/15 4/16
-f 1/17 2/18 3/19 4/20
-f 8/21 7/22 6/23 5/24
-f 13/25 14/26 10/27 9/28
-f 14/29 15/30 11/31 10/32
-f 15/33 16/34 12/35 11/36
-f 16/37 13/38 9/39 12/40
-f 21/41 22/42 18/43 17/44
-f 22/45 23/46 19/47 18/48
-f 23/49 24/50 20/51 19/52
-f 24/53 21/54 17/55 20/56
-f 17/57 18/58 19/59 20/60
-f 24/61 23/62 22/63 21/64
-f 25/65 27/66 28/67 26/68
-f 27/66 29/69 30/70 28/67
-f 29/69 31/71 32/72 30/70
-f 31/71 33/73 34/74 32/72
-f 33/73 35/75 36/76 34/74
-f 35/75 37/77 38/78 36/76
-f 37/77 39/79 40/80 38/78
-f 39/79 41/81 42/82 40/80
-f 41/81 43/83 44/84 42/82
-f 43/83 45/85 46/86 44/84
-f 45/85 47/87 48/88 46/86
-f 47/87 49/89 50/90 48/88
-f 49/91 51/92 52/93 50/94
-f 51/92 53/95 54/96 52/93
-f 55/97 25/65 26/68 56/98
-f 53/95 55/97 56/98 54/96
-f 28/99 74/100 26/101
-f 25/102 73/103 27/104
-f 27/104 73/103 29/105
-f 29/105 73/103 31/106
-f 31/106 73/103 33/107
-f 33/107 73/103 35/108
-f 35/108 73/103 37/109
-f 37/109 73/103 39/110
-f 39/110 73/103 41/111
-f 41/111 73/103 43/112
-f 43/112 73/103 45/113
-f 45/113 73/103 47/114
-f 47/114 73/103 49/115
-f 49/115 73/103 51/116
-f 51/116 73/103 53/117
-f 53/117 73/103 55/118
-f 55/118 73/103 25/102
-f 26/101 74/100 56/119
-f 56/119 74/100 54/120
-f 54/120 74/100 52/121
-f 52/121 74/100 50/122
-f 50/122 74/100 48/123
-f 48/123 74/100 46/124
-f 46/124 74/100 44/125
-f 44/125 74/100 42/126
-f 42/126 74/100 40/127
-f 40/127 74/100 38/128
-f 38/128 74/100 36/129
-f 36/129 74/100 34/130
-f 34/130 74/100 32/131
-f 32/131 74/100 30/132
-f 30/132 74/100 28/99
-f 65/133 115/134 116/135 66/136
-f 105/137 107/138 124/139
-f 103/140 105/137 124/139
-f 101/141 103/140 124/139
-f 99/142 101/141 124/139
-f 97/143 99/142 124/139
-f 95/144 97/143 124/139
-f 93/145 95/144 124/139
-f 91/146 93/145 124/139
-f 89/147 91/146 124/139
-f 87/148 89/147 124/139
-f 85/149 87/148 124/139
-f 83/150 85/149 124/139
-f 81/151 83/150 124/139
-f 79/152 81/151 124/139
-f 109/153 79/152 124/139
-f 80/154 110/155 123/156
-f 82/157 80/154 123/156
-f 84/158 82/157 123/156
-f 86/159 84/158 123/156
-f 88/160 86/159 123/156
-f 90/161 88/160 123/156
-f 92/162 90/161 123/156
-f 94/163 92/162 123/156
-f 96/164 94/163 123/156
-f 98/165 96/164 123/156
-f 100/166 98/165 123/156
-f 102/167 100/166 123/156
-f 104/168 102/167 123/156
-f 106/169 104/168 123/156
-f 108/170 106/169 123/156
-f 110/155 108/170 123/156
-f 107/138 109/153 124/139
-f 82/86 81/85 79/83 80/84
-f 80/84 79/83 109/81 110/82
-f 84/88 83/87 81/85 82/86
-f 86/90 85/89 83/87 84/88
-f 88/93 87/92 85/91 86/94
-f 90/96 89/95 87/92 88/93
-f 92/98 91/97 89/95 90/96
-f 94/68 93/65 91/97 92/98
-f 96/67 95/66 93/65 94/68
-f 98/70 97/69 95/66 96/67
-f 100/72 99/71 97/69 98/70
-f 102/74 101/73 99/71 100/72
-f 104/76 103/75 101/73 102/74
-f 106/78 105/77 103/75 104/76
-f 108/80 107/79 105/77 106/78
-f 110/82 109/81 107/79 108/80
-f 60/171 75/172 111/173 61/174
-f 58/175 77/176 76/177 59/178
-f 71/179 121/180 122/181 72/182
-f 57/183 78/184 77/176 58/175
-f 59/178 76/177 75/172 60/171
-f 72/182 122/181 78/184 57/183
-f 70/185 120/186 121/180 71/179
-f 69/187 119/188 120/186 70/185
-f 68/189 118/190 119/188 69/187
-f 67/191 117/192 118/190 68/189
-f 66/136 116/135 117/192 67/191
-f 64/193 114/194 115/134 65/133
-f 63/195 113/196 114/194 64/193
-f 62/197 112/198 113/196 63/195
-f 61/174 111/173 112/199 62/200
+f 5/1/1 6/2/1 2/3/1 1/4/1
+f 6/5/2 7/6/2 3/7/2 2/8/2
+f 7/9/3 8/10/3 4/11/3 3/12/3
+f 8/13/4 5/14/4 1/15/4 4/16/4
+f 1/17/5 2/18/5 3/19/5 4/20/5
+f 8/21/6 7/22/6 6/23/6 5/24/6
+f 13/25/4 14/26/4 10/27/4 9/28/4
+f 14/29/1 15/30/1 11/31/1 10/32/1
+f 15/33/2 16/34/2 12/35/2 11/36/2
+f 16/37/3 13/38/3 9/39/3 12/40/3
+f 21/41/4 22/42/4 18/43/4 17/44/4
+f 22/45/1 23/46/1 19/47/1 18/48/1
+f 23/49/2 24/50/2 20/51/2 19/52/2
+f 24/53/3 21/54/3 17/55/3 20/56/3
+f 17/57/5 18/58/5 19/59/5 20/60/5
+f 24/61/6 23/62/6 22/63/6 21/64/6
+f 25/65/5 27/66/5 28/67/5 26/68/5
+f 27/66/7 29/69/7 30/70/7 28/67/7
+f 29/69/8 31/71/8 32/72/8 30/70/8
+f 31/71/9 33/73/9 34/74/9 32/72/9
+f 33/73/1 35/75/1 36/76/1 34/74/1
+f 35/75/10 37/77/10 38/78/10 36/76/10
+f 37/77/11 39/79/11 40/80/11 38/78/11
+f 39/79/12 41/81/12 42/82/12 40/80/12
+f 41/81/6 43/83/6 44/84/6 42/82/6
+f 43/83/13 45/85/13 46/86/13 44/84/13
+f 45/85/14 47/87/14 48/88/14 46/86/14
+f 47/87/15 49/89/15 50/90/15 48/88/15
+f 49/91/3 51/92/3 52/93/3 50/94/3
+f 51/92/16 53/95/16 54/96/16 52/93/16
+f 55/97/17 25/65/17 26/68/17 56/98/17
+f 53/95/18 55/97/18 56/98/18 54/96/18
+f 28/99/2 74/100/2 26/101/2
+f 25/102/4 73/103/4 27/104/4
+f 27/104/4 73/103/4 29/105/4
+f 29/105/4 73/103/4 31/106/4
+f 31/106/4 73/103/4 33/107/4
+f 33/107/4 73/103/4 35/108/4
+f 35/108/4 73/103/4 37/109/4
+f 37/109/4 73/103/4 39/110/4
+f 39/110/4 73/103/4 41/111/4
+f 41/111/4 73/103/4 43/112/4
+f 43/112/4 73/103/4 45/113/4
+f 45/113/4 73/103/4 47/114/4
+f 47/114/4 73/103/4 49/115/4
+f 49/115/4 73/103/4 51/116/4
+f 51/116/4 73/103/4 53/117/4
+f 53/117/4 73/103/4 55/118/4
+f 55/118/4 73/103/4 25/102/4
+f 26/101/2 74/100/2 56/119/2
+f 56/119/2 74/100/2 54/120/2
+f 54/120/2 74/100/2 52/121/2
+f 52/121/2 74/100/2 50/122/2
+f 50/122/2 74/100/2 48/123/2
+f 48/123/2 74/100/2 46/124/2
+f 46/124/2 74/100/2 44/125/2
+f 44/125/2 74/100/2 42/126/2
+f 42/126/2 74/100/2 40/127/2
+f 40/127/2 74/100/2 38/128/2
+f 38/128/2 74/100/2 36/129/2
+f 36/129/2 74/100/2 34/130/2
+f 34/130/2 74/100/2 32/131/2
+f 32/131/2 74/100/2 30/132/2
+f 30/132/2 74/100/2 28/99/2
+f 65/133/6 115/134/6 116/135/6 66/136/6
+f 105/119/4 107/101/4 124/100/4
+f 103/120/4 105/119/4 124/100/4
+f 101/121/4 103/120/4 124/100/4
+f 99/122/4 101/121/4 124/100/4
+f 97/123/4 99/122/4 124/100/4
+f 95/124/4 97/123/4 124/100/4
+f 93/125/4 95/124/4 124/100/4
+f 91/126/4 93/125/4 124/100/4
+f 89/127/4 91/126/4 124/100/4
+f 87/128/4 89/127/4 124/100/4
+f 85/129/4 87/128/4 124/100/4
+f 83/130/4 85/129/4 124/100/4
+f 81/131/4 83/130/4 124/100/4
+f 79/132/4 81/131/4 124/100/4
+f 109/99/4 79/132/4 124/100/4
+f 80/118/2 110/102/2 123/103/2
+f 82/117/2 80/118/2 123/103/2
+f 84/116/2 82/117/2 123/103/2
+f 86/115/2 84/116/2 123/103/2
+f 88/114/2 86/115/2 123/103/2
+f 90/113/2 88/114/2 123/103/2
+f 92/112/2 90/113/2 123/103/2
+f 94/111/2 92/112/2 123/103/2
+f 96/110/2 94/111/2 123/103/2
+f 98/109/2 96/110/2 123/103/2
+f 100/108/2 98/109/2 123/103/2
+f 102/107/2 100/108/2 123/103/2
+f 104/106/2 102/107/2 123/103/2
+f 106/105/2 104/106/2 123/103/2
+f 108/104/2 106/105/2 123/103/2
+f 110/102/2 108/104/2 123/103/2
+f 107/101/4 109/99/4 124/100/4
+f 82/86/18 81/85/18 79/83/18 80/84/18
+f 80/84/17 79/83/17 109/81/17 110/82/17
+f 84/88/16 83/87/16 81/85/16 82/86/16
+f 86/90/3 85/89/3 83/87/3 84/88/3
+f 88/93/15 87/92/15 85/91/15 86/94/15
+f 90/96/14 89/95/14 87/92/14 88/93/14
+f 92/98/13 91/97/13 89/95/13 90/96/13
+f 94/68/6 93/65/6 91/97/6 92/98/6
+f 96/67/12 95/66/12 93/65/12 94/68/12
+f 98/70/11 97/69/11 95/66/11 96/67/11
+f 100/72/10 99/71/10 97/69/10 98/70/10
+f 102/74/1 101/73/1 99/71/1 100/72/1
+f 104/76/9 103/75/9 101/73/9 102/74/9
+f 106/78/8 105/77/8 103/75/8 104/76/8
+f 108/80/7 107/79/7 105/77/7 106/78/7
+f 110/82/5 109/81/5 107/79/5 108/80/5
+f 60/137/9 75/138/9 111/139/9 61/140/9
+f 58/141/7 77/142/7 76/143/7 59/144/7
+f 71/145/18 121/146/18 122/147/18 72/148/18
+f 57/149/5 78/150/5 77/142/5 58/141/5
+f 59/144/8 76/143/8 75/138/8 60/137/8
+f 72/148/17 122/147/17 78/150/17 57/149/17
+f 70/151/16 120/152/16 121/146/16 71/145/16
+f 69/153/3 119/154/3 120/152/3 70/151/3
+f 68/155/15 118/156/15 119/154/15 69/153/15
+f 67/157/14 117/158/14 118/156/14 68/155/14
+f 66/136/13 116/135/13 117/158/13 67/157/13
+f 64/159/12 114/160/12 115/134/12 65/133/12
+f 63/161/11 113/162/11 114/160/11 64/159/11
+f 62/163/10 112/164/10 113/162/10 63/161/10
+f 61/140/1 111/139/1 112/165/1 62/166/1
diff --git a/pipes.lua b/pipes.lua
index 2056fdf..9771e3b 100644
--- a/pipes.lua
+++ b/pipes.lua
@@ -80,7 +80,8 @@ for index, connects in ipairs(cconnects) do
end,
after_dig_node = function(pos)
pipeworks.scan_for_pipe_objects(pos)
- end
+ end,
+ on_rotate = false
})
local pgroups = {snappy = 3, pipe = 1, not_in_creative_inventory = 1}
@@ -106,11 +107,13 @@ for index, connects in ipairs(cconnects) do
walkable = true,
drop = "pipeworks:pipe_1_empty",
after_place_node = function(pos)
+ minetest.set_node(pos, { name = "pipeworks:pipe_"..index.."_empty" })
pipeworks.scan_for_pipe_objects(pos)
end,
after_dig_node = function(pos)
pipeworks.scan_for_pipe_objects(pos)
- end
+ end,
+ on_rotate = false
})
table.insert(pipes_empty_nodenames, "pipeworks:pipe_"..index.."_empty")
@@ -134,6 +137,8 @@ if REGISTER_COMPATIBILITY then
after_place_node = function(pos)
pipeworks.scan_for_pipe_objects(pos)
end,
+ on_rotate = false
+
})
minetest.register_node(cloaded, {
drawtype = "airlike",
@@ -145,6 +150,8 @@ if REGISTER_COMPATIBILITY then
after_place_node = function(pos)
pipeworks.scan_for_pipe_objects(pos)
end,
+ on_rotate = false
+
})
for xm = 0, 1 do
for xp = 0, 1 do
diff --git a/routing_tubes.lua b/routing_tubes.lua
index 0a82fc8..6ed0723 100644
--- a/routing_tubes.lua
+++ b/routing_tubes.lua
@@ -1,3 +1,4 @@
+
-- the default tube and default textures
pipeworks.register_tube("pipeworks:tube", "Pneumatic tube segment")
minetest.register_craft( {
@@ -9,6 +10,57 @@ minetest.register_craft( {
},
})
+pipeworks.register_tube("pipeworks:broken_tube", {
+ description = "Broken Tube (you hacker you)",
+ plain = { { name = "pipeworks_broken_tube_plain.png", backface_culling = false, color = nodecolor } },
+ noctr = { { name = "pipeworks_broken_tube_plain.png", backface_culling = false, color = nodecolor } },
+ ends = { { name = "pipeworks_broken_tube_end.png", color = nodecolor } },
+ short = { name = "pipeworks_broken_tube_short.png", color = nodecolor },
+ node_def = {
+ drop = "pipeworks:tube_1",
+ groups = {not_in_creative_inventory = 1, tubedevice_receiver = 1},
+ tube = {
+ insert_object = function(pos, node, stack, direction)
+ minetest.item_drop(stack, nil, pos)
+ return ItemStack("")
+ end,
+ can_insert = function(pos,node,stack,direction)
+ return true
+ end,
+ priority = 50,
+ },
+ on_punch = function(pos, node, puncher, pointed_thing)
+ local itemstack = puncher:get_wielded_item()
+ local wieldname = itemstack:get_name()
+ local playername = puncher:get_player_name()
+ print("[Pipeworks] "..playername.." struck a broken tube at "..minetest.pos_to_string(pos))
+ if wieldname == "anvil:hammer"
+ or wieldname == "cottages:hammer"
+ or wieldname == "glooptest:hammer_steel"
+ or wieldname == "glooptest:hammer_bronze"
+ or wieldname == "glooptest:hammer_diamond"
+ or wieldname == "glooptest:hammer_mese"
+ or wieldname == "glooptest:hammer_alatro"
+ or wieldname == "glooptest:hammer_arol" then
+ local meta = minetest.get_meta(pos)
+ local was_node = minetest.deserialize(meta:get_string("the_tube_was"))
+ if was_node and was_node ~= "" then
+ print(" with "..wieldname.." to repair it.")
+ minetest.swap_node(pos, { name = was_node.name, param2 = was_node.param2 })
+ pipeworks.scan_for_tube_objects(pos)
+ itemstack:add_wear(1000)
+ puncher:set_wielded_item(itemstack)
+ return itemstack
+ else
+ print(" but it can't be repaired.")
+ end
+ else
+ print(" with "..wieldname.." but that tool is too weak.")
+ end
+ end
+ }
+})
+
-- the high priority tube is a low-cpu replacement for sorting tubes in situations
-- where players would use them for simple routing (turning off paths)
-- without doing actual sorting, like at outputs of tubedevices that might both accept and eject items
@@ -101,7 +153,7 @@ if pipeworks.enable_one_way_tube then
return {velocity}
end,
can_insert = function(pos, node, stack, direction)
- local dir = minetest.facedir_to_right_dir(node.param2)
+ local dir = pipeworks.facedir_to_right_dir(node.param2)
return vector.equals(dir, direction)
end,
priority = 75 -- Higher than normal tubes, but lower than receivers
diff --git a/settingtypes.txt b/settingtypes.txt
new file mode 100644
index 0000000..1d3c10c
--- /dev/null
+++ b/settingtypes.txt
@@ -0,0 +1,70 @@
+#Enable pipes.
+pipeworks_enable_pipes (Enable Pipes) bool true
+
+#Enable autocrafter.
+pipeworks_enable_autocrafter (Enable Autocrafter) bool true
+
+#Enable deployer.
+pipeworks_enable_deployer (Enable Deployer) bool true
+
+#Enable dispenser.
+pipeworks_enable_dispenser (Enable Dispenser) bool true
+
+#Enable node breaker.
+pipeworks_enable_node_breaker (Enable Node Breaker) bool true
+
+#Enable teleport tube.
+pipeworks_enable_teleport_tube (Enable Teleport Tube) bool true
+
+#Enable pipe devices.
+pipeworks_enable_pipe_devices (Enable Pipe Devices) bool true
+
+#Enable redefines.
+pipeworks_enable_redefines (Enable Node Redefines) bool true
+
+#Enable sorting tube.
+pipeworks_enable_mese_tube (Enable Sorting Tube) bool true
+
+#Enable detector tube.
+pipeworks_enable_detector_tube (Enable Detector Tube) bool true
+
+#Enable digiline detector tube.
+pipeworks_enable_digiline_detector_tube (Enable Digiline Detector Tube) bool true
+
+#Enable mesecon signal conducting tube.
+pipeworks_enable_conductor_tube (Enable Conductor Tube) bool true
+
+#Enable accelerator tube.
+pipeworks_enable_accelerator_tube (Enable Accelerator Tube) bool true
+
+#Enable crossing tube.
+#It sends all incoming items to the other side, or if there is no other tube, it sends them back.
+pipeworks_enable_crossing_tube (Enable Crossing Tube) bool true
+
+#Enable vacuum tube.
+#It picks up all items that lay around next to it.
+pipeworks_enable_sand_tube (Enable Vacuum Tube) bool true
+
+#Enable mese vacuum tube.
+#It's like the normal vacuum tube with the
+#differance that you can set the radius up to 8 nodes.
+pipeworks_enable_mese_sand_tube (Enable Mese Vacuum Tube) bool true
+
+#Enable one way tube.
+#It sends items only in one direction.
+#Use it to drop items out of tubes.
+pipeworks_enable_one_way_tube (Enable One Way Tube) bool true
+
+#Enable high priority tube.
+#It has a very high priority and so, on crossings, the items will
+#always go to it if there are multible ways.
+pipeworks_enable_priority_tube (Enable High Priority Tube) bool true
+
+#Enable cyclic mode.
+pipeworks_enable_cyclic_mode (Enable Cyclic Mode) bool true
+
+#Drop on routing fail.
+pipeworks_drop_on_routing_fail (Drop On Routing Fail) bool false
+
+#Delete item on clearobject.
+pipeworks_delete_item_on_clearobject (Delete Item On Clearobject) bool true \ No newline at end of file
diff --git a/signal_tubes.lua b/signal_tubes.lua
index dfd7649..3b2653c 100644
--- a/signal_tubes.lua
+++ b/signal_tubes.lua
@@ -1,5 +1,5 @@
if pipeworks.enable_detector_tube then
- local detector_tube_step = 2 * tonumber(minetest.setting_get("dedicated_server_step"))
+ local detector_tube_step = 5 * tonumber(minetest.setting_get("dedicated_server_step"))
pipeworks.register_tube("pipeworks:detector_tube_on", {
description = "Detecting Pneumatic Tube Segment on (you hacker you)",
inventory_image = "pipeworks_detector_tube_inv.png",
diff --git a/sorting_tubes.lua b/sorting_tubes.lua
index edaa24a..e7e918d 100644
--- a/sorting_tubes.lua
+++ b/sorting_tubes.lua
@@ -1,3 +1,5 @@
+local fs_helpers = pipeworks.fs_helpers
+
if pipeworks.enable_mese_tube then
local function update_formspec(pos)
local meta = minetest.get_meta(pos)
@@ -13,8 +15,12 @@ if pipeworks.enable_mese_tube then
local buttons_formspec = ""
for i = 0, 5 do
buttons_formspec = buttons_formspec .. fs_helpers.cycling_button(meta,
- "image_button[7,"..(i)..";1,1", "l"..(i+1).."s",
- {{text="",texture="pipeworks_button_off.png", addopts="false;false;pipeworks_button_interm.png"}, {text="",texture="pipeworks_button_on.png", addopts="false;false;pipeworks_button_interm.png"}})
+ "image_button[7,"..(i+0.2)..";1,0.6", "l"..(i+1).."s",
+ {
+ pipeworks.button_off,
+ pipeworks.button_on
+ }
+ )
end
meta:set_string("formspec",
"size[8,11]"..
diff --git a/teleport_tube.lua b/teleport_tube.lua
index 3a870f5..bb364db 100644
--- a/teleport_tube.lua
+++ b/teleport_tube.lua
@@ -111,7 +111,7 @@ local function update_meta(meta, can_receive)
meta:set_string("formspec","size[8.6,2.2]"..
"field[0.6,0.6;7,1;channel;Channel:;${channel}]"..
"label[7.3,0;Receive]"..
- "image_button[7.3,0.3;1,1;pipeworks_button_" .. cr_state .. ".png;cr" .. (can_receive and 0 or 1) .. ";;;false;pipeworks_button_interm.png]"..
+ "image_button[7.3,0.3;1,0.6;pipeworks_button_" .. cr_state .. ".png;cr" .. (can_receive and 0 or 1) .. ";;;false;pipeworks_button_interm.png]"..
"image[0.3,1.3;1,1;pipeworks_teleport_tube_inv.png]"..
"label[1.6,1.2;channels are public by default]" ..
"label[1.6,1.5;use <player>:<channel> for fully private channels]" ..
diff --git a/textures/pipeworks_broken_tube_end.png b/textures/pipeworks_broken_tube_end.png
new file mode 100644
index 0000000..1829f8c
--- /dev/null
+++ b/textures/pipeworks_broken_tube_end.png
Binary files differ
diff --git a/textures/pipeworks_broken_tube_inv.png b/textures/pipeworks_broken_tube_inv.png
new file mode 100644
index 0000000..5b8d707
--- /dev/null
+++ b/textures/pipeworks_broken_tube_inv.png
Binary files differ
diff --git a/textures/pipeworks_broken_tube_noctr.png b/textures/pipeworks_broken_tube_noctr.png
new file mode 100644
index 0000000..a17da5f
--- /dev/null
+++ b/textures/pipeworks_broken_tube_noctr.png
Binary files differ
diff --git a/textures/pipeworks_broken_tube_plain.png b/textures/pipeworks_broken_tube_plain.png
new file mode 100644
index 0000000..7957e59
--- /dev/null
+++ b/textures/pipeworks_broken_tube_plain.png
Binary files differ
diff --git a/textures/pipeworks_broken_tube_short.png b/textures/pipeworks_broken_tube_short.png
new file mode 100644
index 0000000..237fec5
--- /dev/null
+++ b/textures/pipeworks_broken_tube_short.png
Binary files differ
diff --git a/textures/pipeworks_button_interm.png b/textures/pipeworks_button_interm.png
index 47320ce..0d4c558 100644
--- a/textures/pipeworks_button_interm.png
+++ b/textures/pipeworks_button_interm.png
Binary files differ
diff --git a/textures/pipeworks_button_off.png b/textures/pipeworks_button_off.png
index 319fc6e..3836d19 100644
--- a/textures/pipeworks_button_off.png
+++ b/textures/pipeworks_button_off.png
Binary files differ
diff --git a/textures/pipeworks_button_on.png b/textures/pipeworks_button_on.png
index a9884cf..a42eb05 100644
--- a/textures/pipeworks_button_on.png
+++ b/textures/pipeworks_button_on.png
Binary files differ
diff --git a/tube_registration.lua b/tube_registration.lua
index c926216..21eac29 100644
--- a/tube_registration.lua
+++ b/tube_registration.lua
@@ -38,13 +38,13 @@ local register_one_tube = function(name, tname, dropname, desc, plain, noctrs, e
local outboxes = {}
local outsel = {}
local outimgs = {}
-
+
for i = 1, 6 do
outimgs[vti[i]] = plain[i]
end
-
+
for _, v in ipairs(connects) do
- table.extend(outboxes, pipeworks.tube_boxes[v])
+ pipeworks.table_extend(outboxes, pipeworks.tube_boxes[v])
table.insert(outsel, pipeworks.tube_selectboxes[v])
outimgs[vti[v]] = noctrs[v]
end
@@ -73,10 +73,10 @@ local register_one_tube = function(name, tname, dropname, desc, plain, noctrs, e
outsel = { -24/64, -10/64, -10/64, 24/64, 10/64, 10/64 }
wscale = {x = 1, y = 1, z = 0.01}
end
-
+
local rname = string.format("%s_%s", name, tname)
table.insert(tubenodes, rname)
-
+
local nodedef = {
description = tubedesc,
drawtype = "nodebox",
@@ -107,12 +107,20 @@ local register_one_tube = function(name, tname, dropname, desc, plain, noctrs, e
priority = 50
},
after_place_node = pipeworks.after_place,
- after_dig_node = pipeworks.after_dig
+ after_dig_node = pipeworks.after_dig,
+ on_blast = function(pos, intensity)
+ if intensity > 1 + 3^0.5 then
+ minetest.remove_node(pos)
+ return {string.format("%s_%s", name, dropname)}
+ end
+ minetest.swap_node(pos, {name = "pipeworks:broken_tube_1"})
+ pipeworks.scan_for_tube_objects(pos)
+ end
}
if style == "6d" then
nodedef.paramtype2 = "facedir"
end
-
+
if special == nil then special = {} end
for key, value in pairs(special) do
@@ -127,7 +135,7 @@ local register_one_tube = function(name, tname, dropname, desc, plain, noctrs, e
nodedef.tube[key] = val
end
else
- nodedef[key] = table.recursive_replace(value, "#id", tname)
+ nodedef[key] = pipeworks.table_recursive_replace(value, "#id", tname)
end
end
diff --git a/vacuum_tubes.lua b/vacuum_tubes.lua
index 51f6f81..211c3ee 100644
--- a/vacuum_tubes.lua
+++ b/vacuum_tubes.lua
@@ -1,27 +1,27 @@
if pipeworks.enable_sand_tube then
pipeworks.register_tube("pipeworks:sand_tube", {
- description = "Vacuuming Pneumatic Tube Segment",
- inventory_image = "pipeworks_sand_tube_inv.png",
- short = "pipeworks_sand_tube_short.png",
- noctr = { "pipeworks_sand_tube_noctr.png" },
- plain = { "pipeworks_sand_tube_plain.png" },
- ends = { "pipeworks_sand_tube_end.png" },
- node_def = { groups = {vacuum_tube = 1}},
+ description = "Vacuuming Pneumatic Tube Segment",
+ inventory_image = "pipeworks_sand_tube_inv.png",
+ short = "pipeworks_sand_tube_short.png",
+ noctr = {"pipeworks_sand_tube_noctr.png"},
+ plain = {"pipeworks_sand_tube_plain.png"},
+ ends = {"pipeworks_sand_tube_end.png"},
+ node_def = {groups = {vacuum_tube = 1}},
})
minetest.register_craft( {
output = "pipeworks:sand_tube_1 2",
recipe = {
- { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
- { "group:sand", "group:sand", "group:sand" },
- { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
+ {"homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting"},
+ {"group:sand", "group:sand", "group:sand"},
+ {"homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting"}
},
})
minetest.register_craft( {
output = "pipeworks:sand_tube_1",
recipe = {
- { "group:sand", "pipeworks:tube_1", "group:sand" },
+ {"group:sand", "pipeworks:tube_1", "group:sand"},
},
})
end
@@ -31,9 +31,9 @@ if pipeworks.enable_mese_sand_tube then
description = "Adjustable Vacuuming Pneumatic Tube Segment",
inventory_image = "pipeworks_mese_sand_tube_inv.png",
short = "pipeworks_mese_sand_tube_short.png",
- noctr = { "pipeworks_mese_sand_tube_noctr.png" },
- plain = { "pipeworks_mese_sand_tube_plain.png" },
- ends = { "pipeworks_mese_sand_tube_end.png" },
+ noctr = {"pipeworks_mese_sand_tube_noctr.png"},
+ plain = {"pipeworks_mese_sand_tube_plain.png"},
+ ends = {"pipeworks_mese_sand_tube_end.png"},
node_def = {
groups = {vacuum_tube = 1},
on_construct = function(pos)
@@ -63,9 +63,9 @@ if pipeworks.enable_mese_sand_tube then
minetest.register_craft( {
output = "pipeworks:mese_sand_tube_1 2",
recipe = {
- { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
- { "group:sand", "default:mese_crystal", "group:sand" },
- { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
+ {"homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
+ {"group:sand", "default:mese_crystal", "group:sand" },
+ {"homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
},
})
@@ -82,23 +82,19 @@ if pipeworks.enable_mese_sand_tube then
})
end
-local sqrt_3 = math.sqrt(3)
-local tube_inject_item = pipeworks.tube_inject_item
-local get_objects_inside_radius = minetest.get_objects_inside_radius
local function vacuum(pos, radius)
radius = radius + 0.5
- for _, object in pairs(get_objects_inside_radius(pos, sqrt_3 * radius)) do
+ for _, object in pairs(minetest.get_objects_inside_radius(pos, math.sqrt(3) * radius)) do
local lua_entity = object:get_luaentity()
if not object:is_player() and lua_entity and lua_entity.name == "__builtin:item" then
local obj_pos = object:getpos()
- local x1, y1, z1 = pos.x, pos.y, pos.z
- local x2, y2, z2 = obj_pos.x, obj_pos.y, obj_pos.z
-
- if x1 - radius <= x2 and x2 <= x1 + radius
- and y1 - radius <= y2 and y2 <= y1 + radius
- and z1 - radius <= z2 and z2 <= z1 + radius then
+ local minpos = vector.subtract(pos, radius)
+ local maxpos = vector.add(pos, radius)
+ if obj_pos.x >= minpos.x and obj_pos.x <= maxpos.x
+ and obj_pos.y >= minpos.y and obj_pos.y <= maxpos.y
+ and obj_pos.z >= minpos.z and obj_pos.z <= maxpos.z then
if lua_entity.itemstring ~= "" then
- tube_inject_item(pos, pos, vector.new(0, 0, 0), lua_entity.itemstring)
+ pipeworks.tube_inject_item(pos, pos, vector.new(0, 0, 0), lua_entity.itemstring)
lua_entity.itemstring = ""
end
object:remove()
@@ -108,15 +104,15 @@ local function vacuum(pos, radius)
end
minetest.register_abm({nodenames = {"group:vacuum_tube"},
- interval = 1,
- chance = 1,
- label = "Vacuum tubes",
- action = function(pos, node, active_object_count, active_object_count_wider)
- if node.name:find("pipeworks:sand_tube") then
- vacuum(pos, 2)
- else
- local radius = minetest.get_meta(pos):get_int("dist")
- vacuum(pos, radius)
- end
- end
+ interval = 1,
+ chance = 1,
+ label = "Vacuum tubes",
+ action = function(pos, node, active_object_count, active_object_count_wider)
+ if node.name:find("pipeworks:sand_tube") then
+ vacuum(pos, 2)
+ else
+ local radius = minetest.get_meta(pos):get_int("dist")
+ vacuum(pos, radius)
+ end
+ end
})