mesh-based tunnel tube segments

This commit is contained in:
FaceDeer 2018-05-20 23:44:19 -06:00
parent 2f5cb34b86
commit 84cbda2feb
8 changed files with 596 additions and 23 deletions

View File

@ -277,7 +277,7 @@ local c_med_crystal_30_45 = minetest.get_content_id("dfcaverns:med_crystal_30_45
local c_glow_ore = minetest.get_content_id("dfcaverns:glow_ruby_ore")
local place_big_crystal = function(data, data_param2, i, ceiling)
orientation = math.random()
local orientation = math.random()
if orientation < 0.33 then
if math.random() > 0.5 then
data[i] = c_big_crystal

View File

@ -0,0 +1,62 @@
# Blender MTL File: 'tunnel tube base.blend'
# Material Count: 6
newmtl Back
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl Bottom
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl Front
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl Left
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl Right
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl Top
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

View File

@ -0,0 +1,94 @@
# Blender v2.77 (sub 0) OBJ File: 'tunnel tube base.blend'
# www.blender.org
mtllib tunnel_tube_slant.mtl
o tunnel_tube_slant_Cube.002
v 0.500000 -0.500000 -0.500000
v 0.500000 -0.500000 0.500000
v -0.500000 -0.500000 0.500000
v -0.250000 -0.500000 0.250000
v 0.250000 -0.500000 0.250000
v 0.250000 -0.500000 -0.250000
v -0.250000 -0.500000 -0.250000
v -0.500000 -0.500000 -0.500000
v 0.500000 0.500000 -1.000000
v -0.500000 0.500000 -1.000000
v 0.500000 0.500000 0.000000
v -0.500000 0.500000 -0.000000
v -0.250000 0.500000 -0.250000
v -0.250000 0.500000 -0.750000
v 0.250000 0.500000 -0.750000
v 0.250000 0.500000 -0.250000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.2500 0.7500
vt 0.7500 0.7500
vt 0.7500 0.2500
vt 1.0000 -0.0000
vt -0.0000 0.0000
vt 0.2500 0.2500
vt 1.0000 1.0000
vt 1.0000 0.0000
vt 0.7500 0.2500
vt 0.7500 0.7500
vt 0.2500 0.7500
vt 0.0000 1.0000
vt 0.2500 0.2500
vt -0.0000 0.0000
vt 1.0000 0.0000
vt 1.5000 1.0000
vt 0.5000 1.0000
vt 0.0000 0.0000
vt 1.2500 1.0000
vt 0.7500 1.0000
vt 0.2500 0.0000
vt 0.7500 0.0000
vt 0.5000 1.0000
vt 1.5000 1.0000
vt 1.0000 0.0000
vt 0.7500 1.0000
vt 1.2500 1.0000
vt 0.7500 0.0000
vt 0.2500 0.0000
vt 1.0000 1.0000
vt -0.0000 1.0000
vt 0.7500 1.0000
vt 0.2500 1.0000
vt 0.2500 0.0000
vt 0.0000 0.0000
vt 0.2500 1.0000
vt 0.7500 0.0000
vn 0.0000 1.0000 0.0000
vn 0.0000 -1.0000 0.0000
vn 1.0000 0.0000 0.0000
vn -1.0000 -0.0000 -0.0000
vn -0.0000 0.4472 0.8944
vn 0.0000 -0.4472 -0.8944
g tunnel_tube_slant_Cube.002_Top
usemtl Top
s off
f 9/1/1 10/2/1 14/3/1 15/4/1
f 9/1/1 15/4/1 16/5/1 11/6/1
f 14/3/1 10/2/1 12/7/1 13/8/1
f 11/6/1 16/5/1 13/8/1 12/7/1
g tunnel_tube_slant_Cube.002_Bottom
usemtl Bottom
f 1/9/2 2/10/2 5/11/2 6/12/2
f 1/9/2 6/12/2 7/13/2 8/14/2
f 8/14/2 7/13/2 4/15/2 3/16/2
f 5/11/2 2/10/2 3/16/2 4/15/2
g tunnel_tube_slant_Cube.002_Right
usemtl Right
f 1/17/3 9/18/3 11/19/3 2/20/3
f 14/21/3 13/22/3 4/23/3 7/24/3
g tunnel_tube_slant_Cube.002_Left
usemtl Left
f 3/16/4 12/25/4 10/26/4 8/27/4
f 16/28/4 15/29/4 6/30/4 5/31/4
g tunnel_tube_slant_Cube.002_Front
usemtl Front
f 2/10/5 11/32/5 12/33/5 3/16/5
f 15/34/5 14/35/5 7/36/5 6/30/5
g tunnel_tube_slant_Cube.002_Back
usemtl Back
f 9/1/6 1/17/6 8/37/6 10/2/6
f 13/38/6 16/28/6 5/39/6 4/23/6

View File

@ -0,0 +1,62 @@
# Blender MTL File: 'tunnel tube base.blend'
# Material Count: 6
newmtl Back
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl Bottom
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl Front
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl Left
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl Right
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl Top
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

View File

@ -0,0 +1,94 @@
# Blender v2.77 (sub 0) OBJ File: 'tunnel tube base.blend'
# www.blender.org
mtllib tunnel_tube_slant_2.mtl
o tunnel_tube_slant_Cube.002
v 0.500000 -0.500000 0.000000
v 0.500000 -0.500000 1.000000
v -0.500000 -0.500000 1.000000
v -0.250000 -0.500000 0.750000
v 0.250000 -0.500000 0.750000
v 0.250000 -0.500000 0.250000
v -0.250000 -0.500000 0.250000
v -0.500000 -0.500000 -0.000000
v 0.500000 0.500000 -0.500000
v -0.500000 0.500000 -0.500000
v 0.500000 0.500000 0.500000
v -0.500000 0.500000 0.500000
v -0.250000 0.500000 0.250000
v -0.250000 0.500000 -0.250000
v 0.250000 0.500000 -0.250000
v 0.250000 0.500000 0.250000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.2500 0.7500
vt 0.7500 0.7500
vt 0.7500 0.2500
vt 1.0000 -0.0000
vt -0.0000 0.0000
vt 0.2500 0.2500
vt 1.0000 1.0000
vt 1.0000 0.0000
vt 0.7500 0.2500
vt 0.7500 0.7500
vt 0.2500 0.7500
vt 0.0000 1.0000
vt 0.2500 0.2500
vt -0.0000 0.0000
vt 0.5000 0.0000
vt -0.0000 1.0000
vt -0.5000 0.0000
vt 0.7500 1.0000
vt 0.2500 1.0000
vt -0.2500 0.0000
vt 0.2500 0.0000
vt -0.5000 0.0000
vt 0.0000 1.0000
vt 1.0000 1.0000
vt 0.5000 0.0000
vt 0.2500 1.0000
vt 0.7500 1.0000
vt 0.2500 0.0000
vt -0.2500 0.0000
vt 1.0000 1.0000
vt 0.2500 1.0000
vt 0.7500 0.0000
vt 1.0000 0.0000
vt 0.0000 0.0000
vt 0.7500 1.0000
vt 0.7500 0.0000
vt 0.2500 0.0000
vn 0.0000 1.0000 0.0000
vn 0.0000 -1.0000 0.0000
vn 1.0000 0.0000 0.0000
vn -1.0000 -0.0000 -0.0000
vn -0.0000 0.4472 0.8944
vn 0.0000 -0.4472 -0.8944
g tunnel_tube_slant_Cube.002_Top
usemtl Top
s off
f 9/1/1 10/2/1 14/3/1 15/4/1
f 9/1/1 15/4/1 16/5/1 11/6/1
f 14/3/1 10/2/1 12/7/1 13/8/1
f 11/6/1 16/5/1 13/8/1 12/7/1
g tunnel_tube_slant_Cube.002_Bottom
usemtl Bottom
f 1/9/2 2/10/2 5/11/2 6/12/2
f 1/9/2 6/12/2 7/13/2 8/14/2
f 8/14/2 7/13/2 4/15/2 3/16/2
f 5/11/2 2/10/2 3/16/2 4/15/2
g tunnel_tube_slant_Cube.002_Right
usemtl Right
f 1/17/3 9/1/3 11/18/3 2/19/3
f 14/20/3 13/21/3 4/22/3 7/23/3
g tunnel_tube_slant_Cube.002_Left
usemtl Left
f 3/24/4 12/25/4 10/26/4 8/27/4
f 16/28/4 15/29/4 6/30/4 5/31/4
g tunnel_tube_slant_Cube.002_Front
usemtl Front
f 2/10/5 11/32/5 12/25/5 3/16/5
f 15/29/5 14/33/5 7/23/5 6/34/5
g tunnel_tube_slant_Cube.002_Back
usemtl Back
f 9/1/6 1/35/6 8/36/6 10/2/6
f 13/21/6 16/37/6 5/38/6 4/39/6

View File

@ -0,0 +1,62 @@
# Blender MTL File: 'tunnel tube base.blend'
# Material Count: 6
newmtl Back
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl Bottom
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl Front
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl Left
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl Right
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl Top
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

View File

@ -0,0 +1,94 @@
# Blender v2.77 (sub 0) OBJ File: 'tunnel tube base.blend'
# www.blender.org
mtllib tunnel_tube_slant_full.mtl
o tunnel_tube_slant_Cube.002
v 0.500000 -0.500000 -0.500000
v 0.500000 -0.500000 0.500000
v -0.500000 -0.500000 0.500000
v -0.250000 -0.500000 0.250000
v 0.250000 -0.500000 0.250000
v 0.250000 -0.500000 -0.250000
v -0.250000 -0.500000 -0.250000
v -0.500000 -0.500000 -0.500000
v 0.500000 0.500000 -1.500000
v -0.500000 0.500000 -1.500000
v 0.500000 0.500000 -0.500000
v -0.500000 0.500000 -0.500000
v -0.250000 0.500000 -0.750000
v -0.250000 0.500000 -1.250000
v 0.250000 0.500000 -1.250000
v 0.250000 0.500000 -0.750000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.2500 0.7500
vt 0.7500 0.7500
vt 0.7500 0.2500
vt 1.0000 -0.0000
vt -0.0000 0.0000
vt 0.2500 0.2500
vt 1.0000 1.0000
vt 1.0000 0.0000
vt 0.7500 0.2500
vt 0.7500 0.7500
vt 0.2500 0.7500
vt 0.0000 1.0000
vt 0.2500 0.2500
vt -0.0000 0.0000
vt 1.0000 0.0000
vt 2.0000 1.0000
vt 1.0000 1.0000
vt 0.0000 0.0000
vt 1.7500 1.0000
vt 1.2500 1.0000
vt 0.2500 0.0000
vt 0.7500 0.0000
vt 1.0000 1.0000
vt 2.0000 1.0000
vt 1.0000 0.0000
vt 1.2500 1.0000
vt 1.7500 1.0000
vt 0.7500 0.0000
vt 0.2500 0.0000
vt -0.0000 1.0000
vt 0.7500 1.2500
vt 0.2500 1.2500
vt 0.2500 0.2500
vt 0.7500 0.2500
vt 0.0000 0.0000
vt 0.2500 1.2500
vt 0.7500 1.2500
vn 0.0000 1.0000 0.0000
vn 0.0000 -1.0000 0.0000
vn 1.0000 0.0000 0.0000
vn -1.0000 -0.0000 -0.0000
vn -0.0000 0.7071 0.7071
vn 0.0000 -0.7071 -0.7071
g tunnel_tube_slant_Cube.002_Top
usemtl Top
s off
f 9/1/1 10/2/1 14/3/1 15/4/1
f 9/1/1 15/4/1 16/5/1 11/6/1
f 14/3/1 10/2/1 12/7/1 13/8/1
f 11/6/1 16/5/1 13/8/1 12/7/1
g tunnel_tube_slant_Cube.002_Bottom
usemtl Bottom
f 1/9/2 2/10/2 5/11/2 6/12/2
f 1/9/2 6/12/2 7/13/2 8/14/2
f 8/14/2 7/13/2 4/15/2 3/16/2
f 5/11/2 2/10/2 3/16/2 4/15/2
g tunnel_tube_slant_Cube.002_Right
usemtl Right
f 1/17/3 9/18/3 11/19/3 2/20/3
f 14/21/3 13/22/3 4/23/3 7/24/3
g tunnel_tube_slant_Cube.002_Left
usemtl Left
f 3/16/4 12/25/4 10/26/4 8/27/4
f 16/28/4 15/29/4 6/30/4 5/31/4
g tunnel_tube_slant_Cube.002_Front
usemtl Front
f 2/10/5 11/19/5 12/32/5 3/16/5
f 15/33/5 14/34/5 7/35/5 6/36/5
g tunnel_tube_slant_Cube.002_Back
usemtl Back
f 9/1/6 1/17/6 8/37/6 10/2/6
f 13/38/6 16/39/6 5/11/6 4/15/6

View File

@ -35,6 +35,94 @@ minetest.register_node("dfcaverns:tunnel_tube", {
},
})
minetest.register_node("dfcaverns:tunnel_tube_slant_bottom", {
description = S("Tunnel Tube"),
_doc_items_longdesc = dfcaverns.doc.tunnel_tube_desc,
_doc_items_usagehelp = dfcaverns.doc.tunnel_tube_usage,
tiles = {"dfcaverns_tunnel_tube.png", "dfcaverns_tunnel_tube.png", "dfcaverns_tunnel_tube.png", "dfcaverns_tunnel_tube.png", "dfcaverns_tunnel_tube.png", "dfcaverns_tunnel_tube.png"},
paramtype2 = "facedir",
drawtype = "mesh",
mesh = "tunnel_tube_slant.obj",
paramtype = "light",
drop = "dfcaverns:tunnel_tube",
groups = {choppy = 3, tree = 1, oddly_breakable_by_hand=1, flammable = 2},
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node,
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.625, 0.5, 0.0, 0.375},
{-0.5, 0.0, -0.875, 0.5, 0.5, 0.125},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.625, 0.5, 0.0, 0.375},
{-0.5, 0.0, -0.875, 0.5, 0.5, 0.125},
},
},
})
minetest.register_node("dfcaverns:tunnel_tube_slant_top", {
description = S("Tunnel Tube"),
_doc_items_longdesc = dfcaverns.doc.tunnel_tube_desc,
_doc_items_usagehelp = dfcaverns.doc.tunnel_tube_usage,
tiles = {"dfcaverns_tunnel_tube.png", "dfcaverns_tunnel_tube.png", "dfcaverns_tunnel_tube.png", "dfcaverns_tunnel_tube.png", "dfcaverns_tunnel_tube.png", "dfcaverns_tunnel_tube.png"},
paramtype2 = "facedir",
drawtype = "mesh",
mesh = "tunnel_tube_slant_2.obj",
paramtype = "light",
drop = "dfcaverns:tunnel_tube",
groups = {choppy = 3, tree = 1, oddly_breakable_by_hand=1, flammable = 2},
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node,
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.125, 0.5, 0.0, 0.875},
{-0.5, 0.0, -0.375, 0.5, 0.5, 0.625},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.125, 0.5, 0.0, 0.875},
{-0.5, 0.0, -0.375, 0.5, 0.5, 0.625},
},
},
})
minetest.register_node("dfcaverns:tunnel_tube_slant_full", {
description = S("Tunnel Tube"),
_doc_items_longdesc = dfcaverns.doc.tunnel_tube_desc,
_doc_items_usagehelp = dfcaverns.doc.tunnel_tube_usage,
tiles = {"dfcaverns_tunnel_tube.png", "dfcaverns_tunnel_tube.png", "dfcaverns_tunnel_tube.png", "dfcaverns_tunnel_tube.png", "dfcaverns_tunnel_tube.png", "dfcaverns_tunnel_tube.png"},
paramtype2 = "facedir",
drawtype = "mesh",
mesh = "tunnel_tube_slant_full.obj",
paramtype = "light",
drop = "dfcaverns:tunnel_tube",
groups = {choppy = 3, tree = 1, oddly_breakable_by_hand=1, flammable = 2},
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node,
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.75, 0.5, 0, 0.25},
{-0.5, 0, -1.25, 0.5, 0.5, -0.25},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.75, 0.5, 0, 0.25},
{-0.5, 0, -1.25, 0.5, 0.5, -0.25},
},
},
})
--Wood
minetest.register_craft({
output = 'dfcaverns:tunnel_tube_wood 4',
@ -218,23 +306,27 @@ minetest.register_node("dfcaverns:tunnel_tube_sapling", {
})
local tunnel_tube_directions = {
{x=1,y=0,z=0},
{x=-1,y=0,z=0},
{x=0,y=0,z=1},
{x=0,y=0,z=-1},
-- {x=1,y=0,z=1}, -- diagonals work, but they don't look as nice as orthogonals
-- {x=-1,y=0,z=1},
-- {x=1,y=0,z=-1},
-- {x=-1,y=0,z=-1},
[0] = {x=0,y=0,z=-1},
[1] = {x=-1,y=0,z=0},
[2] = {x=0,y=0,z=1},
[3] = {x=1,y=0,z=0},
}
local tunnel_tube_curvature = {0,0,0,0,1,1,1,2,2,3,4}
local tunnel_tube_displacement =
{
[4] = 1,
[5] = 1,
[6] = 2,
[7] = 2,
[8] = 3,
[9] = 3,
}
dfcaverns.spawn_tunnel_tube = function(pos)
local direction = tunnel_tube_directions[math.random(1,4)]
local height = math.random(6,10)
local direction = math.random(0,3) -- serves as both the facedir and the lookup in the direction table
local height = math.random(4,9)
local x, y, z = pos.x, pos.y, pos.z
local top_pos = vector.add(pos, vector.multiply(direction, tunnel_tube_curvature[height]))
local top_pos = vector.add(pos, vector.multiply(tunnel_tube_directions[direction], tunnel_tube_displacement[height]))
top_pos.y = y + height - 1
local vm = minetest.get_voxel_manip()
@ -254,28 +346,41 @@ end
local c_air = minetest.get_content_id("air")
local c_ignore = minetest.get_content_id("ignore")
local c_tunnel_tube = minetest.get_content_id("dfcaverns:tunnel_tube")
local c_tunnel_tube_bottom = minetest.get_content_id("dfcaverns:tunnel_tube_slant_bottom")
local c_tunnel_tube_top = minetest.get_content_id("dfcaverns:tunnel_tube_slant_top")
local c_tunnel_tube_full = minetest.get_content_id("dfcaverns:tunnel_tube_slant_full")
local c_tunnel_tube_fruiting_body = minetest.get_content_id("dfcaverns:tunnel_tube_fruiting_body")
-- was simplest to just hardcode these patterns for each height from 4 to 9
-- pattern is displacement, node
local tunnel_tube_patterns =
{
[4] = {{0, c_tunnel_tube}, {0, c_tunnel_tube_bottom}, {1, c_tunnel_tube_top}, {1, c_tunnel_tube_fruiting_body}},
[5] = {{0, c_tunnel_tube}, {0, c_tunnel_tube}, {0, c_tunnel_tube_bottom}, {1, c_tunnel_tube_top}, {1, c_tunnel_tube_fruiting_body}},
[6] = {{0, c_tunnel_tube}, {0, c_tunnel_tube}, {0, c_tunnel_tube_bottom}, {1, c_tunnel_tube_top}, {1, c_tunnel_tube_full}, {2, c_tunnel_tube_fruiting_body}},
[7] = {{0, c_tunnel_tube}, {0, c_tunnel_tube}, {0, c_tunnel_tube}, {0, c_tunnel_tube_bottom}, {1, c_tunnel_tube_top}, {1, c_tunnel_tube_full}, {2, c_tunnel_tube_fruiting_body}},
[8] = {{0, c_tunnel_tube}, {0, c_tunnel_tube}, {0, c_tunnel_tube}, {0, c_tunnel_tube_bottom}, {1, c_tunnel_tube_top}, {1, c_tunnel_tube_full}, {2, c_tunnel_tube_full}, {3, c_tunnel_tube_fruiting_body}},
[9] = {{0, c_tunnel_tube}, {0, c_tunnel_tube}, {0, c_tunnel_tube}, {0, c_tunnel_tube}, {0, c_tunnel_tube_bottom}, {1, c_tunnel_tube_top}, {1, c_tunnel_tube_full}, {2, c_tunnel_tube_full}, {3, c_tunnel_tube_fruiting_body}},
}
dfcaverns.spawn_tunnel_tube_vm = function(vi, area, data, param2_data, height, direction)
if not height then height = math.random(6, 10) end
if not direction then direction = tunnel_tube_directions[math.random(1,4)] end
if not height then height = math.random(4, 9) end
if direction == nil then direction = math.random(0,3) end
local pos = area:position(vi)
local y = pos.y
local previous_vi = vi
for i = 1, height do
local pattern = tunnel_tube_patterns[height]
for i, nodepattern in ipairs(pattern) do
pos.y = y + i - 1
vi = area:indexp(vector.add(pos, vector.multiply(direction, tunnel_tube_curvature[i])))
vi = area:indexp(vector.add(pos, vector.multiply(tunnel_tube_directions[direction], nodepattern[1])))
if data[vi] == c_air or data[vi] == c_ignore then
previous_vi = vi
if i ~= height then
data[vi] = c_tunnel_tube
param2_data[vi] = 0
else
data[vi] = c_tunnel_tube_fruiting_body
end
data[vi] = nodepattern[2]
param2_data[vi] = direction
else
data[previous_vi] = c_tunnel_tube_fruiting_body
param2_data[vi] = direction
break
end
end