Initial commit

This commit is contained in:
FaceDeer 2017-03-07 23:50:58 -07:00
parent 53a946f83a
commit 95dff36239
69 changed files with 1239 additions and 0 deletions

0
biomes.lua Normal file
View File

98
black_cap.lua Normal file
View File

@ -0,0 +1,98 @@
-- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
--stem
minetest.register_node("dfcaverns:black_cap_stem", {
description = S("Black Cap Stem"),
tiles = {"dfcaverns_black_cap_top.png","dfcaverns_black_cap_top.png","dfcaverns_black_cap_side.png",},
is_ground_content = true,
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
sounds = default.node_sound_wood_defaults(),
})
--cap
minetest.register_node("dfcaverns:black_cap", {
description = S("Black Cap"),
tiles = {"dfcaverns_black_cap_top.png","dfcaverns_black_cap_top.png","dfcaverns_black_cap_side.png^[transformR90",},
is_ground_content = true,
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
sounds = default.node_sound_wood_defaults(),
})
--gills
minetest.register_node("dfcaverns:black_cap_gills", {
description = S("Black Cap Gills"),
tiles = {"dfcaverns_black_cap_gills.png"},
is_ground_content = true,
groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
sounds = default.node_sound_leaves_defaults(),
drawtype = "plantlike",
paramtype = "light",
drop = {
max_items = 1,
items = {
{
items = {'dfcaverns:black_cap_sapling'},
rarity = 10,
},
{
items = {'dfcaverns:black_cap_gills'},
}
}
},
})
-- sapling
minetest.register_node("dfcaverns:black_cap_sapling", {
description = S("Black Cap Spawn"),
drawtype = "plantlike",
visual_scale = 1.0,
tiles = {"dfcaverns_spore_tree_sapling.png"},
inventory_image = "dfcaverns_spore_tree_sapling.png",
wield_image = "dfcaverns_spore_tree_sapling.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
},
groups = {snappy = 2, dig_immediate = 3, flammable = 2,
attached_node = 1, sapling = 1},
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
minetest.get_node_timer(pos):start(math.random(dfcaverns.config.black_cap_min_growth_delay,dfcaverns.config.black_cap_max_growth_delay))
end,
on_timer = function(pos)
minetest.set_node(pos, {name="air"})
dfcaverns.spawn_black_cap(pos)
end,
})
dfcaverns.spawn_black_cap = function(pos)
local x, y, z = pos.x, pos.y, pos.z
local stem_height = math.random(1,5)
local cap_radius = math.random(2,3)
local maxy = y + stem_height + 3
local c_stem = minetest.get_content_id("dfcaverns:black_cap_stem")
local c_cap = minetest.get_content_id("dfcaverns:black_cap")
local c_gills = minetest.get_content_id("dfcaverns:black_cap_gills")
local vm = minetest.get_voxel_manip()
local minp, maxp = vm:read_from_map(
{x = x - cap_radius, y = y, z = z - cap_radius},
{x = x + cap_radius, y = maxy + 3, z = z + cap_radius}
)
local area = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
local data = vm:get_data()
subterrane:giant_shroom(area:indexp(pos), area, data, c_stem, c_cap, c_gills, stem_height, cap_radius)
vm:set_data(data)
vm:write_to_map()
vm:update_map()
end

118
blood_thorn.lua Normal file
View File

