Browse Source

added straight-only pipe

(for situations where one might want to run
several closely-spaced parallel pipelines)

Also fixed a bug where a pipe "entry panel" would
report full of water if a pipe next to it (but not
connecting) was also full of water

Only tested under "classic" flowing logic mode.
merge-requests/9/head
Vanessa Ezekowitz 4 years ago
parent
commit
ee0c276900
  1. 12
      autoplace_pipes.lua
  2. 51
      devices.lua
  3. 3
      flowing_logic.lua
  4. 2507
      models/pipeworks_straight_pipe.obj
  5. 194
      models/pipeworks_straight_pipe_lowpoly.obj
  6. 11
      pipes.lua
  7. BIN
      textures/pipeworks_straight_pipe_empty.png
  8. BIN
      textures/pipeworks_straight_pipe_loaded.png

12
autoplace_pipes.lua

@ -159,6 +159,18 @@ function pipeworks.scan_pipe_surroundings(pos)
pzp = f or pzp
end
-- ...straight-only pipe...
local match,a,b,c,d,e,f = pipeworks.get_axis_dir(nodetable, "pipeworks:straight_pipe")
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

51
devices.lua

@ -682,7 +682,58 @@ local fountain_neighbours={{x=0, y=1, z=0}}
new_flow_logic_register.output_simple(nodename_fountain_empty, fountain_upper, fountain_lower, fountain_neighbours)
new_flow_logic_register.output_simple(nodename_fountain_loaded, fountain_upper, fountain_lower, fountain_neighbours)
local sp_cbox = {
type = "fixed",
fixed = {
{ -2/16, -2/16, -8/16, 2/16, 2/16, 8/16 }
}
}
local nodename_sp_empty = "pipeworks:straight_pipe_empty"
minetest.register_node(nodename_sp_empty, {
description = "Straight-only Pipe",
drawtype = "mesh",
mesh = "pipeworks_straight_pipe"..polys..".obj",
tiles = { "pipeworks_straight_pipe_empty.png" },
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy=3, pipe=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
on_place = pipeworks.rotate_on_place,
after_dig_node = function(pos)
pipeworks.scan_for_pipe_objects(pos)
end,
selection_box = sp_cbox,
collision_box = sp_cbox,
on_rotate = pipeworks.fix_after_rotation
})
local nodename_sp_loaded = "pipeworks:straight_pipe_loaded"
minetest.register_node(nodename_sp_loaded, {
description = "Straight-only Pipe",
drawtype = "mesh",
mesh = "pipeworks_straight_pipe"..polys..".obj",
tiles = { "pipeworks_straight_pipe_loaded.png" },
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(),
walkable = true,
on_place = pipeworks.rotate_on_place,
after_dig_node = function(pos)
pipeworks.scan_for_pipe_objects(pos)
end,
selection_box = sp_cbox,
collision_box = sp_cbox,
drop = "pipeworks:straight_pipe_empty",
on_rotate = pipeworks.fix_after_rotation
})
new_flow_logic_register.directional_horizonal_rotate(nodename_sp_empty, true)
new_flow_logic_register.directional_horizonal_rotate(nodename_sp_loaded, true)
-- Other misc stuff
minetest.register_alias("pipeworks:valve_off_loaded", "pipeworks:valve_off_empty")
minetest.register_alias("pipeworks:entry_panel", "pipeworks:entry_panel_empty")

3
flowing_logic.lua

@ -44,7 +44,8 @@ pipeworks.check_for_inflows = function(pos,node)
source = minetest.get_meta(coords[i]):get_string("source")
if source == minetest.pos_to_string(pos) then break end
end
if string.find(name, "valve") or string.find(name, "sensor") then
if string.find(name, "valve") or string.find(name, "sensor")
or string.find(name, "straight_pipe") or string.find(name, "panel") 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)

2507
models/pipeworks_straight_pipe.obj
File diff suppressed because it is too large
View File

194
models/pipeworks_straight_pipe_lowpoly.obj