@ -0,0 +1,118 @@
--------------------------------------------------
-- Blood thorn
-- Max trunk height 5
-- red with purple mottling
-- High density wood
-- Depth 3
-- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
minetest.register_node("dfcaverns:blood_thorn", {
description = S("Blood Thorn Trunk"),
tiles = {"dfcaverns_blood_thorn_top.png", "dfcaverns_blood_thorn_top.png",
"dfcaverns_blood_thorn_side.png"},
paramtype2 = "facedir",
groups = {choppy = 3, flammable = 2},
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node,
})
minetest.register_node("dfcaverns:blood_thorn_spike", {
description = S("Blood Thorn Spike"),
tiles = {"dfcaverns_blood_thorn_spike_side.png^[transformR90", "dfcaverns_blood_thorn_spike_side.png^[transformR270", "dfcaverns_blood_thorn_spike_side.png", "dfcaverns_blood_thorn_spike_side.png^[transformR180", "dfcaverns_blood_thorn_spike_front.png", "dfcaverns_blood_thorn_spike_front.png"},
groups = {choppy = 3, flammable = 2, fall_damage_add_percent=100},
sounds = default.node_sound_wood_defaults(),
drawtype = "nodebox",
climbable = true,
damage_per_second = 1,
paramtype = "light",
paramtype2 = "facedir",
node_box = {
type = "fixed",
fixed = {
{-0.1875, -0.1875, 0.1875, 0.1875, 0.1875, 0.5}, -- base
{-0.125, -0.125, -0.125, 0.125, 0.125, 0.1875}, -- mid
{-0.0625, -0.0625, -0.5, 0.0625, 0.0625, -0.125}, -- tip
}
},
})
local spike_directions = {{x=0,y=0,z=1}, {x=0,y=0,z=-1}, {x=1,y=0,z=0}, {x=-1,y=0,z=0}}
function dfcaverns.grow_blood_thorn(pos, node)
if node.param2 >= 4 then
return
end
pos.y = pos.y - 1
if minetest.get_item_group(minetest.get_node(pos).name, "sand") == 0 then
return
end
pos.y = pos.y + 1
local height = 0
while node.name == "dfcaverns:blood_thorn" and height < 4 do
height = height + 1
pos.y = pos.y + 1
node = minetest.get_node(pos)
end
if height == 6 or node.name ~= "air" then
return
end
-- if minetest.get_node_light(pos) < 13 then
-- return
-- end
minetest.set_node(pos, {name = "dfcaverns:blood_thorn"})
local dir = spike_directions[math.random(1,4)]
local spike_pos = vector.add(pos, dir)
if minetest.get_node(spike_pos).name == "air" then
local facedir = minetest.dir_to_facedir(vector.multiply(dir, -1))
minetest.set_node(spike_pos, {name="dfcaverns:blood_thorn_spike", param2=facedir})
end
dir = spike_directions[math.random(1,4)]
spike_pos = vector.add(pos, dir)
if minetest.get_node(spike_pos).name == "air" then
local facedir = minetest.dir_to_facedir(vector.multiply(dir, -1))
minetest.set_node(spike_pos, {name="dfcaverns:blood_thorn_spike", param2=facedir})
end
return true
end
minetest.register_abm({
label = "Grow Blood Thorn",
nodenames = {"dfcaverns:blood_thorn"},
catch_up = true,
neighbors = {"group:sand"},
interval = dfcaverns.config.blood_thorn_growth_interval,
chance = dfcaverns.config.blood_thorn_growth_chance,
action = function(pos, node)
dfcaverns.grow_blood_thorn(pos, node)
end
})
function dfcaverns.spawn_blood_thorn(pos)
local height = math.random(3,5)
for i = 0, height do
if minetest.get_node(pos).name == "air" then
minetest.set_node(pos, {name="dfcaverns:blood_thorn"})
local dir = spike_directions[math.random(1,4)]
local spike_pos = vector.add(pos, dir)
if minetest.get_node(spike_pos).name == "air" then
local facedir = minetest.dir_to_facedir(vector.multiply(dir, -1))
minetest.set_node(spike_pos, {name="dfcaverns:blood_thorn_spike", param2=facedir})
end
dir = spike_directions[math.random(1,4)]
spike_pos = vector.add(pos, dir)
if minetest.get_node(spike_pos).name == "air" then
local facedir = minetest.dir_to_facedir(vector.multiply(dir, -1))
minetest.set_node(spike_pos, {name="dfcaverns:blood_thorn_spike", param2=facedir})
end
else
break
end
pos.y = pos.y + 1
end
end

46
config.lua Normal file
View File

@ -0,0 +1,46 @@
local CONFIG_FILE_PREFIX = "dfcaverns_"
dfcaverns.config = {}
local print_settingtypes = true
local function setting(stype, name, default, description)
local value
if stype == "bool" then
value = minetest.setting_getbool(CONFIG_FILE_PREFIX..name)
elseif stype == "string" then
value = minetest.setting_get(CONFIG_FILE_PREFIX..name)
elseif stype == "int" or stype == "float" then
value = tonumber(minetest.setting_get(CONFIG_FILE_PREFIX..name))
end
if value == nil then
value = default
end
dfcaverns.config[name] = value
if print_settingtypes then
minetest.debug(CONFIG_FILE_PREFIX..name.." ("..description..") "..stype.." "..tostring(default))
end
end
local trees = {
{name="fungiwood", min_delay=2400, max_delay=4800, min_depth=-100, max_depth=-31000},
{name="tunnel_tube", min_delay=2400, max_delay=4800, min_depth=-100, max_depth=-31000},
{name="spore_tree", min_delay=2400, max_delay=4800, min_depth=-100, max_depth=-31000},
{name="black_cap", min_delay=2400, max_delay=4800, min_depth=-100, max_depth=-31000},
{name="nether_cap", min_delay=2400, max_delay=4800, min_depth=-100, max_depth=-31000},
{name="goblin_cap", min_delay=2400, max_delay=4800, min_depth=-100, max_depth=-31000},
{name="tower_cap", min_delay=2400, max_delay=4800, min_depth=-100, max_depth=-31000},
}
for _, tree in pairs(trees) do
setting("int", tree.name.."_min_growth_delay", tree.min_delay, tree.name.." minimum sapling growth delay")
setting("int", tree.name.."_max_growth_delay", tree.max_delay, tree.name.." maximum sapling growth delay")
setting("int", tree.name.."_min_depth", tree.min_depth, tree.name.." minimum sapling growth depth")
setting("int", tree.name.."_max_depth", tree.max_depth, tree.name.." maximum sapling growth depth")
end
setting("int", "blood_thorn_growth_interval", 12, "blood_thorn growth ABM interval")
setting("int", "blood_thorn_growth_chance", 83, "blood_thorn growth ABM interval")
setting("int", "blood_thorn_min_depth", -100, "blood_thorn minimum sapling growth depth")
setting("int", "blood_thorn_max_depth", -31000, "blood_thorn maximum sapling growth depth")

3
depends.txt Normal file
View File

@ -0,0 +1,3 @@
default
subterrane
farming

173
fungiwood.lua Normal file
View File

@ -0,0 +1,173 @@
--------------------------------------------------
-- Fungiwood
-- fine grain
-- Max trunk height 8
-- depth 1-2
-- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
minetest.register_node("dfcaverns:fungiwood", {
description = S("Fungiwood Trunk"),
tiles = {"dfcaverns_fungiwood.png"},
paramtype2 = "facedir",
is_ground_content = false,
groups = {tree = 1, choppy = 3, oddly_breakable_by_hand = 1, flammable = 3},
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node
})
minetest.register_node("dfcaverns:fungiwood_shelf",{
description = S("Fungiwood Shelf"),
tiles = {"dfcaverns_fungiwood.png", "dfcaverns_fungiwood_shelf_underside.png", "dfcaverns_fungiwood.png"},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
node_box = {
type = "fixed",
fixed = {
{-0.5, 0.375, -0.5, 0.5, 0.5, 0.5}, -- NodeBox1
{-0.5, 0.3125, -0.0625, 0.5, 0.375, 0.0625}, -- NodeBox2
{-0.0625, 0.3125, -0.5, 0.0625, 0.375, 0.5}, -- NodeBox3
}
},
is_ground_content = false,
groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
drop = {
max_items = 1,
items = {
{items = {"dfcaverns:fungiwood_sapling"}, rarity = 20},
{items = {"dfcaverns:fungiwood_shelf"}}
}
},
sounds = default.node_sound_leaves_defaults(),
after_place_node = default.after_place_leaves,
})
minetest.register_node("dfcaverns:fungiwood_sapling", {
description = S("Fungiwood Spawn"),
drawtype = "plantlike",
visual_scale = 1.0,
tiles = {"dfcaverns_fungiwood_sapling.png"},
inventory_image = "dfcaverns_fungiwood_sapling.png",
wield_image = "dfcaverns_fungiwood_sapling.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
},
groups = {snappy = 2, dig_immediate = 3, flammable = 2,
attached_node = 1, sapling = 1},
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
minetest.get_node_timer(pos):start(math.random(dfcaverns.config.fungiwood_min_growth_delay,dfcaverns.config.fungiwood_max_growth_delay))
end,
on_timer = function(pos)
minetest.set_node(pos, {name="air"})
dfcaverns.spawn_fungiwood(pos)
end,
})
function dfcaverns.spawn_fungiwood(pos)
local x, y, z = pos.x, pos.y, pos.z
local maxy = y + math.random(6, 10) -- Trunk top
local c_air = minetest.get_content_id("air")
local c_ignore = minetest.get_content_id("ignore")
local c_fungiwood = minetest.get_content_id("dfcaverns:fungiwood")
local c_fungiwood_shelf = minetest.get_content_id("dfcaverns:fungiwood_shelf")
local vm = minetest.get_voxel_manip()
local minp, maxp = vm:read_from_map(
{x = x - 3, y = y, z = z - 3},
{x = x + 3, y = maxy + 3, z = z + 3}
)
local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
local data = vm:get_data()
-- Upper branches layer
local dev = 3
for yy = maxy - 2, maxy do
for zz = z - dev, z + dev do
local vi = a:index(x - dev, yy, zz)
local via = a:index(x - dev, yy + 1, zz)
for xx = x - dev, x + dev do
if math.random() < 0.95 - dev * 0.05 then
local node_id = data[vi]
if node_id == c_air or node_id == c_ignore then
data[vi] = c_fungiwood_shelf
end
end
vi = vi + 1
via = via + 1
end
end
dev = dev - 1
end
-- Lower branches layer
local my = 0
for i = 1, 20 do -- Random 2x2 squares of shelf
local xi = x + math.random(-3, 2)
local yy = maxy + math.random(-6, -5)
local zi = z + math.random(-3, 2)
if yy > my then
my = yy
end
for zz = zi, zi+1 do
local vi = a:index(xi, yy, zz)
local via = a:index(xi, yy + 1, zz)
for xx = xi, xi + 1 do
local node_id = data[vi]
if node_id == c_air or node_id == c_ignore then
data[vi] = c_fungiwood_shelf
end
vi = vi + 1
via = via + 1
end
end
end
dev = 2
for yy = my + 1, my + 2 do
for zz = z - dev, z + dev do
local vi = a:index(x - dev, yy, zz)
local via = a:index(x - dev, yy + 1, zz)
for xx = x - dev, x + dev do
if math.random() < 0.95 - dev * 0.05 then
local node_id = data[vi]
if node_id == c_air or node_id == c_ignore then
data[vi] = c_fungiwood_shelf
end
end
vi = vi + 1
via = via + 1
end
end
dev = dev - 1
end
-- Trunk
for yy = y, maxy do
local vi = a:index(x, yy, z)
local node_id = data[vi]
if node_id == c_air or node_id == c_ignore or
node_id == c_fungiwood_shelf then
data[vi] = c_fungiwood
end
end
vm:set_data(data)
vm:write_to_map()
vm:update_map()
end