@ -0,0 +1,194 @@
# Blender v2.78 (sub 0) OBJ File: ''
# www.blender.org
o Cylinder.000_Cylinder.000_None
v 0.064721 -0.156250 -0.468750
v 0.156250 -0.064721 -0.468750
v 0.156250 0.064721 -0.468750
v 0.064721 0.156250 -0.468750
v -0.064721 0.156250 -0.468750
v -0.156250 0.064721 -0.468750
v -0.156250 -0.064721 -0.468750
v -0.064721 -0.156250 -0.468750
v 0.156250 -0.064721 -0.500000
v 0.064721 -0.156250 -0.500000
v -0.064721 -0.156250 -0.500000
v -0.156250 -0.064721 -0.500000
v -0.156250 0.064721 -0.500000
v -0.064721 0.156250 -0.500000
v 0.064721 0.156250 -0.500000
v 0.156250 0.064721 -0.500000
v 0.064721 -0.156250 0.500000
v 0.156250 -0.064721 0.500000
v 0.156250 0.064721 0.500000
v 0.064721 0.156250 0.500000
v -0.064721 0.156250 0.500000
v -0.156250 0.064721 0.500000
v -0.156250 -0.064721 0.500000
v -0.064721 -0.156250 0.500000
v 0.156250 -0.064721 0.468750
v 0.064721 -0.156250 0.468750
v -0.064721 -0.156250 0.468750
v -0.156250 -0.064721 0.468750
v -0.156250 0.064721 0.468750
v -0.064721 0.156250 0.468750
v 0.064721 0.156250 0.468750
v 0.156250 0.064721 0.468750
v -0.125000 -0.051777 0.468750
v -0.125000 0.051777 0.468750
v -0.125000 0.051777 -0.468750
v -0.125000 -0.051777 -0.468750
v 0.051777 0.125000 0.468750
v 0.125000 0.051777 0.468750
v 0.125000 0.051777 -0.468750
v 0.051777 0.125000 -0.468750
v -0.051777 0.125000 0.468750
v -0.051777 0.125000 -0.468750
v -0.051777 -0.125000 -0.468750
v -0.051777 -0.125000 0.468750
v 0.051777 -0.125000 -0.468750
v 0.125000 -0.051777 -0.468750
v 0.125000 -0.051777 0.468750
v 0.051777 -0.125000 0.468750
vt 0.7188 0.8906
vt 0.6250 0.9844
vt 0.5000 0.9844
vt 0.4062 0.8906
vt 0.4062 0.7656
vt 0.5000 0.6719
vt 0.6250 0.6719
vt 0.7188 0.7656
vt 0.2500 0.9844
vt 0.3438 0.8906
vt 0.3438 0.7656
vt 0.2500 0.6719
vt 0.1250 0.6719
vt 0.0312 0.7656
vt 0.0312 0.8906
vt 0.1250 0.9844
vt 0.3438 0.8906
vt 0.2500 0.9844
vt 0.1250 0.9844
vt 0.0312 0.8906
vt 0.0312 0.7656
vt 0.1250 0.6719
vt 0.2500 0.6719
vt 0.3438 0.7656
vt 0.6250 0.9844
vt 0.7188 0.8906
vt 0.7188 0.7656
vt 0.6250 0.6719
vt 0.5000 0.6719
vt 0.4062 0.7656
vt 0.4062 0.8906
vt 0.5000 0.9844
vt 0.8125 0.5938
vt 0.8125 0.5625
vt 0.8750 0.5625
vt 0.8750 0.5938
vt 0.9375 0.5625
vt 0.9375 0.5938
vt 1.0000 0.5625
vt 1.0000 0.5938
vt 0.5000 0.5938
vt 0.5000 0.5625
vt 0.5625 0.5625
vt 0.5625 0.5938
vt 0.6250 0.5625
vt 0.6250 0.5938
vt 0.6875 0.5625
vt 0.6875 0.5938
vt 0.7500 0.5625
vt 0.7500 0.5938
vt 0.3750 0.5938
vt 0.3750 0.5625
vt 0.4375 0.5625
vt 0.4375 0.5938
vt 0.3125 0.5938
vt 0.3125 0.5625
vt 0.5000 0.5625
vt 0.5000 0.5938
vt 0.0000 0.5938
vt 0.0000 0.5625
vt 0.0625 0.5625
vt 0.0625 0.5938
vt 0.1250 0.5625
vt 0.1250 0.5938
vt 0.1875 0.5625
vt 0.1875 0.5938
vt 0.2500 0.5625
vt 0.2500 0.5938
vt 1.0624 0.5135
vt 0.9370 0.5135
vt 0.9370 0.0130
vt 1.0624 0.0130
vt 0.6862 0.5135
vt 0.5608 0.5135
vt 0.5608 0.0130
vt 0.6862 0.0130
vt 0.8116 0.5135
vt 0.8116 0.0130
vt 1.1878 0.0130
vt 1.1878 0.5135
vt 0.3100 0.0130
vt 0.4354 0.0130
vt 0.4354 0.5135
vt 0.3100 0.5135
vt 0.1846 0.0130
vt 0.1846 0.5135
vn -0.0000 0.0000 1.0000
vn 0.0000 0.0000 -1.0000
vn 0.7173 -0.2971 -0.6302
vn 0.7173 -0.2971 0.6302
vn 0.2971 -0.7173 0.6302
vn 0.2971 -0.7173 -0.6302
vn -0.2971 -0.7173 0.6302
vn -0.2971 -0.7173 -0.6302
vn -0.7173 -0.2971 0.6302
vn -0.7173 -0.2971 -0.6302
vn -0.7173 0.2971 0.6302
vn -0.7173 0.2971 -0.6302
vn -0.2971 0.7173 0.6302
vn -0.2971 0.7173 -0.6302
vn 0.2971 0.7173 0.6302
vn 0.2971 0.7173 -0.6302
vn 0.7173 0.2971 0.6302
vn 0.7173 0.2971 -0.6302
vn -0.9239 -0.3827 -0.0000
vn -0.9239 0.3827 -0.0000
vn 0.3827 0.9239 0.0000
vn 0.9239 0.3827 0.0000
vn -0.3827 0.9239 -0.0000
vn -0.3827 -0.9239 -0.0000
vn 0.3827 -0.9239 0.0000
vn 0.9239 -0.3827 0.0000
g Cylinder.000_Cylinder.000_None_Cylinder.000_Cylinder.000_None_None
s off
f 1/1/1 2/2/1 3/3/1 4/4/1 5/5/1 6/6/1 7/7/1 8/8/1
f 9/9/2 10/10/2 11/11/2 12/12/2 13/13/2 14/14/2 15/15/2 16/16/2
f 17/17/1 18/18/1 19/19/1 20/20/1 21/21/1 22/22/1 23/23/1 24/24/1
f 25/25/2 26/26/2 27/27/2 28/28/2 29/29/2 30/30/2 31/31/2 32/32/2
s 1
f 9/33/3 2/34/4 1/35/5 10/36/6
f 10/36/6 1/35/5 8/37/7 11/38/8
f 11/38/8 8/37/7 7/39/9 12/40/10
f 12/41/10 7/42/9 6/43/11 13/44/12
f 13/44/12 6/43/11 5/45/13 14/46/14
f 14/46/14 5/45/13 4/47/15 15/48/16
f 15/48/16 4/47/15 3/49/17 16/50/18
f 16/50/18 3/49/17 2/34/4 9/33/3
f 26/51/6 17/52/5 24/53/7 27/54/8
f 25/55/3 18/56/4 17/52/5 26/51/6
f 27/54/8 24/53/7 23/57/9 28/58/10
f 28/59/10 23/60/9 22/61/11 29/62/12
f 29/62/12 22/61/11 21/63/13 30/64/14
f 30/64/14 21/63/13 20/65/15 31/66/16
f 31/66/16 20/65/15 19/67/17 32/68/18
f 32/68/18 19/67/17 18/56/4 25/55/3
f 33/69/19 34/70/20 35/71/20 36/72/19
f 37/73/21 38/74/22 39/75/22 40/76/21
f 34/70/20 41/77/23 42/78/23 35/71/20
f 33/69/19 36/72/19 43/79/24 44/80/24
f 45/81/25 46/82/26 47/83/26 48/84/25
f 43/85/24 45/81/25 48/84/25 44/86/24
f 37/73/21 40/76/21 42/78/23 41/77/23
f 46/82/26 39/75/22 38/74/22 47/83/26