98
goblin_cap.lua Normal file
View File

@ -0,0 +1,98 @@
-- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
--stem
minetest.register_node("dfcaverns:goblin_cap_stem", {
description = S("Goblin Cap Stem"),
tiles = {"dfcaverns_goblin_cap_stem.png"},
is_ground_content = true,
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
sounds = default.node_sound_wood_defaults(),
})
--cap
minetest.register_node("dfcaverns:goblin_cap", {
description = S("Goblin Cap"),
tiles = {"dfcaverns_goblin_cap.png"},
is_ground_content = true,
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
sounds = default.node_sound_wood_defaults(),
})
--gills
minetest.register_node("dfcaverns:goblin_cap_gills", {
description = S("Goblin Cap Gills"),
tiles = {"dfcaverns_goblin_cap_gills.png"},
is_ground_content = true,
groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
sounds = default.node_sound_leaves_defaults(),
drawtype = "plantlike",
paramtype = "light",
drop = {
max_items = 1,
items = {
{
items = {'dfcaverns:goblin_cap_sapling'},
rarity = 15,
},
{
items = {'dfcaverns:goblin_cap_gills'},
}
}
},
})
-- sapling
minetest.register_node("dfcaverns:goblin_cap_sapling", {
description = S("Goblin Cap Spawn"),
drawtype = "plantlike",
visual_scale = 1.0,
tiles = {"dfcaverns_spore_tree_sapling.png"},
inventory_image = "dfcaverns_spore_tree_sapling.png",
wield_image = "dfcaverns_spore_tree_sapling.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
},
groups = {snappy = 2, dig_immediate = 3, flammable = 2,
attached_node = 1, sapling = 1},
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
minetest.get_node_timer(pos):start(math.random(dfcaverns.config.goblin_cap_min_growth_delay,dfcaverns.config.goblin_cap_max_growth_delay))
end,
on_timer = function(pos)
minetest.set_node(pos, {name="air"})
dfcaverns.spawn_goblin_cap(pos)
end,
})
dfcaverns.spawn_goblin_cap = function(pos)
local x, y, z = pos.x, pos.y, pos.z
local stem_height = math.random(1,3)
local cap_radius = math.random(3,6)
local maxy = y + stem_height + 3
local c_stem = minetest.get_content_id("dfcaverns:goblin_cap_stem")
local c_cap = minetest.get_content_id("dfcaverns:goblin_cap")
local c_gills = minetest.get_content_id("dfcaverns:goblin_cap_gills")
local vm = minetest.get_voxel_manip()
local minp, maxp = vm:read_from_map(
{x = x - cap_radius, y = y, z = z - cap_radius},
{x = x + cap_radius, y = maxy + 3, z = z + cap_radius}
)
local area = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
local data = vm:get_data()
subterrane:giant_shroom(area:indexp(pos), area, data, c_stem, c_cap, c_gills, stem_height, cap_radius)
vm:set_data(data)
vm:write_to_map()
vm:update_map()
end

55
ground_cover.lua Normal file
View File

@ -0,0 +1,55 @@
-- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
--------------------------------------------------
-- Cave moss
-- cyan/dark cyan
minetest.register_node("dfcaverns:cobble_cave_moss", {
description = S("Cobblestone With Cave Moss"),
tiles = {"default_cobble.png^dfcaverns_cave_moss.png", "default_cobble.png", "default_cobble.png^dfcaverns_cave_moss_side.png"},
drop = "default:cobble",
is_ground_content = false,
groups = {cracky = 3, stone = 2},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_abm{
label = "cave moss spread",
nodenames = {"default:cobble"},
neighbors = {"dfcaverns:cobble_cave_moss"},
interval = 30,
chance = 10,
catch_up = true,
action = function(pos)
minetest.swap_node(pos, {name="dfcaverns:cobble_cave_moss"})
end,
}
--------------------------------------------------
-- floor fungus
-- white/yellow
minetest.register_node("dfcaverns:cobble_floor_fungus", {
description = S("Cobblestone With Floor Fungus"),
tiles = {"default_cobble.png^dfcaverns_floor_fungus.png", "default_cobble.png", "default_cobble.png^dfcaverns_floor_fungus_side.png"},
drops= "default:cobble",
is_ground_content = false,
groups = {cracky = 3, stone = 2},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_abm{
label = "floor fungus spread",
nodenames = {"default:cobble"},
neighbors = {"dfcaverns:cobble_floor_fungus"},
interval = 30,
chance = 10,
catch_up = true,
action = function(pos)
minetest.swap_node(pos, {name="dfcaverns:cobble_floor_fungus"})
end,
}

20
init.lua Normal file
View File

@ -0,0 +1,20 @@
dfcaverns = {}
--grab a shorthand for the filepath of the mod
local modpath = minetest.get_modpath(minetest.get_current_modname())
--load companion lua files
dofile(modpath.."/config.lua")
dofile(modpath.."/ground_cover.lua")
dofile(modpath.."/plants.lua")
-- Trees
dofile(modpath.."/blood_thorn.lua")
dofile(modpath.."/fungiwood.lua")
dofile(modpath.."/tunnel_tube.lua")
dofile(modpath.."/spore_tree.lua")
dofile(modpath.."/black_cap.lua")
dofile(modpath.."/nether_cap.lua")
dofile(modpath.."/goblin_cap.lua")
dofile(modpath.."/tower_cap.lua")

45
intllib.lua Normal file
View File

@ -0,0 +1,45 @@
-- Fallback functions for when `intllib` is not installed.
-- Code released under Unlicense <http://unlicense.org>.
-- Get the latest version of this file at:
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
local function format(str, ...)
local args = { ... }
local function repl(escape, open, num, close)
if escape == "" then
local replacement = tostring(args[tonumber(num)])
if open == "" then
replacement = replacement..close
end
return replacement
else
return "@"..open..num..close
end
end
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
end
local gettext, ngettext
if minetest.get_modpath("intllib") then
if intllib.make_gettext_pair then
-- New method using gettext.
gettext, ngettext = intllib.make_gettext_pair()
else
-- Old method using text files.
gettext = intllib.Getter()
end
end
-- Fill in missing functions.
gettext = gettext or function(msgid, ...)
return format(msgid, ...)
end
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
return format(n==1 and msgid or msgid_plural, ...)
end
return gettext, ngettext

1
mod.conf Normal file
View File

@ -0,0 +1 @@
name = dfcaverns

122
nether_cap.lua Normal file
View File

@ -0,0 +1,122 @@
-- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
--stem
minetest.register_node("dfcaverns:nether_cap_stem", {
description = S("Nether Cap Stem"),
tiles = {"dfcaverns_nether_cap_stem.png"},
is_ground_content = true,
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, puts_out_fire = 1, cools_lava = 1},
sounds = default.node_sound_wood_defaults(),
})
--cap
minetest.register_node("dfcaverns:nether_cap", {
description = S("Nether Cap"),
tiles = {"dfcaverns_nether_cap.png"},
is_ground_content = true,
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, puts_out_fire = 1, cools_lava = 1 },
sounds = default.node_sound_wood_defaults(),
})
--gills
minetest.register_node("dfcaverns:nether_cap_gills", {
description = S("Nether Cap Gills"),
tiles = {"dfcaverns_nether_cap_gills.png"},
is_ground_content = true,
groups = {snappy = 3, leafdecay = 3, leaves = 1, puts_out_fire = 1, cools_lava = 1},
sounds = default.node_sound_leaves_defaults(),
drawtype = "plantlike",
paramtype = "light",
drop = {
max_items = 1,
items = {
{
items = {'dfcaverns:nether_cap_sapling'},
rarity = 10,
},
{
items = {'dfcaverns:nether_cap_gills'},
}
}
},
})
-- sapling
minetest.register_node("dfcaverns:nether_cap_sapling", {
description = S("Nether Cap Spawn"),
drawtype = "plantlike",
visual_scale = 1.0,
tiles = {"dfcaverns_spore_tree_sapling.png"},
inventory_image = "dfcaverns_spore_tree_sapling.png",
wield_image = "dfcaverns_spore_tree_sapling.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
},
groups = {snappy = 2, dig_immediate = 3,
attached_node = 1, sapling = 1},
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
minetest.get_node_timer(pos):start(math.random(dfcaverns.config.nether_cap_min_growth_delay,dfcaverns.config.nether_cap_max_growth_delay))
end,
on_timer = function(pos)
minetest.set_node(pos, {name="air"})
dfcaverns.spawn_nether_cap(pos)
end,
})
dfcaverns.spawn_nether_cap = function(pos)
local x, y, z = pos.x, pos.y, pos.z
local stem_height = math.random(1,3)
local cap_radius = math.random(2,3)
local maxy = y + stem_height + 3
local c_stem = minetest.get_content_id("dfcaverns:nether_cap_stem")
local c_cap = minetest.get_content_id("dfcaverns:nether_cap")
local c_gills = minetest.get_content_id("dfcaverns:nether_cap_gills")
local vm = minetest.get_voxel_manip()
local minp, maxp = vm:read_from_map(
{x = x - cap_radius, y = y, z = z - cap_radius},
{x = x + cap_radius, y = maxy + 3, z = z + cap_radius}
)
local area = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
local data = vm:get_data()
subterrane:giant_shroom(area:indexp(pos), area, data, c_stem, c_cap, c_gills, stem_height, cap_radius)
vm:set_data(data)
vm:write_to_map()
vm:update_map()
end
minetest.register_abm{
label = "nether cap water freezing",
nodenames = {"default:water_source", "default:river_water_source",},
neighbors = {"dfcaverns:nether_cap_stem", "dfcaverns:nether_cap", "dfcaverns:nether_cap_gills"},
interval = 1,
chance = 5,
catch_up = true,
action = function(pos)
minetest.swap_node(pos, {name="default:ice"})
end,
}
minetest.register_abm{
label = "nether cap flowing water freezing",
nodenames = {"default:water_flowing", "default:river_water_flowing"},
neighbors = {"dfcaverns:nether_cap_stem", "dfcaverns:nether_cap", "dfcaverns:nether_cap_gills"},
interval = 1,
chance = 1,
catch_up = true,
action = function(pos)
minetest.swap_node(pos, {name="default:snow"})
end,
}

50
plants.lua Normal file
View File

@ -0,0 +1,50 @@
-- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
-----------------------------------------------------------------------
-- Plants
--------------------------------------------------
-- Cave wheat
-- stalks. White
farming.register_plant("dfcaverns:cave_wheat", {
description = "Cave wheat seed",
paramtype2 = "meshoptions",
inventory_image = "dfcaverns_cave_wheat_seed.png",
steps = 8,
minlight = 0,
maxlight = 8,
fertility = {"grassland", "desert"},
groups = {flammable = 4},
place_param2 = 3,
})
--------------------------------------------------
-- Dimple cup
-- royal blue
--------------------------------------------------
-- Pig tail
-- Twisting stalks. Gray
--------------------------------------------------
-- Plump helmet
-- Purple, rounded tops
--------------------------------------------------
-- Quarry Bush
-- Gray leaves
-- Produces rock nuts
--------------------------------------------------
-- Sweet Pod
-- Round shape, red

32
settingtypes.txt Normal file
View File

@ -0,0 +1,32 @@
dfcaverns_fungiwood_min_growth_delay (fungiwood minimum sapling growth delay) int 2400
dfcaverns_fungiwood_max_growth_delay (fungiwood maximum sapling growth delay) int 4800
dfcaverns_fungiwood_min_depth (fungiwood minimum sapling growth depth) int -100
dfcaverns_fungiwood_max_depth (fungiwood maximum sapling growth depth) int -31000
dfcaverns_tunnel_tube_min_growth_delay (tunnel_tube minimum sapling growth delay) int 2400
dfcaverns_tunnel_tube_max_growth_delay (tunnel_tube maximum sapling growth delay) int 4800
dfcaverns_tunnel_tube_min_depth (tunnel_tube minimum sapling growth depth) int -100
dfcaverns_tunnel_tube_max_depth (tunnel_tube maximum sapling growth depth) int -31000
dfcaverns_spore_tree_min_growth_delay (spore_tree minimum sapling growth delay) int 2400
dfcaverns_spore_tree_max_growth_delay (spore_tree maximum sapling growth delay) int 4800
dfcaverns_spore_tree_min_depth (spore_tree minimum sapling growth depth) int -100
dfcaverns_spore_tree_max_depth (spore_tree maximum sapling growth depth) int -31000
dfcaverns_black_cap_min_growth_delay (black_cap minimum sapling growth delay) int 2400
dfcaverns_black_cap_max_growth_delay (black_cap maximum sapling growth delay) int 4800
dfcaverns_black_cap_min_depth (black_cap minimum sapling growth depth) int -100
dfcaverns_black_cap_max_depth (black_cap maximum sapling growth depth) int -31000
dfcaverns_nether_cap_min_growth_delay (nether_cap minimum sapling growth delay) int 2400
dfcaverns_nether_cap_max_growth_delay (nether_cap maximum sapling growth delay) int 4800
dfcaverns_nether_cap_min_depth (nether_cap minimum sapling growth depth) int -100
dfcaverns_nether_cap_max_depth (nether_cap maximum sapling growth depth) int -31000
dfcaverns_goblin_cap_min_growth_delay (goblin_cap minimum sapling growth delay) int 2400
dfcaverns_goblin_cap_max_growth_delay (goblin_cap maximum sapling growth delay) int 4800
dfcaverns_goblin_cap_min_depth (goblin_cap minimum sapling growth depth) int -100
dfcaverns_goblin_cap_max_depth (goblin_cap maximum sapling growth depth) int -31000
dfcaverns_tower_cap_min_growth_delay (tower_cap minimum sapling growth delay) int 2400
dfcaverns_tower_cap_max_growth_delay (tower_cap maximum sapling growth delay) int 4800
dfcaverns_tower_cap_min_depth (tower_cap minimum sapling growth depth) int -100
dfcaverns_tower_cap_max_depth (tower_cap maximum sapling growth depth) int -31000
dfcaverns_blood_thorn_growth_interval (blood_thorn growth ABM interval) int 12
dfcaverns_blood_thorn_growth_chance (blood_thorn growth ABM interval) int 83
dfcaverns_blood_thorn_min_depth (blood_thorn minimum sapling growth depth) int -100
dfcaverns_blood_thorn_max_depth (blood_thorn maximum sapling growth depth) int -31000

166
spore_tree.lua Normal file
View File

@ -0,0 +1,166 @@
--------------------------------------------------
-- Spore Tree
-- Teal
-- raining spores
-- Max trunk height 5
-- depth 2-3
-- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
minetest.register_node("dfcaverns:spore_tree", {
description = S("Spore Tree"),
tiles = {"dfcaverns_spore_tree_top.png", "dfcaverns_spore_tree_top.png", "dfcaverns_spore_tree.png"},
paramtype2 = "facedir",
is_ground_content = false,
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node,
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
minetest.set_node(pos, {name="air"})
minetest.spawn_tree(pos, dfcaverns.spore_tree_model)
end,
})
minetest.register_node("dfcaverns:spore_tree_frond", {
description = S("Spore Tree Frond"),
waving = 1,
tiles = {"dfcaverns_spore_tree.png"},
is_ground_content = false,
groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
walkable = false,
climbable = true,
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.0625, -0.5, -0.0625, 0.0625, 0.5, 0.0625},
{-0.0625, -0.0625, -0.5, 0.0625, 0.0625, 0.5},
{-0.5, -0.0625, -0.0625, 0.5, 0.0625, 0.0625},
}
},
sounds = default.node_sound_leaves_defaults(),
after_place_node = default.after_place_leaves,
})
minetest.register_node("dfcaverns:spore_tree_pod", {
description = S("Spore Tree Fruiting Body"),
waving = 1,
tiles = {"dfcaverns_spore_tree.png"},
is_ground_content = false,
groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
walkable = false,
climbable = true,
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.0625, -0.5, -0.0625, 0.0625, 0.5, 0.0625},
{-0.0625, -0.0625, -0.5, 0.0625, 0.0625, 0.5},
{-0.5, -0.0625, -0.0625, 0.5, 0.0625, 0.0625},
{-0.25, -0.25, -0.25, 0.25, 0.25, 0.25},
}
},
drop = {
max_items = 1,
items = {
{
items = {'dfcaverns:spore_tree_sapling'},
rarity = 10,
},
{
items = {'dfcaverns:spore_tree_frond'},
}
}
},
sounds = default.node_sound_leaves_defaults(),
after_place_node = default.after_place_leaves,
})
minetest.register_node("dfcaverns:spore_tree_sapling", {
description = S("Spore Tree Spawn"),
drawtype = "plantlike",
visual_scale = 1.0,
tiles = {"dfcaverns_spore_tree_sapling.png"},
inventory_image = "dfcaverns_spore_tree_sapling.png",
wield_image = "dfcaverns_spore_tree_sapling.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
},
groups = {snappy = 2, dig_immediate = 3, flammable = 2,
attached_node = 1, sapling = 1},
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
minetest.get_node_timer(pos):start(math.random(dfcaverns.config.spore_tree_min_growth_delay,dfcaverns.config.spore_tree_max_growth_delay))
end,
on_timer = function(pos)
minetest.set_node(pos, {name="air"})
minetest.spawn_tree(pos, dfcaverns.spore_tree_def)
end,
})
dfcaverns.spore_tree_def={
axiom="TTdddA",
rules_a="[&&&Tdd&&FF][&&&++++Tdd&&FF][&&&----Tdd&&FF]",
rules_d="T",
trunk="dfcaverns:spore_tree",
leaves="dfcaverns:spore_tree_frond",
leaves2="dfcaverns:spore_tree_pod",
leaves2_chance=30,
angle=30,
iterations=2,
random_level=0,
trunk_type="single",
thin_branches=true,
}
dfcaverns.spawn_spore_tree = function(pos)
minetest.spawn_tree(pos, dfcaverns.spore_tree_def)
end
minetest.register_abm{
label = "spore tree raining spores",
nodenames = {"dfcaverns:spore_tree_pod"},
interval = 1,
chance = 30,
catch_up = false,
action = function(pos)
minetest.add_particlespawner({
amount = 1,
time = 1,
minpos = pos,
maxpos = pos,
minvel = {x=-0.1, y=-1, z=-0.1},
maxvel = {x=0.1, y=-1, z=0.1},
minacc = {x=0, y=0, z=0},
maxacc = {x=0, y=0, z=0},
minexptime = 3,
maxexptime = 3,
minsize = 10,
maxsize = 10,
collisiondetection = false,
vertical = false,
texture = "farming_wheat_seed.png",
})
end,
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 507 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 985 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 392 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 441 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 888 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 542 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 389 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 836 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 402 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 883 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 691 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 793 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 560 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 458 B

BIN
textures/farming_cotton.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

9
textures/license.txt Normal file
View File

@ -0,0 +1,9 @@
dftrees_blood_thorn - derived from default cactus
dftrees_black_cap - derived from default coal block
dftrees_goblin_cap - derived from default red coral
dftrees_cave_moss and floor_fungus - derived from caverealms algae
dftrees_spore_tree - derived from default aspen bark
dftrees_tower_cap - derived from default dead coral
dftrees_tower_cap_gills - from caverealms mushroom gills
dftrees_cave_wheat - derived from farming wheat
dftrees_tunnel_tube - derived from moretrees palm tree bark

98
tower_cap.lua Normal file
View File

@ -0,0 +1,98 @@
-- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
--stem
minetest.register_node("dfcaverns:tower_cap_stem", {
description = S("Tower Cap Stem"),
tiles = {"dfcaverns_tower_cap.png"},
is_ground_content = true,
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
sounds = default.node_sound_wood_defaults(),
})
--cap
minetest.register_node("dfcaverns:tower_cap", {
description = S("Tower Cap"),
tiles = {"dfcaverns_tower_cap.png"},
is_ground_content = true,
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
sounds = default.node_sound_wood_defaults(),
})
--gills
minetest.register_node("dfcaverns:tower_cap_gills", {
description = S("Tower Cap Gills"),
tiles = {"dfcaverns_tower_cap_gills.png"},
is_ground_content = true,
groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
sounds = default.node_sound_leaves_defaults(),
drawtype = "plantlike",
paramtype = "light",
drop = {
max_items = 1,
items = {
{
items = {'dfcaverns:tower_cap_sapling'},
rarity = 20,
},
{
items = {'dfcaverns:tower_cap_gills'},
}
}
},
})
-- sapling
minetest.register_node("dfcaverns:tower_cap_sapling", {
description = S("Tower Cap Spawn"),
drawtype = "plantlike",
visual_scale = 1.0,
tiles = {"dfcaverns_spore_tree_sapling.png"},
inventory_image = "dfcaverns_spore_tree_sapling.png",
wield_image = "dfcaverns_spore_tree_sapling.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
},
groups = {snappy = 2, dig_immediate = 3, flammable = 2,
attached_node = 1, sapling = 1},
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
minetest.get_node_timer(pos):start(math.random(dfcaverns.config.tower_cap_min_growth_delay,dfcaverns.config.tower_cap_max_growth_delay))
end,
on_timer = function(pos)
minetest.set_node(pos, {name="air"})
dfcaverns.spawn_tower_cap(pos)
end,
})
dfcaverns.spawn_tower_cap = function(pos)
local x, y, z = pos.x, pos.y, pos.z
local stem_height = math.random(4,10)
local cap_radius = math.random(4,6)
local maxy = y + stem_height + 3
local c_stem = minetest.get_content_id("dfcaverns:tower_cap_stem")
local c_cap = minetest.get_content_id("dfcaverns:tower_cap")
local c_gills = minetest.get_content_id("dfcaverns:tower_cap_gills")
local vm = minetest.get_voxel_manip()
local minp, maxp = vm:read_from_map(
{x = x - cap_radius, y = y, z = z - cap_radius},
{x = x + cap_radius, y = maxy + 3, z = z + cap_radius}
)
local area = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
local data = vm:get_data()
subterrane:giant_shroom(area:indexp(pos), area, data, c_stem, c_cap, c_gills, stem_height, cap_radius)
vm:set_data(data)
vm:write_to_map()
vm:update_map()
end