11
pipes.lua

@ -191,35 +191,32 @@ if REGISTER_COMPATIBILITY then
})
end
local valve_on = "pipeworks:valve_on_empty"
local valve_off = "pipeworks:valve_off_empty"
local entry_panel_empty = "pipeworks:entry_panel_empty"
local flow_sensor_empty = "pipeworks:flow_sensor_empty"
local sp_empty = "pipeworks:straight_pipe_empty"
-- XXX: why aren't these in devices.lua!?
table.insert(pipes_empty_nodenames, valve_on)
table.insert(pipes_empty_nodenames, valve_off)
table.insert(pipes_empty_nodenames, entry_panel_empty)
table.insert(pipes_empty_nodenames, flow_sensor_empty)
table.insert(pipes_empty_nodenames, sp_empty)
local valve_on_loaded = "pipeworks:valve_on_loaded"
local entry_panel_loaded = "pipeworks:entry_panel_loaded"
local flow_sensor_loaded = "pipeworks:flow_sensor_loaded"
local sp_loaded = "pipeworks:straight_pipe_loaded"
table.insert(pipes_full_nodenames, valve_on_loaded)
table.insert(pipes_full_nodenames, entry_panel_loaded)
table.insert(pipes_full_nodenames, flow_sensor_loaded)
table.insert(pipes_full_nodenames, sp_loaded)
pipeworks.pipes_full_nodenames = pipes_full_nodenames
pipeworks.pipes_empty_nodenames = pipes_empty_nodenames
if pipeworks.toggles.pipe_mode == "classic" then
minetest.register_abm({
nodenames = pipes_empty_nodenames,
interval = 1,

BIN
textures/pipeworks_straight_pipe_empty.png

After

Width: 64  |  Height: 64  |  Size: 2.8 KiB

BIN
textures/pipeworks_straight_pipe_loaded.png

After

Width: 64  |  Height: 64  |  Size: 2.8 KiB

Loading…
Cancel
Save