105
tunnel_tube.lua Normal file
View File

@ -0,0 +1,105 @@
--------------------------------------------------
-- Tunnel tube
-- Magenta
-- curving trunk
-- Max trunk height 8
-- depth 2-3
-- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
minetest.register_node("dfcaverns:tunnel_tube", {
description = S("Tunnel Tube"),
tiles = {"dfcaverns_tunnel_tube.png"},
paramtype2 = "facedir",
drawtype = "nodebox",
paramtype = "light",
groups = {choppy = 3, oddly_breakable_by_hand=1, flammable = 2},
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node,
node_box = {
type = "fixed",
fixed = {
{-8/16,-8/16,-8/16,-4/16,8/16,8/16},
{4/16,-8/16,-8/16,8/16,8/16,8/16},
{-4/16,-8/16,-8/16,4/16,8/16,-4/16},
{-4/16,-8/16,8/16,4/16,8/16,4/16},
},
},
})
minetest.register_node("dfcaverns:tunnel_tube_nodule", {
description = S("Tunnel Tube Fruiting Body"),
tiles = {"dfcaverns_tunnel_tube.png^[brighten"},
paramtype2 = "facedir",
groups = {choppy = 3, oddly_breakable_by_hand=1, flammable = 2},
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node,
drop = {
max_items = 3,
items = {
{
items = {'dfcaverns:tunnel_tube_sapling'},
rarity = 2,
},
{
items = {'dfcaverns:tunnel_tube_sapling'},
rarity = 2,
},
{
items = {'dfcaverns:tunnel_tube_sapling'},
rarity = 2,
},
}
},
})
dfcaverns.tunnel_tube_def = {
axiom="FFcccccc&FFFFFdddR",
rules_c="/",
rules_d="F",
trunk="dfcaverns:tunnel_tube",
angle=20,
iterations=2,
random_level=0,
trunk_type="single",
thin_branches=true,
fruit="dfcaverns:tunnel_tube_nodule",
fruit_chance=0
}
minetest.register_node("dfcaverns:tunnel_tube_sapling", {
description = S("Tunnel Tube Spawn"),
drawtype = "plantlike",
visual_scale = 1.0,
tiles = {"dfcaverns_tunnel_tube_sapling.png"},
inventory_image = "dfcaverns_tunnel_tube_sapling.png",
wield_image = "dfcaverns_tunnel_tube_sapling.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
},
groups = {snappy = 2, dig_immediate = 3, flammable = 2,
attached_node = 1, sapling = 1},
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
minetest.get_node_timer(pos):start(math.random(dfcaverns.config.tunnel_tube_min_growth_delay,dfcaverns.config.tunnel_tube_max_growth_delay))
end,
on_timer = function(pos)
minetest.set_node(pos, {name="air"})
minetest.spawn_tree(pos, dfcaverns.tunnel_tube_def)
end,
})
dfcaverns.spawn_tunnel_tube = function(pos)
minetest.spawn_tree(pos, dfcaverns.tunnel_tube_def)
end