Modpack refactor (#4)

Split this mod into a set of sub-mods in a modpack, and in the process did a whole bunch of renovations.

* updated Subterrane's API to allow for more patterned placement of things
* added "warrens"
* clean separation of flooded and non-flooded caverns
* rearranged biomes to make cavern layers more distinct
* added oil layer
* added underworld layer
This commit is contained in:
FaceDeer 2018-12-31 11:46:27 -07:00 committed by GitHub
parent 24c955dbd4
commit 882395ef75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
355 changed files with 9514 additions and 5396 deletions

8
.gitmodules vendored Normal file
View File

@ -0,0 +1,8 @@
[submodule "mapgen_helper"]
path = mapgen_helper
url = https://github.com/minetest-mods/mapgen_helper
branch = master
[submodule "subterrane"]
path = subterrane
url = https://github.com/minetest-mods/subterrane
branch = master

View File

@ -1,11 +1,11 @@
Dwarf Fortress is copyright 2017 by Tarn Adams. This mod uses no assets from Dwarf Fortress.
Dwarf Fortress is copyright 2018 by Tarn Adams. This mod uses no assets or other copyrighted materials from Dwarf Fortress.
Sounds and textures are under various licenses, see the license.txt file in the /sounds and /textures directories for details.
License for Code
----------------
Copyright (C) 2017 FaceDeer
Copyright (C) 2018 FaceDeer
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -4,30 +4,36 @@ Inspired by the world of Dwarf Fortress, this mod adds a series of vast cavern l
The underworld is divided into a number of cavern "layers" with a variety of biomes and other features distributed throughout. As one goes deeper one will find increasingly bizzare flora and exotic environments that provide new challenges and opportunities for players.
The uppermost layer has "flooded" and "dry" caverns, as well as caverns containing the massive tree-like fungal growths of Fungiwood and Tower-Cap mushrooms. These provide a source of underground wood. Also found in this region are plump helmets (an edible farmable mushroom), pig tails (a fibrous fungus that can be grown and harvested for thread), and cave wheat (a pale grass-like growth whose seeds can be ground for flour).
The uppermost layer is home to relatively conventional tree-like fungal growths of Fungiwood and Tower-Cap mushrooms. These provide a source of underground wood. Also found in this region are plump helmets (an edible farmable mushroom), and cave wheat (a pale grass-like growth whose seeds can be ground for flour).
Fungiwood and Tower Caps can still be found the next layer down, though in smaller ranges as they are crowded by several new types of giant fungi. Here you can find Goblin Cap mushrooms, the squatter cousins of the Tower Caps. Spore Trees sprout in the warmer and wetter corners of the caverns, raising a climbable three-dimensional mesh or hyphyae above the ground that emits a gentle rain of spore powder. Tunnel Tubes grow in the hottest regions - tall, curved stalks with fruiting bodies at the tips that burst violently when ripe. And in the dryest regions are the pitch-black caverns of the Black Cap forests, rich with carbonaceous deposits that have accumulated over millions of years. Smaller plants that can be found here include quarry bushes (farmable for their spicy leaves) and dimple cups (whose eponymous parts can be ground to produce a brilliant blue dye).
The next layer down has more exotic growths. Here you can find Goblin Cap mushrooms, the squatter cousins of the Tower Caps. Spore Trees sprout in the warmer and wetter corners of the caverns, raising a climbable three-dimensional mesh or hyphyae above the ground that emits a gentle rain of spore powder. Tunnel Tubes grow in the hottest regions - tall, curved stalks with fruiting bodies at the tips that burst violently when ripe. Smaller growths found here include plump helmets, cave wheat, pig tails (a fibrous fungus that can be grown and harvested for thread) and sweet pods (whose fruiting bodies can be milled for sugar or processed into syrup).
The third cavern layer no longer supports Fungiwood or Tower Caps, with strange new growths crowding them out. The frigid Nethercap caverns can be found here, the blue-tinted mushrooms leaching heat out of their environment in ways that shouldn't be thermodynamically possible. In the hotter areas the vicious Bloodthorn grows, with wicked spines that suck moisture from anything they can pierce. In caves too dry to support biological life enormous glowing crystals grow instead. Sweet pods can be found down here, a fungus whose fruiting bodies are rich in sugary substances.
In the third cavern layer yet stranger forms of life flourish in the hostile conditions. The coal-black caverns of the Black Cap forests, rich with carbonaceous deposits that have accumulated over millions of years and lit by smouldering Torchspines, are found here. The frigid Nethercaps, blue-tinted mushrooms leaching heat out of their environment in ways that shouldn't be thermodynamically possible, fill their caverns with ice and snow. In the hotter areas the vicious Bloodthorn grows, with wicked spines that suck moisture from anything they can pierce. In caves too dry to support biological life enormous glowing crystals grow instead. Smaller plants that can be found here include quarry bushes (farmable for their spicy leaves) and dimple cups (whose eponymous parts can be ground to produce a brilliant blue dye).
The third layer stops on the shores of the Sunless Sea, the ultimate destination of all water that flows downward through the twisty caves of Minetest. The caverns of the Sunless Sea are vast in extent but are flooded with water, and below the surface grows treacherous Snareweed and the rare hanging forests of softly-glowing Cave Coral.
The third layer stops on the shores of the Sunless Sea, the ultimate destination of all water that flows downward through the twisty caves of Minetest. Familiar growths crowd its fertile shores, with Tower Cap, Goblin Cap, Fungiwood and Spore Trees able to take root in this relatively hospitable zone. The caverns of the Sunless Sea are vast in extent but are mostly flooded with water, and below the surface grows treacherous Snareweed and underwater citadels of softly-glowing Cave Coral. Twisting rivers connect the various caverns of the Sunless Sea.
Below the Sunless Sea is a sea of a more dangerous sort: the Magma Ocean. These caverns are filled with dangerous molten rock, though there are riches to be had as well; mineral growths fed by the heat and pressure.
Below the Sunless Sea are seas of a more dangerous sort: lakes of oil and the magma ocean. These caverns are filled with dangerous substances, though there are riches to be had as well; mineral growths fed by the heat and pressure and bountiful fuel sources.
By default, caverns belonging to the first cavern layer can be found between -300 and -900, the second cavern layer between -900 and -1500, and the third cavern layer between -1500 and -2100. The surface level of the Sunless Sea is at -2300 and the magma sea's surface is at -3150.
At the very foundation of the world lies an ancient impenetrable realm. There are signs that life once existed here but it is now long gone. Its dead hollows rest on a layer of Slade, a dense material impervious to conventional mining efforts.
## Other features
The giant caverns generated by this mod differ slightly from the default giant caverns found in some mapgens, they use an additional source of noise to generate more ledges and horizontal floors. They also contain stalactites and stalagmites of various sizes - from single-node spikes decorating the default twisty tunnels to mountainous behemoths in the main caverns that can reach tens of meters in diameter and hundreds of meters in height.
The trees and plants mentioned above are all farmable, but in contrast to the usual farmable plants and trees they only grow in the *absence* of bright light; attempting to plant them in sunlight will kill them. A set of recipes is added for cooking the edible ones into a variety of biscuits, stews, and roasts, and sweet pods can be refined into syrup.
The trees and plants mentioned above are all farmable, but in contrast to the usual farmable plants and trees they only grow in the *absence* of bright light. Attempting to plant them in sunlight will kill them. A set of recipes is added for cooking the edible ones into a variety of biscuits, stews, and roasts, and sweet pods can be refined into syrup.
Some of the other cave decorations provide dim bioluminescent lighting in some caverns. Cave moss and hanging glow-worms are most common. There is also non-glowing floor fungus found coating the stone in less hospitable biomes, capable of spreading to adjacent cobblestone structures like a slow-creeping infection.
## Dependencies and synergies with other mods
[A more comprehensive guide can be found here.](guide.md)
This mod depends on the utility mod "subterrane", which was derived from Caverealms code which in turn was derived from Paramat's subterrain.
## Synergies with other mods
"dynamic liquid" is also recommended to provide Dwarf Fortress-like fluid dynamics. "magma conduits" is recommended for a Dwarf Fortress like magmatic landscape.
"[dynamic liquid](https://github.com/minetest-mods/dynamic_liquid)" is recommended to provide Dwarf Fortress-like fluid dynamics and to deal with water that might spill into caverns.
The "doc" mod is supported to provide in-game documentation for all of the new items and nodes this mod adds.
"[magma conduits](https://github.com/FaceDeer/magma_conduits/)" is recommended for a Dwarf Fortress like magmatic landscape. If not magma conduits, it is at least recommended that mapgen magma be disabled on whatever mapgen you're adding this mod to; mapgen magma is difficult for lua mapgens like this to tidy up and it will often spill into caverns setting large swaths of fungal forests on fire.
The "[doc](https://forum.minetest.net/viewtopic.php?f=9&t=15912&p=240152)" mod is supported to provide in-game documentation for all of the new items and nodes this mod adds.
"[ropes](https://github.com/minetest-mods/ropes)" are very useful for navigating some of the large open spaces this mod provides.
"[radiant damage](https://github.com/FaceDeer/radiant_damage)" greatly increases the danger of the Magma Sea if heat radiance is enabled, as well as several of the rare crystals in the deeper layers that emit Mese radiation if that damage type is enabled.

View File

@ -1,222 +0,0 @@
local c_water = minetest.get_content_id("default:water_source")
local c_air = minetest.get_content_id("air")
local c_stone = minetest.get_content_id("default:stone")
local c_sand = minetest.get_content_id("default:sand")
local c_dirt = minetest.get_content_id("default:dirt")
local c_coal_ore = minetest.get_content_id("default:stone_with_coal")
local c_gravel = minetest.get_content_id("default:gravel")
local c_obsidian = minetest.get_content_id("default:obsidian")
local c_sweet_pod = minetest.get_content_id("dfcaverns:sweet_pod_6") -- param2 = 0
local c_quarry_bush = minetest.get_content_id("dfcaverns:quarry_bush_5") -- param2 = 4
local c_plump_helmet = minetest.get_content_id("dfcaverns:plump_helmet_4") -- param2 = 0-3
local c_pig_tail = minetest.get_content_id("dfcaverns:pig_tail_8") -- param2 = 3
local c_dimple_cup = minetest.get_content_id("dfcaverns:dimple_cup_4") -- param2 = 0
local c_cave_wheat = minetest.get_content_id("dfcaverns:cave_wheat_8") -- param2 = 3
local c_dead_fungus = minetest.get_content_id("dfcaverns:dead_fungus") -- param2 = 0
local c_cavern_fungi = minetest.get_content_id("dfcaverns:cavern_fungi") -- param2 = 0
local c_dirt_moss = minetest.get_content_id("dfcaverns:dirt_with_cave_moss")
local c_cobble_fungus = minetest.get_content_id("dfcaverns:cobble_with_floor_fungus")
local c_wet_flowstone = minetest.get_content_id("dfcaverns:wet_flowstone")
local shallow_cave_floor = function(area, data, ai, vi, bi, param2_data)
if data[bi] ~= c_stone then
return
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if drip_rand < 0.025 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.025 * 4)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, height, dfcaverns.dry_stalagmite_ids)
end
end
local shallow_cave_ceiling = function(area, data, ai, vi, bi, param2_data)
if data[ai] ~= c_stone then
return
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if drip_rand < 0.025 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.025 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, -height, dfcaverns.dry_stalagmite_ids)
end
end
local perlin_cave = {
offset = 0,
scale = 1,
spread = {x=dfcaverns.config.horizontal_cavern_scale, y=dfcaverns.config.vertical_cavern_scale, z=dfcaverns.config.horizontal_cavern_scale},
seed = -400000000089,
octaves = 3,
persist = 0.67
}
local perlin_wave = {
offset = 0,
scale = 1,
spread = {x=dfcaverns.config.horizontal_cavern_scale * 2, y=dfcaverns.config.vertical_cavern_scale, z=dfcaverns.config.horizontal_cavern_scale * 2}, -- squashed 2:1
seed = 59033,
octaves = 6,
persist = 0.63
}
-- default mapgen registers an "underground" biome that gets in the way of everything.
subterrane:override_biome({
name = "underground",
y_min = dfcaverns.config.ymax,
y_max = -113,
heat_point = 50,
humidity_point = 50,
_subterrane_cave_floor_decor = shallow_cave_floor,
_subterrane_cave_ceiling_decor = shallow_cave_ceiling,
})
subterrane:register_cave_decor(-113, dfcaverns.config.ymax)
if dfcaverns.config.stone_between_layers then
subterrane:register_cave_layer({
minimum_depth = dfcaverns.config.ymax,
maximum_depth = dfcaverns.config.level1_min,
cave_threshold = dfcaverns.config.cavern_threshold,
perlin_cave = perlin_cave,
perlin_wave = perlin_wave,
columns = {
maximum_radius = 10,
minimum_radius = 4,
node = c_wet_flowstone,
weight = 0.25,
maximum_count = 20,
minimum_count = 0,
},
})
subterrane:register_cave_layer({
minimum_depth = dfcaverns.config.level1_min,
maximum_depth = dfcaverns.config.level2_min,
cave_threshold = dfcaverns.config.cavern_threshold,
perlin_cave = perlin_cave,
perlin_wave = perlin_wave,
columns = {
maximum_radius = 15,
minimum_radius = 4,
node = c_wet_flowstone,
weight = 0.25,
maximum_count = 30,
minimum_count = 5,
},
})
subterrane:register_cave_layer({
minimum_depth = dfcaverns.config.level2_min,
maximum_depth = dfcaverns.config.level3_min,
cave_threshold = dfcaverns.config.cavern_threshold,
perlin_cave = perlin_cave,
perlin_wave = perlin_wave,
columns = {
maximum_radius = 20,
minimum_radius = 5,
node = c_wet_flowstone,
weight = 0.25,
maximum_count = 50,
minimum_count = 10,
},
})
else
subterrane:register_cave_layer({
minimum_depth = dfcaverns.config.ymax,
maximum_depth = dfcaverns.config.level3_min,
cave_threshold = dfcaverns.config.cavern_threshold,
perlin_cave = perlin_cave,
perlin_wave = perlin_wave,
columns = {
maximum_radius = 20,
minimum_radius = 4,
node = c_wet_flowstone,
weight = 0.25,
maximum_count = 50,
minimum_count = 0,
},
})
end
local perlin_cave_lava = {
offset = 0,
scale = 1,
spread = {x=dfcaverns.config.horizontal_cavern_scale * 2, y=dfcaverns.config.vertical_cavern_scale * 0.5, z=dfcaverns.config.horizontal_cavern_scale * 2},
seed = -400000000089,
octaves = 3,
persist = 0.67
}
local perlin_wave_lava = {
offset = 0,
scale = 1,
spread = {x=dfcaverns.config.horizontal_cavern_scale * 4, y=dfcaverns.config.vertical_cavern_scale * 0.5, z=dfcaverns.config.horizontal_cavern_scale * 4}, -- squashed 2:1
seed = 59033,
octaves = 6,
persist = 0.63
}
--Sunless Sea
subterrane:register_cave_layer({
minimum_depth = dfcaverns.config.level3_min,
maximum_depth = dfcaverns.config.sunless_sea_min,
cave_threshold = dfcaverns.config.lava_sea_threshold,
perlin_cave = perlin_cave_lava,
perlin_wave = perlin_wave_lava,
columns = {
maximum_radius = 25,
minimum_radius = 5,
node = c_stone,
weight = 0.25,
maximum_count = 100,
minimum_count = 25,
},
})
if dfcaverns.config.enable_lava_sea then
subterrane:register_cave_layer({
minimum_depth = dfcaverns.config.lava_sea_max,
maximum_depth = dfcaverns.config.lava_sea_min,
cave_threshold = dfcaverns.config.lava_sea_threshold,
perlin_cave = perlin_cave_lava,
perlin_wave = perlin_wave_lava,
columns = {
maximum_radius = 30,
minimum_radius = 5,
node = c_obsidian,
weight = 0.5,
maximum_count = 100,
minimum_count = 25,
},
})
end
dfcaverns.can_support_vegetation = {[c_sand] = true, [c_dirt] = true, [c_coal_ore] = true, [c_gravel] = true}
dfcaverns.place_shrub = function(data, vi, param2_data, shrub_list)
local shrub = shrub_list[math.random(#shrub_list)]
if shrub == c_quarry_bush then
data[vi] = c_quarry_bush
param2_data[vi] = 4
elseif shrub == c_plump_helmet then
data[vi] = c_plump_helmet
param2_data[vi] = math.random(0,3)
elseif shrub == c_pig_tail then
data[vi] = c_pig_tail
param2_data[vi] = 3
elseif shrub == c_cave_wheat then
data[vi] = c_cave_wheat
param2_data[vi] = 3
else
data[vi] = shrub
param2_data[vi] = 0
end
end

View File

@ -1,132 +0,0 @@
local c_water = minetest.get_content_id("default:water_source")
local c_air = minetest.get_content_id("air")
local c_stone = minetest.get_content_id("default:stone")
local c_cobble = minetest.get_content_id("default:cobble")
local c_dirt = minetest.get_content_id("default:dirt")
local c_sand = minetest.get_content_id("default:sand")
local c_lava = minetest.get_content_id("default:lava_source")
local c_meseore = minetest.get_content_id("default:stone_with_mese")
local c_mesecry = minetest.get_content_id("dfcaverns:glow_mese")
-------------------------------------------------------------------------------------------
local mese_crystal_ceiling = function(area, data, ai, vi, bi)
if math.random() < 0.025 then
if math.random() < 0.25 then
subterrane:giant_stalactite(ai, area, data, 6, 13, c_meseore, c_meseore, c_mesecry)
else
data[vi] = c_meseore
if math.random() < 0.25 then
data[bi] = c_mesecry
end
end
end
end
local mese_ore_ceiling = function(area, data, ai, vi, bi)
if math.random() < 0.025 then
data[vi] = c_meseore
if math.random() < 0.25 then
data[bi] = c_mesecry
end
end
end
local mese_ore_floor = function(area, data, ai, vi, bi)
if math.random() < 0.01 then
data[vi] = c_meseore
if math.random() < 0.25 then
data[ai] = c_mesecry
end
end
end
local lava_sea_crystal_biome_def = {
name = "dfcaverns_lava_sea_with_mese_crystal",
y_min = dfcaverns.config.lava_sea_min,
y_max = dfcaverns.config.lava_sea_max,
heat_point = 60,
humidity_point = 30,
_subterrane_ceiling_decor = mese_crystal_ceiling,
_subterrane_floor_decor = mese_ore_floor,
}
local lava_sea_mese_biome_def = {
name = "dfcaverns_lava_sea_with_mese",
y_min = dfcaverns.config.lava_sea_min,
y_max = dfcaverns.config.lava_sea_max,
heat_point = 50,
humidity_point = 40,
_subterrane_ceiling_decor = mese_ore_ceiling,
}
local lava_sea_barren_biome_def = {
name = "dfcaverns_lava_sea",
y_min = dfcaverns.config.lava_sea_min,
y_max = dfcaverns.config.lava_sea_max,
heat_point = 30,
humidity_point = 50,
}
minetest.register_biome(lava_sea_crystal_biome_def)
minetest.register_biome(lava_sea_mese_biome_def)
minetest.register_biome(lava_sea_barren_biome_def)
local airspace = (dfcaverns.config.lava_sea_max - dfcaverns.config.lava_sea_min) / 2.75
local lava_sea_level = dfcaverns.config.lava_sea_max - airspace
local data = {}
local lavasurface_buffer = {}
local lavasurface_noise
local lavasurface_noise_params = {
offset = 0,
scale = 2,
spread = {x=20, y=20, z=20},
seed = 5033,
octaves = 3,
persist = 0.6
}
minetest.register_on_generated(function(minp, maxp, seed)
--if out of range of cave definition limits, abort
if minp.y > lava_sea_level or maxp.y < dfcaverns.config.lava_sea_min then
return
end
if not lavasurface_noise then
local sidelen = maxp.x - minp.x + 1 --length of a mapblock
local chunk_lengths = {x = sidelen, y = sidelen, z = sidelen} --table of chunk edges
lavasurface_noise = minetest.get_perlin_map(lavasurface_noise_params, chunk_lengths)
end
local nvals_lavasurface = lavasurface_noise:get2dMap({x=minp.x, y=minp.z}, lavasurface_buffer)
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
vm:get_data(data)
local minx = minp.x-1
local minz = minp.z-1
for vi, x, y, z in area:iterp_xyz(minp, maxp) do
local lavaheight = nvals_lavasurface[x-minx][z-minz]
if y < lava_sea_level + lavaheight then
if data[vi] == c_air or data[vi] == c_water then
data[vi] = c_lava
end
end
end
--send data back to voxelmanip
vm:set_data(data)
--calc lighting
vm:set_lighting({day = 0, night = 0})
vm:calc_lighting()
vm:update_liquids()
--write it to world
vm:write_to_map()
end)

View File

@ -1,382 +0,0 @@
local c_water = minetest.get_content_id("default:water_source")
local c_air = minetest.get_content_id("air")
local c_stone = minetest.get_content_id("default:stone")
local c_cobble = minetest.get_content_id("default:cobble")
local c_mossycobble = minetest.get_content_id("default:mossycobble")
local c_dirt = minetest.get_content_id("default:dirt")
local c_dirt_moss = minetest.get_content_id("dfcaverns:dirt_with_cave_moss")
local c_cobble_fungus = minetest.get_content_id("dfcaverns:cobble_with_floor_fungus")
local c_wet_flowstone = minetest.get_content_id("dfcaverns:wet_flowstone")
local c_dry_flowstone = minetest.get_content_id("dfcaverns:dry_flowstone")
local c_sweet_pod = minetest.get_content_id("dfcaverns:sweet_pod_6") -- param2 = 0
local c_quarry_bush = minetest.get_content_id("dfcaverns:quarry_bush_5") -- param2 = 4
local c_plump_helmet = minetest.get_content_id("dfcaverns:plump_helmet_4") -- param2 = 0-3
local c_pig_tail = minetest.get_content_id("dfcaverns:pig_tail_8") -- param2 = 3
local c_dimple_cup = minetest.get_content_id("dfcaverns:dimple_cup_4") -- param2 = 0
local c_cave_wheat = minetest.get_content_id("dfcaverns:cave_wheat_8") -- param2 = 3
local c_dead_fungus = minetest.get_content_id("dfcaverns:dead_fungus") -- param2 = 0
local c_cavern_fungi = minetest.get_content_id("dfcaverns:cavern_fungi") -- param2 = 0
local subsea_level = (dfcaverns.config.ymax - dfcaverns.config.level1_min) * 0.3 + dfcaverns.config.level1_min
local flooded_biomes = dfcaverns.config.flooded_biomes
local level_1_tower_cap_floor = function(area, data, ai, vi, bi, param2_data)
if data[bi] ~= c_stone then
return
end
if math.random() < 0.25 then
data[bi] = c_dirt
else
data[bi] = c_dirt_moss
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if math.random() < 0.1 then
dfcaverns.place_shrub(data, vi, param2_data, {c_plump_helmet, c_plump_helmet, c_pig_tail, c_dead_fungus, c_cavern_fungi})
elseif drip_rand < 0.0025 then
elseif drip_rand < 0.1 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.1 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, height, dfcaverns.wet_stalagmite_ids)
elseif math.random() < 0.005 then
dfcaverns.spawn_tower_cap_vm(vi, area, data)
end
end
local level_1_fungiwood_floor = function(area, data, ai, vi, bi, param2_data)
if data[bi] ~= c_stone then
return
end
if math.random() < 0.25 then
data[bi] = c_dirt
else
data[bi] = c_dirt_moss
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if math.random() < 0.1 then
dfcaverns.place_shrub(data, vi, param2_data, {c_plump_helmet, c_pig_tail, c_cave_wheat, c_cave_wheat, c_dead_fungus, c_cavern_fungi})
elseif drip_rand < 0.001 then
subterrane:giant_stalagmite(bi, area, data, 6, 15, c_wet_flowstone, c_wet_flowstone, c_wet_flowstone)
elseif drip_rand < 0.1 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.1 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, height, dfcaverns.wet_stalagmite_ids)
elseif math.random() < 0.005 then
dfcaverns.spawn_fungiwood_vm(vi, area, data)
end
end
local level_1_moist_ceiling = function(area, data, ai, vi, bi, param2_data)
if data[ai] ~= c_stone then
return
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if drip_rand < 0.0025 then
subterrane:giant_stalactite(ai, area, data, 6, 15, c_wet_flowstone, c_wet_flowstone, c_wet_flowstone)
elseif drip_rand < 0.075 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.075 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, -height, dfcaverns.wet_stalagmite_ids)
elseif math.random() < 0.03 then
dfcaverns.glow_worm_ceiling(area, data, ai, vi, bi)
end
end
local level_1_wet_floor = function(area, data, ai, vi, bi, param2_data)
if data[bi] ~= c_stone then
return
end
if math.random() < 0.5 then
data[bi] = c_mossycobble
if math.random() < 0.05 then
data[vi] = c_dead_fungus
elseif math.random() < 0.05 then
data[vi] = c_cavern_fungi
end
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if drip_rand < 0.001 then
subterrane:giant_stalagmite(bi, area, data, 6, 15, c_wet_flowstone, c_wet_flowstone, c_wet_flowstone)
elseif drip_rand < 0.025 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.025 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, height, dfcaverns.wet_stalagmite_ids)
end
end
local level_1_dry_floor = function(area, data, ai, vi, bi, param2_data)
if data[bi] ~= c_stone then
return
end
if math.random() < 0.25 then
data[bi] = c_cobble_fungus
if math.random() < 0.1 then
data[vi] = c_dead_fungus
end
elseif math.random() < 0.5 then
data[bi] = c_cobble
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if drip_rand < 0.001 then
subterrane:giant_stalagmite(bi, area, data, 6, 15, c_dry_flowstone, c_dry_flowstone, c_dry_flowstone)
elseif drip_rand < 0.05 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.05 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, height, dfcaverns.dry_stalagmite_ids)
end
end
local level_1_dry_ceiling = function(area, data, ai, vi, bi, param2_data)
if data[ai] ~= c_stone then
return
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if drip_rand < 0.001 then
subterrane:giant_stalactite(ai, area, data, 6, 15, c_dry_flowstone, c_dry_flowstone, c_dry_flowstone)
elseif drip_rand < 0.075 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.075 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, -height, dfcaverns.dry_stalagmite_ids)
end
end
local level_1_underwater_floor = function(area, data, ai, vi, bi, param2_data)
if data[bi] ~= c_stone then
return
end
if math.random() < 0.25 then
data[bi] = c_mossycobble
else
data[bi] = c_dirt
end
if flooded_biomes then
if data[vi] == c_air then
data[vi] = c_water
end
if data[ai] == c_air then
data[ai] = c_water
end
elseif math.random() < 0.001 then
if data[vi] == c_air then
data[vi] = c_water
end
end
end
local level_1_cave_floor = function(area, data, ai, vi, bi, param2_data)
if dfcaverns.can_support_vegetation[data[bi]] then
data[bi] = c_cobble_fungus
if math.random() < 0.15 then
if data[vi] == c_air then
dfcaverns.place_shrub(data, vi, param2_data, {c_plump_helmet, c_dead_fungus, c_dead_fungus, c_cavern_fungi, c_cavern_fungi})
end
end
return
end
if data[bi] ~= c_stone then
return
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if drip_rand < 0.075 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.075 * 4)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, height, dfcaverns.wet_stalagmite_ids)
end
end
local level_1_cave_ceiling = function(area, data, ai, vi, bi, param2_data)
if data[ai] ~= c_stone then
return
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if drip_rand < 0.1 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.1 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, -height, dfcaverns.wet_stalagmite_ids)
end
end
-------------------------------------------------------------------------------------------
local c_flood_fill
if flooded_biomes then
c_flood_fill = c_water
else
c_flood_fill = c_air
end
minetest.register_biome({
name = "dfcaverns_level1_flooded_biome_lower",
y_min = dfcaverns.config.level1_min,
y_max = subsea_level,
heat_point = 50,
humidity_point = 100,
_subterrane_fill_node = c_air,
_subterrane_cave_fill_node = c_flood_fill,
_subterrane_floor_decor = level_1_underwater_floor,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level1_flooded_biome_upper",
y_min = subsea_level,
y_max = dfcaverns.config.ymax,
heat_point = 50,
humidity_point = 100,
_subterrane_ceiling_decor = level_1_moist_ceiling,
_subterrane_floor_decor = level_1_wet_floor,
_subterrane_fill_node = c_air,
_subterrane_cave_fill_node = c_flood_fill,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level1_tower_cap_biome_lower",
y_min = dfcaverns.config.level1_min,
y_max = subsea_level,
heat_point = 30,
humidity_point = 40,
_subterrane_ceiling_decor = level_1_moist_ceiling,
_subterrane_floor_decor = level_1_tower_cap_floor,
_subterrane_fill_node = c_air,
_subterrane_cave_floor_decor = level_1_cave_floor,
_subterrane_cave_ceiling_decor = level_1_cave_ceiling,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level1_tower_cap_biome_upper",
y_min = subsea_level,
y_max = dfcaverns.config.ymax,
heat_point = 30,
humidity_point = 40,
_subterrane_ceiling_decor = level_1_moist_ceiling,
_subterrane_floor_decor = level_1_tower_cap_floor,
_subterrane_fill_node = c_air,
_subterrane_cave_floor_decor = level_1_cave_floor,
_subterrane_cave_ceiling_decor = level_1_cave_ceiling,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level1_fungiwood_biome_lower",
y_min = dfcaverns.config.level1_min,
y_max = subsea_level,
heat_point = 70,
humidity_point = 40,
_subterrane_ceiling_decor = level_1_moist_ceiling,
_subterrane_floor_decor = level_1_fungiwood_floor,
_subterrane_fill_node = c_air,
_subterrane_cave_floor_decor = level_1_cave_floor,
_subterrane_cave_ceiling_decor = level_1_cave_ceiling,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level1_fungiwood_biome_upper",
y_min = dfcaverns.config.level1_min,
y_max = subsea_level,
heat_point = 70,
humidity_point = 40,
_subterrane_ceiling_decor = level_1_moist_ceiling,
_subterrane_floor_decor = level_1_fungiwood_floor,
_subterrane_fill_node = c_air,
_subterrane_cave_floor_decor = level_1_cave_floor,
_subterrane_cave_ceiling_decor = level_1_cave_ceiling,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level1_tower_cap_flooded_biome_lower",
y_min = subsea_level,
y_max = dfcaverns.config.ymax,
heat_point = 20,
humidity_point = 80,
_subterrane_fill_node = c_air,
_subterrane_cave_fill_node = c_flood_fill,
_subterrane_floor_decor = level_1_underwater_floor,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level1_tower_cap_flooded_biome_upper",
y_min = subsea_level,
y_max = dfcaverns.config.ymax,
heat_point = 20,
humidity_point = 80,
_subterrane_ceiling_decor = level_1_moist_ceiling,
_subterrane_floor_decor = level_1_tower_cap_floor,
_subterrane_fill_node = c_air,
_subterrane_cave_floor_decor = level_1_cave_floor,
_subterrane_cave_ceiling_decor = level_1_cave_ceiling,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level1_fungiwood_flooded_biome_lower",
y_min = dfcaverns.config.level1_min,
y_max = subsea_level,
heat_point = 80,
humidity_point = 80,
_subterrane_fill_node = c_air,
_subterrane_cave_fill_node = c_flood_fill,
_subterrane_floor_decor = level_1_underwater_floor,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level1_fungiwood_flooded_biome_upper",
y_min = subsea_level,
y_max = dfcaverns.config.ymax,
heat_point = 80,
humidity_point = 80,
_subterrane_ceiling_decor = level_1_moist_ceiling,
_subterrane_floor_decor = level_1_fungiwood_floor,
_subterrane_fill_node = c_air,
_subterrane_cave_floor_decor = level_1_cave_floor,
_subterrane_cave_ceiling_decor = level_1_cave_ceiling,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level1_dry_biome_lower",
y_min = dfcaverns.config.level1_min,
y_max = subsea_level,
heat_point = 50,
humidity_point = 0,
_subterrane_ceiling_decor = level_1_dry_ceiling,
_subterrane_floor_decor = level_1_dry_floor,
_subterrane_fill_node = c_air,
_subterrane_mitigate_lava = false, -- let the lava spill in, nothing to protect
})
minetest.register_biome({
name = "dfcaverns_level1_dry_biome_upper",
y_min = subsea_level,
y_max = dfcaverns.config.ymax,
heat_point = 50,
humidity_point = 0,
_subterrane_ceiling_decor = level_1_dry_ceiling,
_subterrane_floor_decor = level_1_dry_floor,
_subterrane_fill_node = c_air,
_subterrane_mitigate_lava = false, -- let the lava spill in, nothing to protect
})

View File

@ -1,580 +0,0 @@
--dfcaverns.spawn_tower_cap_vm(vi, area, data)
--dfcaverns.spawn_fungiwood_vm(vi, area, data)
--dfcaverns.spawn_tunnel_tube_vm(vi, area, data, param2_data)
--dfcaverns.spawn_spore_tree_vm(vi, data, area)
--dfcaverns.spawn_goblin_cap_vm(vi, area, data)
local c_water = minetest.get_content_id("default:water_source")
local c_air = minetest.get_content_id("air")
local c_stone = minetest.get_content_id("default:stone")
local c_cobble = minetest.get_content_id("default:cobble")
local c_mossycobble = minetest.get_content_id("default:mossycobble")
local c_dirt = minetest.get_content_id("default:dirt")
local c_stone_with_coal = minetest.get_content_id("default:stone_with_coal")
local c_dirt_moss = minetest.get_content_id("dfcaverns:dirt_with_cave_moss")
local c_cobble_fungus = minetest.get_content_id("dfcaverns:cobble_with_floor_fungus")
local c_wet_flowstone = minetest.get_content_id("dfcaverns:wet_flowstone")
local c_dry_flowstone = minetest.get_content_id("dfcaverns:dry_flowstone")
local c_sweet_pod = minetest.get_content_id("dfcaverns:sweet_pod_6") -- param2 = 0
local c_quarry_bush = minetest.get_content_id("dfcaverns:quarry_bush_5") -- param2 = 4
local c_plump_helmet = minetest.get_content_id("dfcaverns:plump_helmet_4") -- param2 = 0-3
local c_pig_tail = minetest.get_content_id("dfcaverns:pig_tail_8") -- param2 = 3
local c_dimple_cup = minetest.get_content_id("dfcaverns:dimple_cup_4") -- param2 = 0
local c_cave_wheat = minetest.get_content_id("dfcaverns:cave_wheat_8") -- param2 = 3
local c_dead_fungus = minetest.get_content_id("dfcaverns:dead_fungus") -- param2 = 0
local c_cavern_fungi = minetest.get_content_id("dfcaverns:cavern_fungi") -- param2 = 0
local subsea_level = (dfcaverns.config.level1_min - dfcaverns.config.level2_min) * 0.3 + dfcaverns.config.level2_min
local flooded_biomes = dfcaverns.config.flooded_biomes
local level_2_tower_cap_floor = function(area, data, ai, vi, bi, param2_data)
if data[bi] ~= c_stone then
return
end
if math.random() < 0.25 then
data[bi] = c_dirt
else
data[bi] = c_dirt_moss
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if math.random() < 0.1 then
dfcaverns.place_shrub(data, vi, param2_data, {c_plump_helmet, c_plump_helmet, c_pig_tail, c_dead_fungus, c_cavern_fungi})
elseif drip_rand < 0.0025 then
elseif drip_rand < 0.1 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.1 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, height, dfcaverns.wet_stalagmite_ids)
elseif math.random() < 0.005 then
dfcaverns.spawn_tower_cap_vm(vi, area, data)
end
end
local level_2_fungiwood_floor = function(area, data, ai, vi, bi, param2_data)
if data[bi] ~= c_stone then
return
end
if math.random() < 0.25 then
data[bi] = c_dirt
else
data[bi] = c_dirt_moss
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if math.random() < 0.1 then
dfcaverns.place_shrub(data, vi, param2_data, {c_plump_helmet, c_pig_tail, c_cave_wheat, c_cave_wheat, c_dead_fungus, c_cavern_fungi})
elseif drip_rand < 0.1 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.1 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, height, dfcaverns.wet_stalagmite_ids)
elseif math.random() < 0.005 then
dfcaverns.spawn_fungiwood_vm(vi, area, data)
end
end
local level_2_tunnel_tube_floor = function(area, data, ai, vi, bi, param2_data)
if data[bi] ~= c_stone then
return
end
if math.random() < 0.25 then
data[bi] = c_dirt
else
data[bi] = c_dirt_moss
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if math.random() < 0.1 then
dfcaverns.place_shrub(data, vi, param2_data, {c_pig_tail, c_pig_tail, c_cave_wheat, c_cave_wheat, c_dead_fungus, c_cavern_fungi})
elseif drip_rand < 0.1 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.1 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, height, dfcaverns.wet_stalagmite_ids)
elseif math.random() < 0.05 then
dfcaverns.spawn_tunnel_tube_vm(vi, area, data, param2_data)
end
end
local level_2_black_cap_floor = function(area, data, ai, vi, bi, param2_data)
if data[bi] ~= c_stone then
return
end
if math.random() < 0.25 then
data[bi] = c_stone_with_coal
else
data[bi] = c_cobble_fungus
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if math.random() < 0.05 then
dfcaverns.place_shrub(data, vi, param2_data, {c_quarry_bush, c_dead_fungus, c_dead_fungus})
elseif drip_rand < 0.001 then
subterrane:giant_stalagmite(bi, area, data, 6, 15, c_dry_flowstone, c_dry_flowstone, c_dry_flowstone)
elseif drip_rand < 0.1 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.1 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, height, dfcaverns.wet_stalagmite_ids)
elseif math.random() < 0.025 then
dfcaverns.spawn_black_cap_vm(vi, area, data)
end
end
local level_2_spore_tree_floor = function(area, data, ai, vi, bi, param2_data)
if data[bi] ~= c_stone then
return
end
if math.random() < 0.25 then
data[bi] = c_dirt
else
data[bi] = c_dirt_moss
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if math.random() < 0.1 then
dfcaverns.place_shrub(data, vi, param2_data, {c_pig_tail, c_dimple_cup, c_dimple_cup, c_cave_wheat, c_dead_fungus, c_cavern_fungi})
elseif drip_rand < 0.001 then
subterrane:giant_stalagmite(bi, area, data, 6, 15, c_wet_flowstone, c_wet_flowstone, c_wet_flowstone)
elseif drip_rand < 0.1 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.1 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, height, dfcaverns.wet_stalagmite_ids)
elseif math.random() < 0.05 then
dfcaverns.spawn_spore_tree_vm(vi, area, data)
end
end
local level_2_goblin_cap_floor = function(area, data, ai, vi, bi, param2_data)
if data[bi] ~= c_stone then
return
end
if math.random() < 0.25 then
data[bi] = c_dirt
else
data[bi] = c_dirt_moss
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if math.random() < 0.1 then
dfcaverns.place_shrub(data, vi, param2_data, {c_plump_helmet, c_plump_helmet, c_dimple_cup, c_pig_tail, c_dead_fungus, c_cavern_fungi})
elseif drip_rand < 0.001 then
subterrane:giant_stalagmite(bi, area, data, 6, 15, c_wet_flowstone, c_wet_flowstone, c_wet_flowstone)
elseif drip_rand < 0.1 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.1 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, height, dfcaverns.wet_stalagmite_ids)
elseif math.random() < 0.025 then
dfcaverns.spawn_goblin_cap_vm(vi, area, data)
end
end
local level_2_moist_ceiling = function(area, data, ai, vi, bi, param2_data)
if data[ai] ~= c_stone then
return
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if drip_rand < 0.002 then
subterrane:giant_stalactite(ai, area, data, 6, 15, c_wet_flowstone, c_wet_flowstone, c_wet_flowstone)
elseif drip_rand < 0.07 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.07 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, -height, dfcaverns.wet_stalagmite_ids)
elseif math.random() < 0.025 then
dfcaverns.glow_worm_ceiling(area, data, ai, vi, bi)
end
end
local level_2_wet_floor = function(area, data, ai, vi, bi, param2_data)
if data[bi] ~= c_stone then
return
end
if math.random() < 0.5 then
data[bi] = c_mossycobble
if math.random() < 0.05 then
data[vi] = c_dead_fungus
elseif math.random() < 0.05 then
data[vi] = c_cavern_fungi
end
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if drip_rand < 0.001 then
subterrane:giant_stalagmite(bi, area, data, 6, 15, c_wet_flowstone, c_wet_flowstone, c_wet_flowstone)
elseif drip_rand < 0.05 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.05 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, height, dfcaverns.wet_stalagmite_ids)
end
end
local level_2_dry_floor = function(area, data, ai, vi, bi, param2_data)
if data[bi] ~= c_stone then
return
end
if math.random() < 0.25 then
data[bi] = c_cobble_fungus
if math.random() < 0.1 then
data[vi] = c_dead_fungus
end
elseif math.random() < 0.5 then
data[bi] = c_cobble
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if drip_rand < 0.001 then
subterrane:giant_stalagmite(bi, area, data, 6, 15, c_dry_flowstone, c_dry_flowstone, c_dry_flowstone)
elseif drip_rand < 0.05 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.05 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, height, dfcaverns.dry_stalagmite_ids)
end
end
local level_2_dry_ceiling = function(area, data, ai, vi, bi, param2_data)
if data[ai] ~= c_stone then
return
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if drip_rand < 0.075 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.075 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, -height, dfcaverns.dry_stalagmite_ids)
end
end
local level_2_black_cap_ceiling = function(area, data, ai, vi, bi, param2_data)
if data[ai] ~= c_stone then
return
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if drip_rand < 0.075 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.075 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, -height, dfcaverns.dry_stalagmite_ids)
elseif math.random() < 0.25 then
data[ai] = c_stone_with_coal
end
end
local level_2_crystal_ceiling = function(area, data, ai, vi, bi, param2_data)
if data[ai] ~= c_stone then
return
end
if math.random() < 0.0025 then
dfcaverns.place_big_crystal_cluster(area, data, param2_data, vi, math.random(0,1), true)
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if drip_rand < 0.075 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.075 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, -height, dfcaverns.dry_stalagmite_ids)
end
end
local level_2_underwater_floor = function(area, data, ai, vi, bi, param2_data)
if data[bi] ~= c_stone then
return
end
data[bi] = c_dirt
if flooded_biomes then
if data[vi] == c_air then
data[vi] = c_water
end
if data[ai] == c_air then
data[ai] = c_water
end
elseif math.random() < 0.001 then
if data[vi] == c_air then
data[vi] = c_water
end
end
end
local level_2_cave_floor = function(area, data, ai, vi, bi, param2_data)
if dfcaverns.can_support_vegetation[data[bi]] then
data[bi] = c_cobble_fungus
if math.random() < 0.15 then
if data[vi] == c_air then
dfcaverns.place_shrub(data, vi, param2_data, {c_plump_helmet, c_pig_tail, c_dead_fungus, c_dead_fungus, c_cavern_fungi})
end
end
return
end
if data[bi] ~= c_stone then
return
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if drip_rand < 0.075 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.075 * 4)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, height, dfcaverns.wet_stalagmite_ids)
end
end
local level_2_cave_ceiling = function(area, data, ai, vi, bi, param2_data)
if data[ai] ~= c_stone then
return
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if drip_rand < 0.1 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.1 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, -height, dfcaverns.wet_stalagmite_ids)
end
end
-------------------------------------------------------------------------------------------
local c_flood_fill
if flooded_biomes then
c_flood_fill = c_water
else
c_flood_fill = c_air
end
minetest.register_biome({
name = "dfcaverns_level2_flooded_biome_lower",
y_min = dfcaverns.config.level2_min,
y_max = subsea_level,
heat_point = 50,
humidity_point = 90,
_subterrane_fill_node = c_air,
_subterrane_cave_fill_node = c_flood_fill,
_subterrane_floor_decor = level_2_underwater_floor,
_subterrane_mitigate_lava = false,
})
minetest.register_biome({
name = "dfcaverns_level2_flooded_biome_upper",
y_min = subsea_level,
y_max = dfcaverns.config.level1_min,
heat_point = 50,
humidity_point = 90,
_subterrane_ceiling_decor = level_2_moist_ceiling,
_subterrane_floor_decor = level_2_wet_floor,
_subterrane_fill_node = c_air,
_subterrane_cave_fill_node = c_flood_fill,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level2_tower_cap_biome_lower",
y_min = dfcaverns.config.level2_min,
y_max = subsea_level,
heat_point = 0,
humidity_point = 40,
_subterrane_ceiling_decor = level_2_moist_ceiling,
_subterrane_floor_decor = level_2_tower_cap_floor,
_subterrane_fill_node = c_air,
_subterrane_cave_floor_decor = level_2_cave_floor,
_subterrane_cave_ceiling_decor = level_2_cave_ceiling,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level2_tower_cap_biome_upper",
y_min = subsea_level,
y_max = dfcaverns.config.level1_min,
heat_point = 0,
humidity_point = 40,
_subterrane_ceiling_decor = level_2_moist_ceiling,
_subterrane_floor_decor = level_2_tower_cap_floor,
_subterrane_fill_node = c_air,
_subterrane_cave_floor_decor = level_2_cave_floor,
_subterrane_cave_ceiling_decor = level_2_cave_ceiling,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level2_fungiwood_biome_lower",
y_min = dfcaverns.config.level2_min,
y_max = subsea_level,
heat_point = 100,
humidity_point = 60,
_subterrane_ceiling_decor = level_2_moist_ceiling,
_subterrane_floor_decor = level_2_fungiwood_floor,
_subterrane_fill_node = c_air,
_subterrane_cave_floor_decor = level_2_cave_floor,
_subterrane_cave_ceiling_decor = level_2_cave_ceiling,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level2_fungiwood_biome_upper",
y_min = subsea_level,
y_max = dfcaverns.config.level1_min,
heat_point = 100,
humidity_point = 60,
_subterrane_ceiling_decor = level_2_moist_ceiling,
_subterrane_floor_decor = level_2_fungiwood_floor,
_subterrane_fill_node = c_air,
_subterrane_cave_floor_decor = level_2_cave_floor,
_subterrane_cave_ceiling_decor = level_2_cave_ceiling,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level2_goblin_cap_biome_lower",
y_min = dfcaverns.config.level2_min,
y_max = subsea_level,
heat_point = 20,
humidity_point = 60,
_subterrane_ceiling_decor = level_2_moist_ceiling,
_subterrane_floor_decor = level_2_goblin_cap_floor,
_subterrane_fill_node = c_air,
_subterrane_cave_floor_decor = level_2_cave_floor,
_subterrane_cave_ceiling_decor = level_2_cave_ceiling,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level2_goblin_cap_biome_upper",
y_min = subsea_level,
y_max = dfcaverns.config.level1_min,
heat_point = 20,
humidity_point = 60,
_subterrane_ceiling_decor = level_2_moist_ceiling,
_subterrane_floor_decor = level_2_goblin_cap_floor,
_subterrane_fill_node = c_air,
_subterrane_cave_floor_decor = level_2_cave_floor,
_subterrane_cave_ceiling_decor = level_2_cave_ceiling,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level2_spore_tree_biome_lower",
y_min = dfcaverns.config.level2_min,
y_max = subsea_level,
heat_point = 60,
humidity_point = 60,
_subterrane_ceiling_decor = level_2_moist_ceiling,
_subterrane_floor_decor = level_2_spore_tree_floor,
_subterrane_fill_node = c_air,
_subterrane_cave_floor_decor = level_2_cave_floor,
_subterrane_cave_ceiling_decor = level_2_cave_ceiling,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level2_spore_tree_biome_upper",
y_min = subsea_level,
y_max = dfcaverns.config.level1_min,
heat_point = 60,
humidity_point = 60,
_subterrane_ceiling_decor = level_2_moist_ceiling,
_subterrane_floor_decor = level_2_spore_tree_floor,
_subterrane_fill_node = c_air,
_subterrane_cave_floor_decor = level_2_cave_floor,
_subterrane_cave_ceiling_decor = level_2_cave_ceiling,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level2_tunnel_tube_biome_lower",
y_min = dfcaverns.config.level2_min,
y_max = subsea_level,
heat_point = 80,
humidity_point = 40,
_subterrane_ceiling_decor = level_2_moist_ceiling,
_subterrane_floor_decor = level_2_tunnel_tube_floor,
_subterrane_fill_node = c_air,
_subterrane_cave_floor_decor = level_2_cave_floor,
_subterrane_cave_ceiling_decor = level_2_cave_ceiling,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level2_tunnel_tube_biome_upper",
y_min = subsea_level,
y_max = dfcaverns.config.level1_min,
heat_point = 80,
humidity_point = 40,
_subterrane_ceiling_decor = level_2_moist_ceiling,
_subterrane_floor_decor = level_2_tunnel_tube_floor,
_subterrane_fill_node = c_air,
_subterrane_cave_floor_decor = level_2_cave_floor,
_subterrane_cave_ceiling_decor = level_2_cave_ceiling,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level2_black_cap_biome_lower",
y_min = dfcaverns.config.level2_min,
y_max = subsea_level,
heat_point = 50,
humidity_point = 20,
_subterrane_ceiling_decor = level_2_black_cap_ceiling,
_subterrane_floor_decor = level_2_black_cap_floor,
_subterrane_fill_node = c_air,
_subterrane_column_node = c_dry_flowstone,
_subterrane_cave_floor_decor = level_2_cave_floor,
_subterrane_cave_ceiling_decor = level_2_cave_ceiling,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level2_black_cap_biome_upper",
y_min = subsea_level,
y_max = dfcaverns.config.level1_min,
heat_point = 50,
humidity_point = 20,
_subterrane_ceiling_decor = level_2_black_cap_ceiling,
_subterrane_floor_decor = level_2_black_cap_floor,
_subterrane_fill_node = c_air,
_subterrane_column_node = c_dry_flowstone,
_subterrane_cave_floor_decor = level_2_cave_floor,
_subterrane_cave_ceiling_decor = level_2_cave_ceiling,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level2_dry_biome_lower",
y_min = dfcaverns.config.level2_min,
y_max = subsea_level,
heat_point = 50,
humidity_point = 15,
_subterrane_ceiling_decor = level_2_crystal_ceiling,
_subterrane_floor_decor = level_2_dry_floor,
_subterrane_fill_node = c_air,
_subterrane_column_node = c_dry_flowstone,
_subterrane_mitigate_lava = false,
})
minetest.register_biome({
name = "dfcaverns_level2_dry_biome_upper",
y_min = subsea_level,
y_max = dfcaverns.config.level1_min,
heat_point = 50,
humidity_point = 15,
_subterrane_ceiling_decor = level_2_dry_ceiling,
_subterrane_floor_decor = level_2_dry_floor,
_subterrane_fill_node = c_air,
_subterrane_column_node = c_dry_flowstone,
_subterrane_mitigate_lava = false,
})

View File

@ -1,632 +0,0 @@
--dfcaverns.spawn_tunnel_tube_vm(vi, area, data, param2_data)
--dfcaverns.spawn_spore_tree_vm(vi, data, area)
--dfcaverns.spawn_nether_cap_vm(vi, area, data)
--dfcaverns.spawn_goblin_cap_vm(vi, area, data)
--dfcaverns.spawn_blood_thorn_vm(vi, area, data, data_param2)
local c_water = minetest.get_content_id("default:water_source")
local c_air = minetest.get_content_id("air")
local c_stone = minetest.get_content_id("default:stone")
local c_cobble = minetest.get_content_id("default:cobble")
local c_mossycobble = minetest.get_content_id("default:mossycobble")
local c_dirt = minetest.get_content_id("default:dirt")
local c_sand = minetest.get_content_id("default:sand")
local c_stone_with_coal = minetest.get_content_id("default:stone_with_coal")
local c_silver_sand = minetest.get_content_id("default:silver_sand")
local c_snow = minetest.get_content_id("default:snow")
local c_ice = minetest.get_content_id("default:ice")
local c_dirt_moss = minetest.get_content_id("dfcaverns:dirt_with_cave_moss")
local c_cobble_fungus = minetest.get_content_id("dfcaverns:cobble_with_floor_fungus")
local c_wet_flowstone = minetest.get_content_id("dfcaverns:wet_flowstone")
local c_dry_flowstone = minetest.get_content_id("dfcaverns:dry_flowstone")
local c_sweet_pod = minetest.get_content_id("dfcaverns:sweet_pod_6") -- param2 = 0
local c_quarry_bush = minetest.get_content_id("dfcaverns:quarry_bush_5") -- param2 = 4
local c_plump_helmet = minetest.get_content_id("dfcaverns:plump_helmet_4") -- param2 = 0-3
local c_pig_tail = minetest.get_content_id("dfcaverns:pig_tail_8") -- param2 = 3
local c_dimple_cup = minetest.get_content_id("dfcaverns:dimple_cup_4") -- param2 = 0
local c_cave_wheat = minetest.get_content_id("dfcaverns:cave_wheat_8") -- param2 = 3
local c_dead_fungus = minetest.get_content_id("dfcaverns:dead_fungus") -- param2 = 0
local c_cavern_fungi = minetest.get_content_id("dfcaverns:cavern_fungi") -- param2 = 0
local subsea_level = (dfcaverns.config.level2_min - dfcaverns.config.level3_min) * 0.3 + dfcaverns.config.level3_min
local flooded_biomes = dfcaverns.config.flooded_biomes
local level_3_moist_ceiling = function(area, data, ai, vi, bi, param2_data)
if data[ai] ~= c_stone then
return
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if drip_rand < 0.0025 then
subterrane:giant_stalactite(ai, area, data, 6, 15, c_wet_flowstone, c_wet_flowstone, c_wet_flowstone)
elseif drip_rand < 0.075 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.075 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, -height, dfcaverns.wet_stalagmite_ids)
elseif math.random() < 0.03 then
dfcaverns.glow_worm_ceiling(area, data, ai, vi, bi)
end
end
local level_3_dry_floor = function(area, data, ai, vi, bi, param2_data)
if data[bi] ~= c_stone then
return
end
if math.random() < 0.25 then
data[bi] = c_cobble_fungus
if math.random() < 0.1 then
data[vi] = c_dead_fungus
end
elseif math.random() < 0.5 then
data[bi] = c_cobble
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if drip_rand < 0.001 then
subterrane:giant_stalagmite(bi, area, data, 6, 20, c_dry_flowstone, c_dry_flowstone, c_dry_flowstone)
elseif drip_rand < 0.05 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.05 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, height, dfcaverns.dry_stalagmite_ids)
end
end
local level_3_crystal_floor = function(area, data, ai, vi, bi, param2_data)
if data[bi] ~= c_stone then
return
end
floor_item = math.random()
if floor_item < 0.005 then
dfcaverns.place_big_crystal_cluster(area, data, param2_data, vi, math.random(0,2), false)
elseif floor_item < 0.5 then
data[bi] = c_cobble
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if drip_rand < 0.001 then
subterrane:giant_stalagmite(bi, area, data, 6, 20, c_dry_flowstone, c_dry_flowstone, c_dry_flowstone)
elseif drip_rand < 0.025 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.025 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, height, dfcaverns.dry_stalagmite_ids)
end
end
local level_3_wet_floor = function(area, data, ai, vi, bi, param2_data)
if data[bi] ~= c_stone then
return
end
if math.random() < 0.5 then
data[bi] = c_mossycobble
if math.random() < 0.05 then
data[vi] = c_dead_fungus
elseif math.random() < 0.05 then
data[vi] = c_cavern_fungi
end
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if drip_rand < 0.001 then
subterrane:giant_stalagmite(bi, area, data, 6, 15, c_wet_flowstone, c_wet_flowstone, c_wet_flowstone)
elseif drip_rand < 0.05 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.05 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, height, dfcaverns.wet_stalagmite_ids)
end
end
local level_3_underwater_floor = function(area, data, ai, vi, bi, param2_data)
if data[bi] ~= c_stone then
return
end
data[bi] = c_dirt
if flooded_biomes then
if data[vi] == c_air then
data[vi] = c_water
end
if data[ai] == c_air then
data[ai] = c_water
end
elseif math.random() < 0.001 then
if data[vi] == c_air then
data[vi] = c_water
end
end
end
local level_3_dry_ceiling = function(area, data, ai, vi, bi, param2_data)
if data[ai] ~= c_stone then
return
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if drip_rand < 0.075 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.075 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, -height, dfcaverns.dry_stalagmite_ids)
end
end
local level_3_black_cap_ceiling = function(area, data, ai, vi, bi, param2_data)
if data[ai] ~= c_stone then
return
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if drip_rand < 0.075 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.075 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, -height, dfcaverns.dry_stalagmite_ids)
elseif math.random() < 0.25 then
data[ai] = c_stone_with_coal
end
end
local level_3_crystal_ceiling = function(area, data, ai, vi, bi, param2_data)
if data[ai] ~= c_stone then
return
end
if math.random() < 0.005 then
dfcaverns.place_big_crystal_cluster(area, data, param2_data, vi, math.random(0,3), true)
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if drip_rand < 0.025 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.025 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, -height, dfcaverns.dry_stalagmite_ids)
end
end
local level_3_blood_thorn_floor = function(area, data, ai, vi, bi, param2_data)
if data[bi] ~= c_stone then
return
end
if math.random() < 0.1 then
data[bi] = c_dirt_moss
else
data[bi] = c_sand
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if math.random() < 0.1 then
dfcaverns.place_shrub(data, vi, param2_data, {c_sweet_pod, c_sweet_pod, c_dead_fungus, c_dead_fungus, c_dead_fungus, c_cavern_fungi})
elseif drip_rand < 0.05 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.05 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, height, dfcaverns.dry_stalagmite_ids)
elseif math.random() < 0.05 then
dfcaverns.spawn_blood_thorn_vm(vi, area, data, param2_data)
end
end
local level_3_nether_cap_floor = function(area, data, ai, vi, bi, param2_data)
if data[bi] ~= c_stone then
return
end
local ground = math.random()
if ground < 0.25 then
data[bi] = c_silver_sand
elseif ground < 0.5 then
data[bi] = c_ice
data[vi] = c_snow
elseif ground < 0.75 then
data[vi] = c_snow
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if math.random() < 0.01 and data[bi] ~= c_ice then
dfcaverns.place_shrub(data, vi, param2_data, {c_dimple_cup, c_dead_fungus, c_dead_fungus, c_dead_fungus, c_cavern_fungi})
elseif drip_rand < 0.1 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.1 * 5)
data[vi] = c_air
subterrane:small_stalagmite(vi, area, data, param2_data, param2, height, dfcaverns.icicle_ids)
elseif math.random() < 0.005 then
dfcaverns.spawn_nether_cap_vm(vi, area, data)
end
end
local level_3_tunnel_tube_floor = function(area, data, ai, vi, bi, param2_data)
if data[bi] ~= c_stone then
return
end
if math.random() < 0.25 then
data[bi] = c_dirt
else
data[bi] = c_dirt_moss
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if math.random() < 0.1 then
dfcaverns.place_shrub(data, vi, param2_data, {c_pig_tail, c_quarry_bush, c_quarry_bush, c_cave_wheat, c_dead_fungus, c_cavern_fungi})
elseif drip_rand < 0.1 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.1 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, height, dfcaverns.wet_stalagmite_ids)
elseif math.random() < 0.05 then
dfcaverns.spawn_tunnel_tube_vm(vi, area, data, param2_data)
end
end
local level_3_spore_tree_floor = function(area, data, ai, vi, bi, param2_data)
if data[bi] ~= c_stone then
return
end
if math.random() < 0.25 then
data[bi] = c_dirt
else
data[bi] = c_dirt_moss
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if math.random() < 0.1 then
dfcaverns.place_shrub(data, vi, param2_data, {c_pig_tail, c_quarry_bush, c_quarry_bush, c_dimple_cup, c_dead_fungus, c_cavern_fungi})
elseif drip_rand < 0.001 then
subterrane:giant_stalagmite(bi, area, data, 6, 15, c_wet_flowstone, c_wet_flowstone, c_wet_flowstone)
elseif drip_rand < 0.1 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.1 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, height, dfcaverns.wet_stalagmite_ids)
elseif math.random() < 0.05 then
dfcaverns.spawn_spore_tree_vm(vi, area, data)
end
end
local level_3_black_cap_floor = function(area, data, ai, vi, bi, param2_data)
if data[bi] ~= c_stone then
return
end
if math.random() < 0.25 then
data[bi] = c_stone_with_coal
else
data[bi] = c_cobble_fungus
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if math.random() < 0.05 then
dfcaverns.place_shrub(data, vi, param2_data, {c_quarry_bush, c_dead_fungus, c_dead_fungus})
elseif drip_rand < 0.001 then
subterrane:giant_stalagmite(bi, area, data, 6, 15, c_dry_flowstone, c_dry_flowstone, c_dry_flowstone)
elseif drip_rand < 0.1 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.1 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, height, dfcaverns.dry_stalagmite_ids)
elseif math.random() < 0.025 then
dfcaverns.spawn_black_cap_vm(vi, area, data)
end
end
local level_3_goblin_cap_floor = function(area, data, ai, vi, bi, param2_data)
if data[bi] ~= c_stone then
return
end
if math.random() < 0.25 then
data[bi] = c_dirt
else
data[bi] = c_dirt_moss
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if math.random() < 0.1 then
dfcaverns.place_shrub(data, vi, param2_data, {c_plump_helmet, c_plump_helmet, c_sweet_pod, c_dead_fungus, c_cavern_fungi})
elseif drip_rand < 0.1 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.1 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, height, dfcaverns.wet_stalagmite_ids)
elseif math.random() < 0.025 then
dfcaverns.spawn_goblin_cap_vm(vi, area, data)
end
end
local level_3_cave_floor = function(area, data, ai, vi, bi, param2_data)
if dfcaverns.can_support_vegetation[data[bi]] then
data[bi] = c_dirt_moss
if math.random() < 0.10 then
if data[vi] == c_air then
dfcaverns.place_shrub(data, vi, param2_data, {c_plump_helmet, c_quarry_bush, c_dead_fungus, c_dead_fungus, c_cavern_fungi})
end
end
return
end
if data[bi] == c_cobble and math.random() < 0.001 then
data[bi] = c_cobble_fungus
return
end
if data[bi] ~= c_stone then
return
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if drip_rand < 0.075 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.075 * 4)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, height, dfcaverns.wet_stalagmite_ids)
end
end
local level_3_cave_ceiling = function(area, data, ai, vi, bi, param2_data)
if data[ai] ~= c_stone then
return
end
local drip_rand = subterrane:vertically_consistent_random(vi, area)
if drip_rand < 0.1 then
local param2 = drip_rand*1000000 - math.floor(drip_rand*1000000/4)*4
local height = math.floor(drip_rand/0.1 * 5)
subterrane:small_stalagmite(vi, area, data, param2_data, param2, -height, dfcaverns.wet_stalagmite_ids)
end
end
-------------------------------------------------------------------------------------------
local c_flood_fill
if flooded_biomes then
c_flood_fill = c_water
else
c_flood_fill = c_air
end
minetest.register_biome({
name = "dfcaverns_level3_flooded_biome_lower",
y_min = dfcaverns.config.sunless_sea_level,
y_max = subsea_level,
heat_point = 50,
humidity_point = 90,
_subterrane_fill_node = c_air,
_subterrane_cave_fill_node = c_water,
_subterrane_floor_decor = level_3_underwater_floor,
})
minetest.register_biome({
name = "dfcaverns_level3_flooded_biome_upper",
y_min = subsea_level,
y_max = dfcaverns.config.level2_min,
heat_point = 50,
humidity_point = 90,
_subterrane_ceiling_decor = level_3_moist_ceiling,
_subterrane_floor_decor = level_3_wet_floor,
_subterrane_fill_node = c_air,
_subterrane_cave_fill_node = c_flood_fill,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level3_blood_thorn_biome_lower",
y_min = dfcaverns.config.sunless_sea_level,
y_max = subsea_level,
heat_point = 10,
humidity_point = 30,
_subterrane_ceiling_decor = level_3_crystal_ceiling,
_subterrane_floor_decor = level_3_blood_thorn_floor,
_subterrane_fill_node = c_air,
_subterrane_column_node = c_dry_flowstone,
_subterrane_cave_floor_decor = level_3_cave_floor,
_subterrane_cave_ceiling_decor = level_3_cave_ceiling,
_subterrane_override_sea_level = dfcaverns.config.sunless_sea_level,
_subterrane_override_under_sea_biome = "dfcaverns_sunless_sea_coral",
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level3_blood_thorn_biome_upper",
y_min = subsea_level,
y_max = dfcaverns.config.level2_min,
heat_point = 10,
humidity_point = 30,
_subterrane_ceiling_decor = level_3_crystal_ceiling,
_subterrane_floor_decor = level_3_blood_thorn_floor,
_subterrane_column_node = c_dry_flowstone,
_subterrane_fill_node = c_air,
_subterrane_cave_floor_decor = level_3_cave_floor,
_subterrane_cave_ceiling_decor = level_3_cave_ceiling,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level3_nether_cap_biome_lower",
y_min = dfcaverns.config.sunless_sea_level,
y_max = subsea_level,
heat_point = 90,
humidity_point = 50,
_subterrane_ceiling_decor = level_3_dry_ceiling,
_subterrane_floor_decor = level_3_nether_cap_floor,
_subterrane_fill_node = c_air,
_subterrane_column_node = c_ice,
_subterrane_cave_floor_decor = level_3_cave_floor,
_subterrane_cave_ceiling_decor = level_3_cave_ceiling,
_subterrane_override_sea_level = dfcaverns.config.sunless_sea_level,
_subterrane_override_under_sea_biome = "dfcaverns_sunless_sea_snareweed",
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level3_nether_cap_biome_upper",
y_min = subsea_level,
y_max = dfcaverns.config.level2_min,
heat_point = 90,
humidity_point = 50,
_subterrane_ceiling_decor = level_3_dry_ceiling,
_subterrane_floor_decor = level_3_nether_cap_floor,
_subterrane_fill_node = c_air,
_subterrane_column_node = c_ice,
_subterrane_cave_floor_decor = level_3_cave_floor,
_subterrane_cave_ceiling_decor = level_3_cave_ceiling,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level3_goblin_cap_biome_lower",
y_min = dfcaverns.config.sunless_sea_level,
y_max = subsea_level,
heat_point = 20,
humidity_point = 60,
_subterrane_ceiling_decor = level_3_moist_ceiling,
_subterrane_floor_decor = level_3_goblin_cap_floor,
_subterrane_fill_node = c_air,
_subterrane_cave_floor_decor = level_3_cave_floor,
_subterrane_cave_ceiling_decor = level_3_cave_ceiling,
_subterrane_override_sea_level = dfcaverns.config.sunless_sea_level,
_subterrane_override_under_sea_biome = "dfcaverns_sunless_sea_coral",
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level3_goblin_cap_biome_upper",
y_min = subsea_level,
y_max = dfcaverns.config.level2_min,
heat_point = 20,
humidity_point = 60,
_subterrane_ceiling_decor = level_3_moist_ceiling,
_subterrane_floor_decor = level_3_goblin_cap_floor,
_subterrane_fill_node = c_air,
_subterrane_cave_floor_decor = level_3_cave_floor,
_subterrane_cave_ceiling_decor = level_3_cave_ceiling,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level3_spore_tree_biome_lower",
y_min = dfcaverns.config.sunless_sea_level,
y_max = subsea_level,
heat_point = 60,
humidity_point = 60,
_subterrane_ceiling_decor = level_3_moist_ceiling,
_subterrane_floor_decor = level_3_spore_tree_floor,
_subterrane_fill_node = c_air,
_subterrane_cave_floor_decor = level_3_cave_floor,
_subterrane_cave_ceiling_decor = level_3_cave_ceiling,
_subterrane_override_sea_level = dfcaverns.config.sunless_sea_level,
_subterrane_override_under_sea_biome = "dfcaverns_sunless_sea_snareweed",
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level3_spore_tree_biome_upper",
y_min = subsea_level,
y_max = dfcaverns.config.level2_min,
heat_point = 60,
humidity_point = 60,
_subterrane_ceiling_decor = level_3_moist_ceiling,
_subterrane_floor_decor = level_3_spore_tree_floor,
_subterrane_fill_node = c_air,
_subterrane_cave_floor_decor = level_3_cave_floor,
_subterrane_cave_ceiling_decor = level_3_cave_ceiling,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level3_tunnel_tube_biome_lower",
y_min = dfcaverns.config.sunless_sea_level,
y_max = subsea_level,
heat_point = 60,
humidity_point = 40,
_subterrane_ceiling_decor = level_3_moist_ceiling,
_subterrane_floor_decor = level_3_tunnel_tube_floor,
_subterrane_fill_node = c_air,
_subterrane_cave_floor_decor = level_3_cave_floor,
_subterrane_cave_ceiling_decor = level_3_cave_ceiling,
_subterrane_override_sea_level = dfcaverns.config.sunless_sea_level,
_subterrane_override_under_sea_biome = "dfcaverns_sunless_sea_snareweed",
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level3_tunnel_tube_biome_upper",
y_min = subsea_level,
y_max = dfcaverns.config.level2_min,
heat_point = 60,
humidity_point = 40,
_subterrane_ceiling_decor = level_3_moist_ceiling,
_subterrane_floor_decor = level_3_tunnel_tube_floor,
_subterrane_fill_node = c_air,
_subterrane_cave_floor_decor = level_3_cave_floor,
_subterrane_cave_ceiling_decor = level_3_cave_ceiling,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level3_black_cap_biome_lower",
y_min = dfcaverns.config.sunless_sea_level,
y_max = subsea_level,
heat_point = 50,
humidity_point = 15,
_subterrane_ceiling_decor = level_3_black_cap_ceiling,
_subterrane_floor_decor = level_3_black_cap_floor,
_subterrane_fill_node = c_air,
_subterrane_column_node = c_dry_flowstone,
_subterrane_cave_floor_decor = level_3_cave_floor,
_subterrane_cave_ceiling_decor = level_3_cave_ceiling,
_subterrane_override_sea_level = dfcaverns.config.sunless_sea_level,
_subterrane_override_under_sea_biome = "dfcaverns_sunless_sea_barren",
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level3_black_cap_biome_upper",
y_min = subsea_level,
y_max = dfcaverns.config.level2_min,
heat_point = 50,
humidity_point = 15,
_subterrane_ceiling_decor = level_3_black_cap_ceiling,
_subterrane_floor_decor = level_3_black_cap_floor,
_subterrane_fill_node = c_air,
_subterrane_column_node = c_dry_flowstone,
_subterrane_cave_floor_decor = level_3_cave_floor,
_subterrane_cave_ceiling_decor = level_3_cave_ceiling,
_subterrane_mitigate_lava = true,
})
minetest.register_biome({
name = "dfcaverns_level3_dry_biome_lower",
y_min = dfcaverns.config.sunless_sea_level,
y_max = subsea_level,
heat_point = 50,
humidity_point = 10,
_subterrane_ceiling_decor = level_3_crystal_ceiling,
_subterrane_floor_decor = level_3_crystal_floor,
_subterrane_fill_node = c_air,
_subterrane_column_node = c_dry_flowstone,
_subterrane_override_sea_level = dfcaverns.config.sunless_sea_level,
_subterrane_override_under_sea_biome = "dfcaverns_sunless_sea_barren",
_subterrane_mitigate_lava = false,
})
minetest.register_biome({
name = "dfcaverns_level3_dry_biome_upper",
y_min = subsea_level,
y_max = dfcaverns.config.level2_min,
heat_point = 50,
humidity_point = 10,
_subterrane_ceiling_decor = level_3_crystal_ceiling,
_subterrane_floor_decor = level_3_crystal_floor,
_subterrane_fill_node = c_air,
_subterrane_column_node = c_dry_flowstone,
_subterrane_mitigate_lava = false,
})

View File

@ -1,129 +0,0 @@
local c_water = minetest.get_content_id("default:water_source")
local c_air = minetest.get_content_id("air")
local c_stone = minetest.get_content_id("default:stone")
local c_dirt = minetest.get_content_id("default:dirt")
local c_sand = minetest.get_content_id("default:sand")
-------------------------------------------------------------------------------------------
local sea_level = dfcaverns.config.sunless_sea_level
local sunless_sea_barren_floor = function(area, data, ai, vi, bi, param2_data)
if data[bi] ~= c_stone then
return
end
data[bi] = c_sand
end
local sunless_sea_snareweed_floor = function(area, data, ai, vi, bi, param2_data)
if data[bi] ~= c_stone then
return
end
if math.random() < 0.005 then
dfcaverns.place_snareweed_patch(area, data, bi, param2_data, 6)
else
data[bi] = c_dirt
end
end
local sunless_sea_coral_ceiling = function(area, data, ai, vi, bi, param2_data)
if data[ai] ~= c_stone then
return
end
local coral_rand = subterrane:vertically_consistent_random(vi, area)
if coral_rand < 0.01 then
local iterations = math.ceil(coral_rand / 0.01 * 6)
dfcaverns.spawn_cave_coral(area, data, vi, iterations)
end
end
local sunless_sea_coral_floor = function(area, data, ai, vi, bi, param2_data)
if data[bi] ~= c_stone then
return
end
local coral_rand = subterrane:vertically_consistent_random(vi, area)
if coral_rand < 0.01 then
local iterations = math.ceil(coral_rand / 0.01 * 6)
dfcaverns.spawn_coral_pile(area, data, vi, iterations)
end
end
minetest.register_biome({
name = "dfcaverns_sunless_sea_barren",
y_min = dfcaverns.config.sunless_sea_min,
y_max = dfcaverns.config.sunless_sea_level,
heat_point = 80,
humidity_point = 10,
_subterrane_fill_node = c_water,
_subterrane_cave_fill_node = c_air,
_subterrane_mitigate_lava = true,
_subterrane_floor_decor = sunless_sea_barren_floor,
})
minetest.register_biome({
name = "dfcaverns_sunless_sea_snareweed",
y_min = dfcaverns.config.sunless_sea_min,
y_max = dfcaverns.config.sunless_sea_level,
heat_point = 80,
humidity_point = 90,
_subterrane_fill_node = c_water,
_subterrane_cave_fill_node = c_water,
_subterrane_mitigate_lava = true,
_subterrane_floor_decor = sunless_sea_snareweed_floor,
})
minetest.register_biome({
name = "dfcaverns_sunless_sea_coral",
y_min = dfcaverns.config.sunless_sea_min,
y_max = dfcaverns.config.sunless_sea_level,
heat_point = 0,
humidity_point = 50,
_subterrane_fill_node = c_water,
_subterrane_cave_fill_node = c_water,
_subterrane_mitigate_lava = true,
_subterrane_floor_decor = sunless_sea_coral_floor,
_subterrane_ceiling_decor = sunless_sea_coral_ceiling,
})
local data = {}
minetest.register_on_generated(function(minp, maxp, seed)
--if out of range of cave definition limits, abort
if minp.y > dfcaverns.config.sunless_sea_level or maxp.y < dfcaverns.config.sunless_sea_min then
return
end
--easy reference to commonly used values
local t_start = os.clock()
local x_max = maxp.x
local y_max = maxp.y
local z_max = maxp.z
local x_min = minp.x
local y_min = minp.y
local z_min = minp.z
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
vm:get_data(data)
for z = z_min, z_max do -- for each xy plane progressing northwards
for y = y_min, y_max do -- for each x row progressing upwards
if y <= dfcaverns.config.sunless_sea_level then
local vi = area:index(x_min, y, z) --current node index
for x = x_min, x_max do -- for each node do
if data[vi] == c_air then
data[vi] = c_water
end
vi = vi + 1
end
end
end
end
--send data back to voxelmanip
vm:set_data(data)
--calc lighting
vm:set_lighting({day = 0, night = 0})
vm:calc_lighting()
--write it to world
vm:write_to_map()
end)

View File

@ -1,99 +0,0 @@
local CONFIG_FILE_PREFIX = "dfcaverns_"
dfcaverns.config = {}
local print_settingtypes = false
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", delay_multiplier = 1},
{name="tunnel_tube", delay_multiplier = 1},
{name="spore_tree", delay_multiplier = 1},
{name="black_cap", delay_multiplier = 1},
{name="nether_cap", delay_multiplier = 1},
{name="goblin_cap", delay_multiplier = 1},
{name="tower_cap", delay_multiplier = 1},
}
local plants = {
{name="cave_wheat", delay_multiplier=1},
{name="dimple_cup", delay_multiplier=3},
{name="pig_tail", delay_multiplier=1},
{name="plump_helmet", delay_multiplier=3},
{name="quarry_bush", delay_multiplier=2},
{name="sweet_pod", delay_multiplier=2},
}
--Trees
setting("int", "tree_min_growth_delay", 2400, "Minimum sapling growth delay")
setting("int", "tree_max_growth_delay", 4800, "Maximum sapling growth delay")
for _, tree in pairs(trees) do
setting("float", tree.name.."_delay_multiplier", tree.delay_multiplier, tree.name.." growth delay multiplier")
end
setting("int", "blood_thorn_growth_interval", 12, "blood_thorn growth ABM interval")
setting("int", "blood_thorn_growth_chance", 83, "blood_thorn growth ABM chance")
--Plants
setting("int", "plant_growth_time", 500, "Base plant growth time")
for _, plant in pairs(plants) do
setting("float", plant.name.."_delay_multiplier", plant.delay_multiplier, plant.name.." growth delay multiplier")
end
setting("float", "glow_worm_delay_multiplier", 10.0, "glow worm growth delay multiplier")
setting("bool", "light_kills_fungus", true, "Light kills fungus")
setting("bool", "snareweed_damage", true, "Snareweed causes damage to players")
--Caverns
setting("float", "vertical_cavern_scale", 256, "Vertical cavern dimension scale")
setting("float", "horizontal_cavern_scale", 256, "Horizontal cavern dimension scale")
setting("float", "cavern_threshold", 0.5, "Cavern threshold")
setting("int", "ymax", -300, "Upper limit of level 1")
setting("int", "level1_min", -900, "Upper limit of level 2")
setting("int", "level2_min", -1500, "Upper limit of level 3")
setting("int", "level3_min", -2100, "Upper limit of the sunless sea")
setting("int", "sunless_sea_min", -2500, "Lower limit of the sunless sea")
setting("int", "lava_sea_max", -3000, "Upper limit of the lava sea")
setting("int", "lava_sea_min", -3500, "Lower limit of the lava sea")
setting("float", "lava_sea_threshold", 0.2, "Cavern threshold for sunless and magma seas (higher number means sparser magma)")
setting("bool", "enable_lava_sea", true, "Enable magma sea level")
setting("bool", "flooded_biomes", true, "Add a lot of water to the most humid cavern biomes")
setting("bool", "stone_between_layers", true, "Ensures that there's a solid stone floor/ceiling between cavern layers")
if minetest.get_modpath("tnt") then
dfcaverns.config.enable_tnt = minetest.settings:get_bool("enable_tnt")
if dfcaverns.config.enable_tnt == nil then
-- Default to enabled when in singleplayer
dfcaverns.config.enable_tnt = minetest.is_singleplayer()
end
end
dfcaverns.config.sunless_sea_level = dfcaverns.config.level3_min - (dfcaverns.config.level3_min - dfcaverns.config.sunless_sea_min) * 0.5

View File

@ -1 +1 @@
Adds vast underground caverns in the style of Dwarf Fortress, complete with underground flora in diverse biomes. Also adds stalactite/stalagmite decorations in the smaller tunnels.
Adds vast underground caverns in the style of Dwarf Fortress, complete with underground flora in diverse biomes.

22
df_caverns/LICENSE.txt Normal file
View File

@ -0,0 +1,22 @@
License for Code
----------------
Copyright (C) 2018 FaceDeer
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

50
df_caverns/config.lua Normal file
View File

@ -0,0 +1,50 @@
local CONFIG_FILE_PREFIX = "dfcaverns_"
df_caverns.config = {}
local print_settingtypes = false
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
df_caverns.config[name] = value
if print_settingtypes then
minetest.debug(CONFIG_FILE_PREFIX..name.." ("..description..") "..stype.." "..tostring(default))
end
end
--Caverns
setting("float", "vertical_cavern_scale", 256, "Vertical cavern dimension scale")
setting("float", "horizontal_cavern_scale", 256, "Horizontal cavern dimension scale")
setting("float", "cavern_threshold", 0.5, "Cavern threshold")
setting("float", "sunless_sea_threshold", 0.4, "Cavern threshold for sunless seas (higher number means sparser caverns)")
setting("float", "tunnel_flooding_threshold", 0.25, "Threshold for flooding tunnels around flooded caverns")
setting("int", "ymax", -193, "Upper limit of level 1")
setting("int", "level1_min", -832, "Upper limit of level 2")
setting("int", "level2_min", -1472, "Upper limit of level 3")
setting("int", "level3_min", -2112, "Upper limit of the sunless seas")
setting("int", "sunless_sea_min", -2512, "Lower limit of the sunless seas")
setting("bool", "enable_oil_sea", true, "Enable oil sea")
df_caverns.config.enable_oil_sea = df_caverns.config.enable_oil_sea and minetest.get_modpath("oil") ~= nil
setting("int", "oil_sea_level", -2700, "Oil sea level")
setting("bool", "enable_lava_sea", true, "Enable magma sea")
setting("int", "lava_sea_level", -2900, "Lava sea level")
setting("bool", "enable_underworld", true, "Enable underworld")
df_caverns.config.enable_underworld = df_caverns.config.enable_underworld and minetest.get_modpath("df_underworld_items") ~= nil
setting("int", "underworld_level", -3200, "Underworld level")
setting("int", "underworld_glowing_pit_mapblocks", 8, "Average pit spacing measured in mapblocks")

9
df_caverns/depends.txt Normal file
View File

@ -0,0 +1,9 @@
default
subterrane
df_farming?
df_trees
df_mapitems
ice_sprites?
oil?
df_underworld_items?
magma_conduits?

View File

@ -0,0 +1 @@
Adds vast underground caverns in the style of Dwarf Fortress, complete with underground flora in diverse biomes. Also adds stalactite/stalagmite decorations in the smaller tunnels.

17
df_caverns/init.lua Normal file
View File

@ -0,0 +1,17 @@
df_caverns = {}
--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.."/shared.lua")
dofile(modpath.."/surface_tunnels.lua")
dofile(modpath.."/level1.lua")
dofile(modpath.."/level2.lua")
dofile(modpath.."/level3.lua")
dofile(modpath.."/sunless_sea.lua")
dofile(modpath.."/oil_sea.lua")
dofile(modpath.."/lava_sea.lua")
dofile(modpath.."/underworld.lua")

147
df_caverns/lava_sea.lua Normal file
View File

@ -0,0 +1,147 @@
if not df_caverns.config.enable_lava_sea then
return
end
local c_air = minetest.get_content_id("air")
local c_lava = minetest.get_content_id("default:lava_source")
local c_meseore = minetest.get_content_id("default:stone_with_mese")
local c_mese_crystal = minetest.get_content_id("df_mapitems:mese_crystal")
local c_mese_crystal_block = minetest.get_content_id("df_mapitems:glow_mese")
local c_obsidian = minetest.get_content_id("default:obsidian")
-------------------------------------------------------------------------------------------
local perlin_cave = {
offset = 0,
scale = 1,
spread = {x=100, y=100, z=100},
seed = -787324,
octaves = 3,
persist = 0.67
}
-- large-scale rise and fall
local perlin_wave = {
offset = 0,
scale = 1,
spread = {x=1000, y=1000, z=1000},
seed = 256664,
octaves = 3,
persist = 0.67
}
local perlin_mese = {
offset = 0,
scale = 1,
spread = {x=500, y=500, z=500},
seed = -50001,
octaves = 3,
persist = 0.67
}
local median = df_caverns.config.lava_sea_level
local floor_mult = 60
local floor_displace = -25
local ceiling_mult = -40
local ceiling_displace = 15
local wave_mult = 10
local y_max = median + 2*wave_mult + -2*ceiling_mult + ceiling_displace
local y_min = median - 2*wave_mult - 2*floor_mult + floor_displace
minetest.register_on_generated(function(minp, maxp, seed)
--if out of range of cave definition limits, abort
if minp.y > y_max or maxp.y < y_min then
return
end
local t_start = os.clock()
math.randomseed(minp.x + minp.y*2^8 + minp.z*2^16 + seed) -- make decorations consistent between runs
local vm, data, data_param2, area = mapgen_helper.mapgen_vm_data_param2()
local nvals_cave = mapgen_helper.perlin2d("df_caverns:lava_cave", minp, maxp, perlin_cave)
local nvals_wave = mapgen_helper.perlin2d("df_caverns:lava_wave", minp, maxp, perlin_wave)
local nvals_mese = mapgen_helper.perlin2d("df_caverns:lava_mese", minp, maxp, perlin_mese)
local nvals_lavasurface = mapgen_helper.perlin2d("df_cavern:cracks", minp, maxp, df_caverns.np_cracks)
for vi, x, y, z in area:iterp_yxz(minp, maxp) do
local index2d = mapgen_helper.index2d(minp, maxp, x, z)
local abs_cave = math.abs(nvals_cave[index2d]) -- range is from 0 to approximately 2, with 0 being connected and 2s being islands
local wave = nvals_wave[index2d] * wave_mult
local lava = nvals_lavasurface[index2d]
local floor_height = math.floor(abs_cave * floor_mult + floor_displace + median + wave)
local ceiling_height = math.floor(abs_cave * ceiling_mult + median + ceiling_displace + wave)
local lava_height = math.floor(median + lava * 2)
if y >= floor_height - 2 and y >= ceiling_height and y < ceiling_height + 2 and y <= lava_height + 2 and not mapgen_helper.buildable_to(data[vi]) then
data[vi] = c_obsidian -- obsidian ceiling
elseif y > floor_height and y < ceiling_height then
if y > lava_height then
data[vi] = c_air
else
data[vi] = c_lava
end
elseif y > floor_height - 5 and y < ceiling_height and y <= lava_height + 2 and not mapgen_helper.buildable_to(data[vi]) then
data[vi] = c_obsidian -- thick obsidian floor
elseif y < lava_height and data[vi] == c_air then
data[vi] = c_lava
end
end
-- decoration loop.
for x = minp.x + 1, maxp.x-1 do
for z = minp.z + 1, maxp.z -1 do
local index2d = mapgen_helper.index2d(minp, maxp, x, z)
local mese_intensity = math.abs(nvals_mese[index2d])
local abs_cave = math.abs(nvals_cave[index2d]) -- range is from 0 to approximately 2, with 0 being connected and 2s being islands
local wave = nvals_wave[index2d] * wave_mult
local floor_height = math.floor(abs_cave * floor_mult + floor_displace + median + wave)
local ceiling_height = math.floor(abs_cave * ceiling_mult + median + ceiling_displace + wave)
local lava = nvals_lavasurface[index2d]
local lava_height = math.floor(median + lava * 2)
if mese_intensity > 0.65 and ceiling_height > lava_height + 1 and ceiling_height > floor_height + 1 and ceiling_height <= maxp.y and ceiling_height >= minp.y then
local vi = area:index(x, ceiling_height, z)
if not mapgen_helper.buildable_to(data[vi]) then
-- decorate ceiling
if math.random() < 0.25 then
data[vi] = c_meseore
elseif mese_intensity > 0.75 and math.random() < 0.1 then
data[vi] = c_meseore
local bi = vi-area.ystride
data[bi] = c_mese_crystal
data_param2[bi] = math.random(1,4) + 19
elseif mese_intensity > 0.85 and math.random() < 0.025 then
subterrane.big_stalactite(vi-area.ystride, area, data, 6, 13, c_meseore, c_meseore, c_mese_crystal_block)
end
end
end
end
end
--send data back to voxelmanip
vm:set_data(data)
vm:set_param2_data(data_param2)
--calc lighting
vm:set_lighting({day = 0, night = 0})
vm:calc_lighting()
vm:update_liquids()
--write it to world
vm:write_to_map()
local chunk_generation_time = math.ceil((os.clock() - t_start) * 1000) --grab how long it took
if chunk_generation_time < 1000 then
minetest.log("info", "[df_caverns] lava sea mapblock generation took "..chunk_generation_time.." ms") --tell people how long
else
minetest.log("warning", "[df_caverns] lava sea took "..chunk_generation_time.." ms to generate map block "
.. minetest.pos_to_string(minp) .. minetest.pos_to_string(maxp))
end
end)

274
df_caverns/level1.lua Normal file
View File

@ -0,0 +1,274 @@
local c_water = minetest.get_content_id("default:water_source")
local c_air = minetest.get_content_id("air")
local c_dirt = minetest.get_content_id("default:dirt")
local c_dirt_moss = minetest.get_content_id("df_mapitems:dirt_with_cave_moss")
local c_wet_flowstone = minetest.get_content_id("df_mapitems:wet_flowstone")
local c_dry_flowstone = minetest.get_content_id("df_mapitems:dry_flowstone")
local tower_cap_shrublist
local fungiwood_shrublist
if minetest.get_modpath("df_farming") then
tower_cap_shrublist = {
df_farming.spawn_plump_helmet_vm,
df_farming.spawn_plump_helmet_vm,
df_farming.spawn_dead_fungus_vm,
df_farming.spawn_cavern_fungi_vm,
}
fungiwood_shrublist = {
df_farming.spawn_plump_helmet_vm,
df_farming.spawn_cave_wheat_vm,
df_farming.spawn_cave_wheat_vm,
df_farming.spawn_dead_fungus_vm,
df_farming.spawn_cavern_fungi_vm,
}
end
local subsea_level = df_caverns.config.level1_min - (df_caverns.config.level1_min - df_caverns.config.ymax) * 0.33
local flooding_threshold = math.min(df_caverns.config.tunnel_flooding_threshold, df_caverns.config.cavern_threshold)
local get_biome = function(heat, humidity)
if humidity < 23 then -- about 20% of locations fall below this threshold
return "barren"
elseif heat < 50 then
return "towercap"
else
return "fungiwood"
end
end
local tower_cap_cavern_floor = function(abs_cracks, vert_rand, vi, area, data, data_param2)
local ystride = area.ystride
if abs_cracks < 0.1 then
df_caverns.stalagmites(abs_cracks, vert_rand, vi, area, data, data_param2, true)
elseif data[vi-ystride] ~= c_air and data[vi-ystride] ~= c_water then -- leave the ground as rock if it's only one node thick
if math.random() < 0.25 then
data[vi] = c_dirt
else
data[vi] = c_dirt_moss
end
if math.random() < 0.1 then
df_caverns.place_shrub(vi+ystride, area, data, data_param2, tower_cap_shrublist)
elseif math.random() < 0.01 and abs_cracks > 0.25 then
df_trees.spawn_tower_cap_vm(vi+ystride, area, data)
end
end
end
local fungiwood_cavern_floor = function(abs_cracks, vert_rand, vi, area, data, data_param2)
local ystride = area.ystride
if abs_cracks < 0.1 then
df_caverns.stalagmites(abs_cracks, vert_rand, vi, area, data, data_param2, true)
elseif data[vi-ystride] ~= c_air and data[vi-ystride] ~= c_water then -- leave the ground as rock if it's only one node thick
if math.random() < 0.25 then
data[vi] = c_dirt
else
data[vi] = c_dirt_moss
end
if math.random() < 0.1 then
df_caverns.place_shrub(vi+ystride, area, data, data_param2, fungiwood_shrublist)
elseif math.random() < 0.03 and abs_cracks > 0.35 then
df_trees.spawn_fungiwood_vm(vi+ystride, area, data)
end
end
end
local decorate_level_1 = function(minp, maxp, seed, vm, node_arrays, area, data)
math.randomseed(minp.x + minp.y*2^8 + minp.z*2^16 + seed) -- make decorations consistent between runs
local heatmap = minetest.get_mapgen_object("heatmap")
local humiditymap = minetest.get_mapgen_object("humiditymap")
local data_param2 = df_caverns.data_param2
vm:get_param2_data(data_param2)
local nvals_cracks = mapgen_helper.perlin2d("df_cavern:cracks", minp, maxp, df_caverns.np_cracks)
local nvals_cave = node_arrays.nvals_cave
local cave_area = node_arrays.cave_area
-- Partly fill flooded caverns and warrens
if minp.y <= subsea_level then
for vi in area:iterp(minp, maxp) do
if data[vi] == c_air and area:get_y(vi) <= subsea_level and nvals_cave[cave_area:transform(area, vi)] < -flooding_threshold then
data[vi] = c_water
end
end
end
---------------------------------------------------------
-- Cavern floors
for _, vi in ipairs(node_arrays.cavern_floor_nodes) do
local vert_rand = mapgen_helper.xz_consistent_randomi(area, vi)
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local biome_name = get_biome(heatmap[index2d], humiditymap[index2d])
local abs_cracks = math.abs(nvals_cracks[index2d])
local flooded_caverns = nvals_cave[cave_area:transform(area, vi)] < 0 -- this indicates if we're in the "flooded" set of caves or not.
if minp.y < subsea_level and area:get_y(vi) < subsea_level and flooded_caverns then
-- underwater floor
df_caverns.flooded_cavern_floor(abs_cracks, vert_rand, vi, area, data)
elseif biome_name == "towercap" then
tower_cap_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
elseif biome_name == "fungiwood" then
fungiwood_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
elseif biome_name == "barren" then
if flooded_caverns then
df_caverns.wet_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
else
df_caverns.dry_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
end
end
end
--------------------------------------
-- Cavern ceilings
for _, vi in ipairs(node_arrays.cavern_ceiling_nodes) do
local vert_rand = mapgen_helper.xz_consistent_randomi(area, vi)
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local biome_name = get_biome(heatmap[index2d], humiditymap[index2d])
local abs_cracks = math.abs(nvals_cracks[index2d])
local flooded_caverns = nvals_cave[cave_area:transform(area, vi)] < 0 -- this indicates if we're in the "flooded" set of caves or not.
if flooded_caverns and minp.y < subsea_level and area:get_y(vi) < subsea_level then
-- underwater ceiling, do nothing
elseif biome_name == "barren" then
if flooded_caverns then
-- wet barren
if abs_cracks < 0.1 then
df_caverns.stalactites(abs_cracks, vert_rand, vi, area, data, data_param2, true)
end
else
-- dry barren
if abs_cracks < 0.075 then
df_caverns.stalactites(abs_cracks, vert_rand, vi, area, data, data_param2, false)
end
end
else -- all the other biomes
df_caverns.glow_worm_cavern_ceiling(abs_cracks, vert_rand, vi, area, data, data_param2)
end
end
----------------------------------------------
-- Tunnel floors
for _, vi in ipairs(node_arrays.tunnel_floor_nodes) do
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local biome_name = get_biome(heatmap[index2d], humiditymap[index2d])
local flooded_caverns = nvals_cave[cave_area:transform(area, vi)] < 0 -- this indicates if we're in the "flooded" set of caves or not.
if not (flooded_caverns and minp.y < subsea_level and area:get_y(vi) < subsea_level) then
if flooded_caverns or biome_name ~= "barren" then
-- we're in flooded areas or are not barren
df_caverns.tunnel_floor(minp, maxp, area, vi, nvals_cracks, data, data_param2, true)
else
df_caverns.tunnel_floor(minp, maxp, area, vi, nvals_cracks, data, data_param2, false)
end
end
end
------------------------------------------------------
-- Tunnel ceiling
for _, vi in ipairs(node_arrays.tunnel_ceiling_nodes) do
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local biome_name = get_biome(heatmap[index2d], humiditymap[index2d])
local flooded_caverns = nvals_cave[cave_area:transform(area, vi)] < 0 -- this indicates if we're in the "flooded" set of caves or not.
if not (flooded_caverns and minp.y < subsea_level and area:get_y(vi) < subsea_level) then
if flooded_caverns or biome_name ~= "barren" then
-- we're in flooded areas or are not barren
df_caverns.tunnel_ceiling(minp, maxp, area, vi, nvals_cracks, data, data_param2, true)
else
df_caverns.tunnel_ceiling(minp, maxp, area, vi, nvals_cracks, data, data_param2, false)
end
else
-- air pockets
local ystride = area.ystride
local cracks = nvals_cracks[index2d]
if cracks > 0.5 and data[vi-ystride] == c_water then
data[vi-ystride] = c_air
if cracks > 0.7 and data[vi-ystride*2] == c_water then
data[vi-ystride*2] = c_air
end
end
end
end
----------------------------------------------
-- Warren floors
for _, vi in ipairs(node_arrays.warren_floor_nodes) do
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local biome_name = get_biome(heatmap[index2d], humiditymap[index2d])
local flooded_caverns = nvals_cave[cave_area:transform(area, vi)] < 0 -- this indicates if we're in the "flooded" set of caves or not.
if not (flooded_caverns and minp.y < subsea_level and area:get_y(vi) < subsea_level) then
if flooded_caverns or biome_name ~= "barren" then
-- we're in flooded areas or are not barren
df_caverns.tunnel_floor(minp, maxp, area, vi, nvals_cracks, data, data_param2, true)
else
df_caverns.tunnel_floor(minp, maxp, area, vi, nvals_cracks, data, data_param2, false)
end
end
end
------------------------------------------------------
-- Warren ceiling
for _, vi in ipairs(node_arrays.warren_ceiling_nodes) do
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local biome_name = get_biome(heatmap[index2d], humiditymap[index2d])
local flooded_caverns = nvals_cave[cave_area:transform(area, vi)] < 0 -- this indicates if we're in the "flooded" set of caves or not.
if not (flooded_caverns and minp.y < subsea_level and area:get_y(vi) < subsea_level) then
if flooded_caverns or biome_name ~= "barren" then
-- we're in flooded areas or are not barren
df_caverns.tunnel_ceiling(minp, maxp, area, vi, nvals_cracks, data, data_param2, true)
else
df_caverns.tunnel_ceiling(minp, maxp, area, vi, nvals_cracks, data, data_param2, false)
end
end
-- else air pockets?
end
----------------------------------------------
-- Column material override for dry biome
for _, vi in ipairs(node_arrays.column_nodes) do
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local biome_name = get_biome(heatmap[index2d], humiditymap[index2d])
local dry = (biome_name == "barren") and (nvals_cave[cave_area:transform(area, vi)] > 0)
if dry and data[vi] == c_wet_flowstone then
data[vi] = c_dry_flowstone
end
end
vm:set_param2_data(data_param2)
end
-------------------------------------------------------------------------------------------
subterrane.register_layer({
name = "cavern layer 1",
y_max = df_caverns.config.ymax,
y_min = df_caverns.config.level1_min,
cave_threshold = df_caverns.config.cavern_threshold,
boundary_blend_range = 64, -- range near ymin and ymax over which caves diminish to nothing
perlin_cave = df_caverns.perlin_cave,
perlin_wave = df_caverns.perlin_wave,
solidify_lava = true,
columns = {
maximum_radius = 10,
minimum_radius = 4,
node = "df_mapitems:wet_flowstone",
weight = 0.25,
maximum_count = 50,
minimum_count = 0,
},
decorate = decorate_level_1,
warren_region_variability_threshold = 0.33,
double_frequency = true,
})

341
df_caverns/level2.lua Normal file
View File

@ -0,0 +1,341 @@
local c_water = minetest.get_content_id("default:water_source")
local c_air = minetest.get_content_id("air")
local c_dirt = minetest.get_content_id("default:dirt")
local c_dirt_moss = minetest.get_content_id("df_mapitems:dirt_with_cave_moss")
local c_wet_flowstone = minetest.get_content_id("df_mapitems:wet_flowstone")
local c_dry_flowstone = minetest.get_content_id("df_mapitems:dry_flowstone")
local c_veinstone = minetest.get_content_id("df_mapitems:veinstone")
local wall_vein_perlin_params = {
offset = 0,
scale = 1,
spread = {x = 50, y = 50, z = 50},
seed = 2199,
octaves = 3,
persist = 0.63,
lacunarity = 2.0,
flags = "eased",
}
local subsea_level = df_caverns.config.level2_min - (df_caverns.config.level2_min - df_caverns.config.level1_min) * 0.33 -- "sea level" for the flooded caverns.
local flooding_threshold = math.min(df_caverns.config.tunnel_flooding_threshold, df_caverns.config.cavern_threshold) -- cavern value out to which we're flooding tunnels and warrens
local get_biome = function(heat, humidity)
if humidity < 23 then -- about 20% of locations fall below this threshold
return "barren"
elseif heat < 40 then
return "goblincap" -- about 33% are below this threshold
elseif heat < 60 then
return "sporetree" -- another 33%
else
return "tunneltube"
end
end
local goblin_cap_shrublist
local tunnel_tube_shrublist
local spore_tree_shrublist
if minetest.get_modpath("df_farming") then
goblin_cap_shrublist = {
df_farming.spawn_plump_helmet_vm,
df_farming.spawn_plump_helmet_vm,
df_farming.spawn_dead_fungus_vm,
df_farming.spawn_cavern_fungi_vm,
}
tunnel_tube_shrublist = {
df_farming.spawn_sweet_pod_vm,
df_farming.spawn_cave_wheat_vm,
df_farming.spawn_cave_wheat_vm,
df_farming.spawn_dead_fungus_vm,
df_farming.spawn_cavern_fungi_vm,
}
spore_tree_shrublist = {
df_farming.spawn_pig_tail_vm,
df_farming.spawn_pig_tail_vm,
df_farming.spawn_cave_wheat_vm,
df_farming.spawn_dead_fungus_vm,
df_farming.spawn_cavern_fungi_vm,
}
end
local goblin_cap_cavern_floor = function(abs_cracks, vert_rand, vi, area, data, data_param2)
local ystride = area.ystride
if abs_cracks < 0.1 then
df_caverns.stalagmites(abs_cracks, vert_rand, vi, area, data, data_param2, true)
elseif data[vi-ystride] ~= c_air then -- leave the ground as rock if it's only one node thick
if math.random() < 0.25 then
data[vi] = c_dirt
else
data[vi] = c_dirt_moss
end
if math.random() < 0.1 then
df_caverns.place_shrub(vi+ystride, area, data, data_param2, goblin_cap_shrublist)
elseif math.random() < 0.015 then
df_trees.spawn_goblin_cap_vm(vi+ystride, area, data)
end
end
end
local spore_tree_cavern_floor = function(abs_cracks, vert_rand, vi, area, data, data_param2)
local ystride = area.ystride
if abs_cracks < 0.1 then
df_caverns.stalagmites(abs_cracks, vert_rand, vi, area, data, data_param2, true)
elseif data[vi-ystride] ~= c_air then -- leave the ground as rock if it's only one node thick
if math.random() < 0.25 then
data[vi] = c_dirt
else
data[vi] = c_dirt_moss
end
if math.random() < 0.1 then
df_caverns.place_shrub(vi+ystride, area, data, data_param2, spore_tree_shrublist)
elseif math.random() < 0.05 then
df_trees.spawn_spore_tree_vm(vi+ystride, area, data)
end
end
end
local tunnel_tube_cavern_floor = function(abs_cracks, vert_rand, vi, area, data, data_param2)
local ystride = area.ystride
if abs_cracks < 0.1 then
df_caverns.stalagmites(abs_cracks, vert_rand, vi, area, data, data_param2, true)
elseif data[vi-ystride] ~= c_air then -- leave the ground as rock if it's only one node thick
if math.random() < 0.25 then
data[vi] = c_dirt
else
data[vi] = c_dirt_moss
end
if math.random() < 0.1 then
df_caverns.place_shrub(vi+ystride, area, data, data_param2, tunnel_tube_shrublist)
elseif math.random() < 0.05 then
df_trees.spawn_tunnel_tube_vm(vi+ystride, area, data, data_param2)
end
end
end
local decorate_level_2 = function(minp, maxp, seed, vm, node_arrays, area, data)
math.randomseed(minp.x + minp.y*2^8 + minp.z*2^16 + seed) -- make decorations consistent between runs
local heatmap = minetest.get_mapgen_object("heatmap")
local humiditymap = minetest.get_mapgen_object("humiditymap")
local data_param2 = df_caverns.data_param2
vm:get_param2_data(data_param2)
local nvals_cracks = mapgen_helper.perlin2d("df_cavern:cracks", minp, maxp, df_caverns.np_cracks)
local nvals_cave = node_arrays.nvals_cave
local cave_area = node_arrays.cave_area
local cavern_def = node_arrays.cavern_def
local vein_noise
-- Partly fill flooded caverns and warrens
for vi in area:iterp(minp, maxp) do
local cave_val = nvals_cave[cave_area:transform(area, vi)]
if cave_val < -flooding_threshold then
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local biome_name = get_biome(heatmap[index2d], humiditymap[index2d])
local cave_threshold = cavern_def.cave_threshold
--check if we're just inside the boundary of the (negazone) cavern threshold
if biome_name == "barren" and cave_val < -cave_threshold and cave_val > -cave_threshold - 0.01 then
-- add giant rooty structures to the flooded barren caverns
if vein_noise == nil then
vein_noise = mapgen_helper.perlin3d("df_caverns:wall_veins", minp, maxp, wall_vein_perlin_params)
end
-- we can reuse cave_area here, its extents are minp, maxp too.
if data[vi] == c_air and math.abs(vein_noise[cave_area:transform(area, vi)]) < 0.02 then
data[vi] = c_veinstone
end
end
if data[vi] == c_air and area:get_y(vi) <= subsea_level then
data[vi] = c_water -- otherwise, fill air with water when below sea level
end
end
end
---------------------------------------------------------
-- Cavern floors
for _, vi in ipairs(node_arrays.cavern_floor_nodes) do
local vert_rand = mapgen_helper.xz_consistent_randomi(area, vi)
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local biome_name = get_biome(heatmap[index2d], humiditymap[index2d])
local abs_cracks = math.abs(nvals_cracks[index2d])
local flooded_caverns = nvals_cave[cave_area:transform(area, vi)] < 0 -- this indicates if we're in the "flooded" set of caves or not.
if minp.y < subsea_level and area:get_y(vi) < subsea_level and flooded_caverns then
-- underwater floor
df_caverns.flooded_cavern_floor(abs_cracks, vert_rand, vi, area, data)
elseif biome_name == "barren" then
if flooded_caverns then
df_caverns.wet_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
else
df_caverns.dry_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
end
elseif biome_name == "goblincap" then
goblin_cap_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
elseif biome_name == "sporetree" then
spore_tree_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
elseif biome_name == "tunneltube" then
tunnel_tube_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
end
end
--------------------------------------
-- Cavern ceilings
for _, vi in ipairs(node_arrays.cavern_ceiling_nodes) do
local vert_rand = mapgen_helper.xz_consistent_randomi(area, vi)
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local biome_name = get_biome(heatmap[index2d], humiditymap[index2d])
local abs_cracks = math.abs(nvals_cracks[index2d])
local flooded_caverns = nvals_cave[cave_area:transform(area, vi)] < 0 -- this indicates if we're in the "flooded" set of caves or not.
if flooded_caverns and minp.y < subsea_level and area:get_y(vi) < subsea_level then
-- underwater ceiling, do nothing
elseif biome_name == "barren" then
if flooded_caverns then
-- wet barren
if abs_cracks < 0.1 then
df_caverns.stalactites(abs_cracks, vert_rand, vi, area, data, data_param2, true)
end
else
-- dry barren
if abs_cracks < 0.075 then
df_caverns.stalactites(abs_cracks, vert_rand, vi, area, data, data_param2, false)
end
local y = area:get_y(vi)
local y_proportional = (y - df_caverns.config.level1_min) / (df_caverns.config.level2_min - df_caverns.config.level1_min)
if abs_cracks * y_proportional > 0.3 and math.random() < 0.005 * y_proportional then
df_mapitems.place_big_crystal_cluster(area, data, data_param2, vi, math.random(0,1), true)
end
end
else -- all the other biomes
df_caverns.glow_worm_cavern_ceiling(abs_cracks, vert_rand, vi, area, data, data_param2)
end
end
----------------------------------------------
-- Tunnel floors
for _, vi in ipairs(node_arrays.tunnel_floor_nodes) do
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local biome_name = get_biome(heatmap[index2d], humiditymap[index2d])
local flooded_caverns = nvals_cave[cave_area:transform(area, vi)] < 0 -- this indicates if we're in the "flooded" set of caves or not.
if not (flooded_caverns and minp.y < subsea_level and area:get_y(vi) < subsea_level) then
if flooded_caverns or biome_name ~= "barren" then
-- we're in flooded areas or are not barren
df_caverns.tunnel_floor(minp, maxp, area, vi, nvals_cracks, data, data_param2, true)
else
df_caverns.tunnel_floor(minp, maxp, area, vi, nvals_cracks, data, data_param2, false)
end
end
end
------------------------------------------------------
-- Tunnel ceiling
for _, vi in ipairs(node_arrays.tunnel_ceiling_nodes) do
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local biome_name = get_biome(heatmap[index2d], humiditymap[index2d])
local flooded_caverns = nvals_cave[cave_area:transform(area, vi)] < 0 -- this indicates if we're in the "flooded" set of caves or not.
if not (flooded_caverns and minp.y < subsea_level and area:get_y(vi) < subsea_level) then
if flooded_caverns or biome_name ~= "barren" then
-- we're in flooded areas or are not barren
df_caverns.tunnel_ceiling(minp, maxp, area, vi, nvals_cracks, data, data_param2, true)
else
df_caverns.tunnel_ceiling(minp, maxp, area, vi, nvals_cracks, data, data_param2, false)
end
else
-- air pockets
local ystride = area.ystride
local cracks = nvals_cracks[index2d]
if cracks > 0.5 and data[vi-ystride] == c_water then
data[vi-ystride] = c_air
if cracks > 0.7 and data[vi-ystride*2] == c_water then
data[vi-ystride*2] = c_air
end
end
end
end
----------------------------------------------
-- Warren floors
for _, vi in ipairs(node_arrays.warren_floor_nodes) do
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local biome_name = get_biome(heatmap[index2d], humiditymap[index2d])
local flooded_caverns = nvals_cave[cave_area:transform(area, vi)] < 0 -- this indicates if we're in the "flooded" set of caves or not.
if not (flooded_caverns and minp.y < subsea_level and area:get_y(vi) < subsea_level) then
if flooded_caverns or biome_name ~= "barren" then
-- we're in flooded areas or are not barren
df_caverns.tunnel_floor(minp, maxp, area, vi, nvals_cracks, data, data_param2, true)
else
df_caverns.tunnel_floor(minp, maxp, area, vi, nvals_cracks, data, data_param2, false)
end
end
end
------------------------------------------------------
-- Warren ceiling
for _, vi in ipairs(node_arrays.warren_ceiling_nodes) do
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local biome_name = get_biome(heatmap[index2d], humiditymap[index2d])
local flooded_caverns = nvals_cave[cave_area:transform(area, vi)] < 0 -- this indicates if we're in the "flooded" set of caves or not.
if not (flooded_caverns and minp.y < subsea_level and area:get_y(vi) < subsea_level) then
if flooded_caverns or biome_name ~= "barren" then
-- we're in flooded areas or are not barren
df_caverns.tunnel_ceiling(minp, maxp, area, vi, nvals_cracks, data, data_param2, true)
else
df_caverns.tunnel_ceiling(minp, maxp, area, vi, nvals_cracks, data, data_param2, false)
end
end
-- else air pockets?
end
----------------------------------------------
-- Column material override for dry biome
for _, vi in ipairs(node_arrays.column_nodes) do
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local biome_name = get_biome(heatmap[index2d], humiditymap[index2d])
local dry = (biome_name == "barren") and (nvals_cave[cave_area:transform(area, vi)] > 0)
if dry and data[vi] == c_wet_flowstone then
data[vi] = c_dry_flowstone
end
end
vm:set_param2_data(data_param2)
end
subterrane.register_layer({
name = "cavern layer 2",
y_max = df_caverns.config.level1_min-1,
y_min = df_caverns.config.level2_min,
cave_threshold = df_caverns.config.cavern_threshold,
boundary_blend_range = 64, -- range near ymin and ymax over which caves diminish to nothing
perlin_cave = df_caverns.perlin_cave,
perlin_wave = df_caverns.perlin_wave,
solidify_lava = true,
columns = {
maximum_radius = 15,
minimum_radius = 4,
node = "df_mapitems:wet_flowstone",
weight = 0.25,
maximum_count = 50,
minimum_count = 5,
},
decorate = decorate_level_2,
warren_region_variability_threshold = 0.33,
double_frequency = true,
})

510
df_caverns/level3.lua Normal file
View File

@ -0,0 +1,510 @@
local c_water = minetest.get_content_id("default:water_source")
local c_air = minetest.get_content_id("air")
local c_desert_sand = minetest.get_content_id("default:desert_sand")
local c_stone_with_coal = minetest.get_content_id("default:stone_with_coal")
local c_silver_sand = minetest.get_content_id("default:silver_sand")
local c_snow = minetest.get_content_id("default:snow")
local c_ice = minetest.get_content_id("default:ice")
local c_hoar_moss = minetest.get_content_id("df_mapitems:ice_with_hoar_moss")
local c_gravel = minetest.get_content_id("default:gravel")
local c_oil = minetest.get_content_id("oil:oil_source")
local c_cobble_fungus_fine = minetest.get_content_id("df_mapitems:cobble_with_floor_fungus_fine")
local c_cobble_fungus = minetest.get_content_id("df_mapitems:cobble_with_floor_fungus")
local c_cobble = minetest.get_content_id("default:cobble")
local c_wet_flowstone = minetest.get_content_id("df_mapitems:wet_flowstone")
local c_dry_flowstone = minetest.get_content_id("df_mapitems:dry_flowstone")
local c_glow_ore = minetest.get_content_id("df_mapitems:glow_ruby_ore")
local c_sprite
if minetest.get_modpath("ice_sprites") then
c_sprite = minetest.get_content_id("ice_sprites:ice_sprite")
end
local subsea_level = df_caverns.config.level3_min - (df_caverns.config.level3_min - df_caverns.config.level2_min) * 0.33
local flooding_threshold = math.min(df_caverns.config.tunnel_flooding_threshold, df_caverns.config.cavern_threshold)
local ice_thickness = 3
local get_biome = function(heat, humidity)
if humidity < 23 then -- about 20% of locations fall below this threshold
return "barren"
elseif heat < 50 then
return "blackcap"
else
return "bloodnether"
end
end
local black_cap_shrublist
local nether_cap_shrublist
local blood_thorn_shrublist
if minetest.get_modpath("df_farming") then
black_cap_shrublist = {
df_farming.spawn_dead_fungus_vm,
}
nether_cap_shrublist = {
df_farming.spawn_dead_fungus_vm,
df_farming.spawn_dead_fungus_vm,
df_farming.spawn_dead_fungus_vm,
df_farming.spawn_cavern_fungi_vm,
}
blood_thorn_shrublist = {
df_farming.spawn_quarry_bush_vm,
df_farming.spawn_dead_fungus_vm,
df_farming.spawn_dead_fungus_vm,
}
end
local hoar_moss_perlin_params = {
offset = 0,
scale = 1,
spread = {x = 3, y = 30, z = 3},
seed = 345421,
octaves = 3,
persist = 0.63,
lacunarity = 2.0,
flags = "eased",
}
local black_cap_cavern_floor = function(abs_cracks, vert_rand, vi, area, data, data_param2)
if math.random() < 0.25 then
data[vi] = c_stone_with_coal
else
data[vi] = c_cobble_fungus
end
if abs_cracks < 0.1 then
df_caverns.stalagmites(abs_cracks, vert_rand, vi, area, data, data_param2, false)
elseif abs_cracks < 0.15 and math.random() < 0.3 then
df_trees.spawn_torchspine_vm(vi+area.ystride, area, data, data_param2)
else
if math.random() < 0.05 then
df_caverns.place_shrub(vi+area.ystride, area, data, data_param2, black_cap_shrublist)
elseif math.random() < 0.01 and abs_cracks > 0.25 then
df_trees.spawn_black_cap_vm(vi+area.ystride, area, data)
end
end
end
local nether_cap_cavern_floor = function(cracks, abs_cracks, vert_rand, vi, area, data, data_param2)
local ystride = area.ystride
if abs_cracks < 0.1 then
if vert_rand < 0.004 then
subterrane.big_stalagmite(vi+ystride, area, data, 6, 15, c_ice, c_ice, c_ice)
else
local param2 = abs_cracks*1000000 - math.floor(abs_cracks*1000000/4)*4
local height = abs_cracks * 50
if vert_rand > 0.5 then
subterrane.stalagmite(vi+ystride, area, data, data_param2, param2, math.floor(height), df_mapitems.icicle_ids)
else
subterrane.stalagmite(vi+ystride, area, data, data_param2, param2, math.floor(height*0.5), df_mapitems.dry_stalagmite_ids)
end
end
end
if cracks < -0.3 then
data[vi] = c_silver_sand
if math.random() < 0.025 then
df_trees.spawn_nether_cap_vm(vi+ystride, area, data)
elseif math.random() < 0.05 then
df_caverns.place_shrub(vi+ystride, area, data, data_param2, nether_cap_shrublist)
elseif cracks < -0.4 and cracks > -0.6 then
data[vi + ystride] = c_snow
end
elseif cracks > 0.1 then
if math.random() < 0.002 then
df_trees.spawn_nether_cap_vm(vi+ystride, area, data)
else
data[vi] = c_ice
end
if cracks > 0.4 then
data[vi + ystride] = c_ice
if cracks > 0.6 then
data[vi + 2*ystride] = c_ice
end
end
end
end
local nether_cap_cavern_ceiling = function(abs_cracks, vert_rand, vi, area, data, data_param2)
local ystride = area.ystride
if abs_cracks < 0.1 then
if vert_rand < 0.01 then
subterrane.big_stalactite(vi-ystride, area, data, 6, 15, c_ice, c_ice, c_ice)
else
local param2 = abs_cracks*1000000 - math.floor(abs_cracks*1000000/4)*4
local height = abs_cracks * 50
if vert_rand > 0.5 then
subterrane.stalactite(vi-ystride, area, data, data_param2, param2, math.floor(height), df_mapitems.icicle_ids)
else
subterrane.stalactite(vi-ystride, area, data, data_param2, param2, math.floor(height*0.5), df_mapitems.dry_stalagmite_ids)
end
end
end
if c_sprite and abs_cracks < 0.5 and math.random() < 0.02 then
local sprite_vi = vi-ystride*math.random(1,5)
if data[sprite_vi] == c_air and area:containsi(sprite_vi) then
data[sprite_vi] = c_sprite
minetest.get_node_timer(area:position(sprite_vi)):start(1)
end
end
end
local blood_thorn_cavern_floor = function(abs_cracks, vert_rand, vi, area, data, data_param2)
if abs_cracks < 0.075 then
if vert_rand < 0.004 then
subterrane.big_stalagmite(vi+area.ystride, area, data, 6, 15, c_dry_flowstone, c_dry_flowstone, c_dry_flowstone)
else
local param2 = abs_cracks*1000000 - math.floor(abs_cracks*1000000/4)*4
local height = math.floor(abs_cracks * 66)
subterrane.stalagmite(vi+area.ystride, area, data, data_param2, param2, height, df_mapitems.dry_stalagmite_ids)
end
elseif math.random() > abs_cracks + 0.66 then
df_trees.spawn_blood_thorn_vm(vi+area.ystride, area, data, data_param2)
data[vi] = c_desert_sand
else
if math.random() < 0.1 then
df_caverns.place_shrub(vi+area.ystride, area, data, data_param2, blood_thorn_shrublist)
data[vi] = c_desert_sand
elseif math.random() > 0.25 then
data[vi] = c_desert_sand
else
data[vi] = c_cobble
end
end
end
local hoar_moss_generator
local decorate_level_3 = function(minp, maxp, seed, vm, node_arrays, area, data)
math.randomseed(minp.x + minp.y*2^8 + minp.z*2^16 + seed) -- make decorations consistent between runs
local heatmap = minetest.get_mapgen_object("heatmap")
local humiditymap = minetest.get_mapgen_object("humiditymap")
local data_param2 = df_caverns.data_param2
vm:get_param2_data(data_param2)
local nvals_cracks = mapgen_helper.perlin2d("df_cavern:cracks", minp, maxp, df_caverns.np_cracks)
local nvals_cave = node_arrays.nvals_cave
local cave_area = node_arrays.cave_area
local cavern_def = node_arrays.cavern_def
-- Partly fill flooded caverns and warrens
if minp.y <= subsea_level then
for vi in area:iterp(minp, maxp) do
local y = area:get_y(vi)
if y <= subsea_level and nvals_cave[cave_area:transform(area, vi)] < -flooding_threshold then
if data[vi] == c_air and y <= subsea_level then
data[vi] = c_water
end
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local biome_name = get_biome(heatmap[index2d], humiditymap[index2d])
if biome_name == "blackcap" then
-- oil slick
local cave = math.abs(nvals_cave[cave_area:transform(area, vi)])
if y == subsea_level and data[vi] == c_water and cave + nvals_cracks[index2d]*0.025 < cavern_def.cave_threshold + 0.1 then
data[vi] = c_oil
end
elseif biome_name == "bloodnether" and y <= subsea_level and y > subsea_level - ice_thickness and data[vi] == c_water then
-- floating ice
data[vi] = c_ice
end
end
end
end
---------------------------------------------------------
-- Cavern floors
for _, vi in ipairs(node_arrays.cavern_floor_nodes) do
local vert_rand = mapgen_helper.xz_consistent_randomi(area, vi)
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local biome_name = get_biome(heatmap[index2d], humiditymap[index2d])
local cracks = nvals_cracks[index2d]
local abs_cracks = math.abs(cracks)
local flooded_caverns = nvals_cave[cave_area:transform(area, vi)] < 0 -- this indicates if we're in the "flooded" set of caves or not.
if flooded_caverns and minp.y < subsea_level and area:get_y(vi) < subsea_level then
-- underwater floor
local ystride = area.ystride
if abs_cracks > 0.25 and data[vi-ystride] ~= c_water then
data[vi] = c_gravel
end
-- put in only the large stalagmites that won't get in the way of the water
if abs_cracks < 0.1 then
if vert_rand < 0.004 then
subterrane.big_stalagmite(vi+ystride, area, data, 6, 15, c_wet_flowstone, c_wet_flowstone, c_wet_flowstone)
end
end
elseif biome_name == "barren" then
if flooded_caverns then
-- wet zone floor
df_caverns.dry_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
else
-- dry zone floor, add crystals
if abs_cracks < 0.075 then
df_caverns.stalagmites(abs_cracks, vert_rand, vi, area, data, data_param2, false)
elseif abs_cracks > 0.3 and math.random() < 0.005 then
df_mapitems.place_big_crystal_cluster(area, data, data_param2, vi+area.ystride, math.random(0,2), false)
end
end
elseif biome_name == "blackcap" then
black_cap_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
elseif biome_name == "bloodnether" then
if flooded_caverns then
nether_cap_cavern_floor(cracks, abs_cracks, vert_rand, vi, area, data, data_param2)
else
blood_thorn_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
end
end
end
--------------------------------------
-- Cavern ceilings
for _, vi in ipairs(node_arrays.cavern_ceiling_nodes) do
local vert_rand = mapgen_helper.xz_consistent_randomi(area, vi)
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local biome_name = get_biome(heatmap[index2d], humiditymap[index2d])
local abs_cracks = math.abs(nvals_cracks[index2d])
local flooded_caverns = nvals_cave[cave_area:transform(area, vi)] < 0 -- this indicates if we're in the "flooded" set of caves or not.
if flooded_caverns and minp.y < subsea_level and area:get_y(vi) < subsea_level then
-- underwater ceiling, do nothing
elseif biome_name == "blackcap" then
if abs_cracks < 0.1 then
df_caverns.stalactites(abs_cracks, vert_rand, vi, area, data, data_param2, false)
end
if math.random() < 0.25 then
data[vi] = c_stone_with_coal
end
elseif biome_name == "barren" then
if flooded_caverns then
-- wet zone ceiling
if abs_cracks < 0.1 then
df_caverns.stalactites(abs_cracks, vert_rand, vi, area, data, data_param2, true)
end
else
-- dry zone ceiling, add crystals
if abs_cracks < 0.1 then
df_caverns.stalactites(abs_cracks, vert_rand, vi, area, data, data_param2, false)
end
if abs_cracks > 0.3 and math.random() < 0.005 then
df_mapitems.place_big_crystal_cluster(area, data, data_param2, vi, math.random(0,3), true)
end
end
elseif biome_name == "bloodnether" then
if flooded_caverns then
--Nethercap ceiling
nether_cap_cavern_ceiling(abs_cracks, vert_rand, vi, area, data, data_param2)
else
-- bloodthorn ceiling
if abs_cracks < 0.075 then
df_caverns.stalactites(abs_cracks, vert_rand, vi, area, data, data_param2, false)
elseif abs_cracks > 0.75 and math.random() < 0.05 then
data[vi] = c_glow_ore
df_mapitems.place_big_crystal(data, data_param2, vi-area.ystride, true)
end
end
end
end
----------------------------------------------
-- Tunnel floors
for _, vi in ipairs(node_arrays.tunnel_floor_nodes) do
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local biome_name = get_biome(heatmap[index2d], humiditymap[index2d])
local flooded_caverns = nvals_cave[cave_area:transform(area, vi)] < 0 -- this indicates if we're in the "flooded" set of caves or not.
if not (flooded_caverns and minp.y < subsea_level and area:get_y(vi) < subsea_level) then
if flooded_caverns or biome_name == "blackcap" then
-- we're in flooded areas or are not barren
df_caverns.tunnel_floor(minp, maxp, area, vi, nvals_cracks, data, data_param2, true)
else
df_caverns.tunnel_floor(minp, maxp, area, vi, nvals_cracks, data, data_param2, false)
end
end
end
------------------------------------------------------
-- Tunnel ceiling
for _, vi in ipairs(node_arrays.tunnel_ceiling_nodes) do
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local biome_name = get_biome(heatmap[index2d], humiditymap[index2d])
local flooded_caverns = nvals_cave[cave_area:transform(area, vi)] < 0 -- this indicates if we're in the "flooded" set of caves or not.
if not (flooded_caverns and minp.y < subsea_level and area:get_y(vi) < subsea_level) then
if flooded_caverns or biome_name == "blackcap" then
-- we're in flooded areas or are not barren
df_caverns.tunnel_ceiling(minp, maxp, area, vi, nvals_cracks, data, data_param2, true)
else
df_caverns.tunnel_ceiling(minp, maxp, area, vi, nvals_cracks, data, data_param2, false)
end
else
-- air pockets
local ystride = area.ystride
local cracks = nvals_cracks[index2d]
if cracks > 0.5 and data[vi-ystride] == c_water then
data[vi-ystride] = c_air
if cracks > 0.7 and data[vi-ystride*2] == c_water then
data[vi-ystride*2] = c_air
end
end
end
end
------------------------------------------------------
-- Warren ceiling
for _, vi in ipairs(node_arrays.warren_ceiling_nodes) do
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local biome_name = get_biome(heatmap[index2d], humiditymap[index2d])
local flooded_caverns = nvals_cave[cave_area:transform(area, vi)] < 0 -- this indicates if we're in the "flooded" set of caves or not.
if flooded_caverns and minp.y < subsea_level and area:get_y(vi) < subsea_level then
-- underwater ceiling, do nothing
elseif biome_name == "bloodnether" and flooded_caverns then
-- Nethercap warrens
local cracks = nvals_cracks[index2d]
local abs_cracks = math.abs(cracks)
local vert_rand = mapgen_helper.xz_consistent_randomi(area, vi)
local ystride = area.ystride
if abs_cracks < 0.15 then
if vert_rand < 0.004 then
subterrane.big_stalactite(vi-ystride, area, data, 6, 15, c_ice, c_ice, c_ice)
else
local param2 = abs_cracks*1000000 - math.floor(abs_cracks*1000000/4)*4
local height = abs_cracks * 50
if vert_rand > 0.5 then
subterrane.stalactite(vi-ystride, area, data, data_param2, param2, math.floor(height), df_mapitems.icicle_ids)
else
subterrane.stalactite(vi-ystride, area, data, data_param2, param2, math.floor(height*0.5), df_mapitems.dry_stalagmite_ids)
end
end
end
else
if flooded_caverns or biome_name == "blackcap" then
df_caverns.tunnel_ceiling(minp, maxp, area, vi, nvals_cracks, data, data_param2, true)
else
df_caverns.tunnel_ceiling(minp, maxp, area, vi, nvals_cracks, data, data_param2, false)
end
end
end
----------------------------------------------
-- Warren floors
for _, vi in ipairs(node_arrays.warren_floor_nodes) do
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local biome_name = get_biome(heatmap[index2d], humiditymap[index2d])
local flooded_caverns = nvals_cave[cave_area:transform(area, vi)] < 0 -- this indicates if we're in the "flooded" set of caves or not.
if minp.y < subsea_level and area:get_y(vi) < subsea_level and flooded_caverns then
-- underwater floor, do nothing
elseif biome_name == "bloodnether" and flooded_caverns then
-- nethercap warren
local cracks = nvals_cracks[index2d]
local abs_cracks = math.abs(cracks)
local vert_rand = mapgen_helper.xz_consistent_randomi(area, vi)
local ystride = area.ystride
if abs_cracks < 0.15 then
if vert_rand < 0.004 then
subterrane.big_stalagmite(vi+ystride, area, data, 6, 15, c_ice, c_ice, c_ice)
else
local param2 = abs_cracks*1000000 - math.floor(abs_cracks*1000000/4)*4
local height =abs_cracks * 50
if vert_rand > 0.5 then
subterrane.stalagmite(vi+ystride, area, data, data_param2, param2, math.floor(height), df_mapitems.icicle_ids)
else
subterrane.stalagmite(vi+ystride, area, data, data_param2, param2, math.floor(height*0.5), df_mapitems.dry_stalagmite_ids)
end
end
elseif cracks > 0.4 then
data[vi + ystride] = c_ice
if cracks > 0.6 then
data[vi + 2*ystride] = c_ice
end
end
else
if flooded_caverns or biome_name == "blackcap" then
df_caverns.tunnel_floor(minp, maxp, area, vi, nvals_cracks, data, data_param2, true)
else
df_caverns.tunnel_floor(minp, maxp, area, vi, nvals_cracks, data, data_param2, false)
end
end
end
----------------------------------------------
-- Column material override for dry biome
for _, vi in ipairs(node_arrays.column_nodes) do
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local biome_name = get_biome(heatmap[index2d], humiditymap[index2d])
local flooded_caverns = nvals_cave[cave_area:transform(area, vi)] < 0
if biome_name == "bloodnether" and data[vi] == c_wet_flowstone then
if not flooded_caverns then
data[vi] = c_dry_flowstone -- bloodthorn
else
if area:get_y(vi) > subsea_level - ice_thickness then
if data[vi + 1] == c_air or data[vi - 1] == c_air or data[vi + area.zstride] == c_air or data[vi - area.zstride] == c_air then
--surface node, potential hoar moss streak
-- This particular Perlin noise is only called in small amounts on rare occasions, so don't bother
-- with the full blown generated array rigamarole.
hoar_moss_generator = hoar_moss_generator or minetest.get_perlin(hoar_moss_perlin_params)
local pos = area:position(vi)
if hoar_moss_generator.get_3d and hoar_moss_generator:get_3d({x=pos.z, y=pos.y, z=pos.x}) > 0.5 then -- TODO: version 0.4.16 gets no hoar moss
data[vi] = c_hoar_moss
else
data[vi] = c_ice
end
else
data[vi] = c_ice
end
else
data[vi] = c_water -- ice columns shouldn't extend below the surface of the water. There should probably be a bulge below, though. Not sure best way to implement that.
end
end
elseif biome_name == "barren" and not flooded_caverns and data[vi] == c_wet_flowstone then
data[vi] = c_dry_flowstone
end
end
vm:set_param2_data(data_param2)
end
-- Layer 3
subterrane.register_layer({
name = "cavern layer 3",
y_max = df_caverns.config.level2_min-1,
y_min = df_caverns.config.level3_min,
cave_threshold = df_caverns.config.cavern_threshold,
boundary_blend_range = 64, -- range near ymin and ymax over which caves diminish to nothing
perlin_cave = df_caverns.perlin_cave,
perlin_wave = df_caverns.perlin_wave,
solidify_lava = true,
columns = {
maximum_radius = 20,
minimum_radius = 5,
node = "df_mapitems:wet_flowstone",
weight = 0.25,
maximum_count = 50,
minimum_count = 10,
},
decorate = decorate_level_3,
warren_region_variability_threshold = 0.33,
double_frequency = true,
})

1
df_caverns/mod.conf Normal file
View File

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

118
df_caverns/oil_sea.lua Normal file
View File

@ -0,0 +1,118 @@
if not df_caverns.config.enable_oil_sea then
return
end
local c_oil = minetest.get_content_id("oil:oil_source")
local c_gas = minetest.get_content_id("oil:gas")
local c_lava = minetest.get_content_id("default:lava_source")
local c_obsidian = minetest.get_content_id("default:obsidian")
-------------------------------------------------------------------------------------------
local perlin_cave = {
offset = 0,
scale = 1,
spread = {x=300, y=300, z=300},
seed = 6000089,
octaves = 3,
persist = 0.67
}
-- large-scale rise and fall
local perlin_wave = {
offset = 0,
scale = 1,
spread = {x=1000, y=1000, z=1000},
seed = 10089,
octaves = 3,
persist = 0.67
}
local median = df_caverns.config.oil_sea_level
local floor_mult = -80
local floor_displace = 60
local ceiling_mult = 40
local ceiling_displace = -30
local wave_mult = 10
local c_lava_set
local y_max = median + 2*wave_mult + 2*ceiling_mult + ceiling_displace
local y_min = median - 2*wave_mult + 2*floor_mult + floor_displace
minetest.register_on_generated(function(minp, maxp, seed)
--if out of range of cave definition limits, abort
if minp.y > y_max or maxp.y < y_min then
return
end
local t_start = os.clock()
local vm, data, area = mapgen_helper.mapgen_vm_data()
local nvals_cave = mapgen_helper.perlin2d("df_caverns:oil_cave", minp, maxp, perlin_cave)
local nvals_wave = mapgen_helper.perlin2d("df_caverns:oil_wave", minp, maxp, perlin_wave)
if c_lava_set == nil then
c_lava_set = {}
for name, def in pairs(minetest.registered_nodes) do
if def.groups ~= nil and def.groups.lava ~= nil then
c_lava_set[minetest.get_content_id(name)] = true
end
end
end
for vi, x, y, z in area:iterp_yxz(minp, maxp) do
local index2d = mapgen_helper.index2d(minp, maxp, x, z)
local abs_cave = math.abs(nvals_cave[index2d]) -- range is from 0 to approximately 2, with 0 being connected and 2s being islands
local wave = nvals_wave[index2d] * wave_mult
local floor_height = math.floor(abs_cave * floor_mult + floor_displace + median + wave)
local ceiling_height = math.floor(abs_cave * ceiling_mult + median + ceiling_displace + wave)
if y > floor_height - 5 and y < ceiling_height + 5 then
if c_lava_set[data[vi]] then
data[vi] = c_obsidian
end
end
if y > floor_height and y < ceiling_height then
if y > median then
data[vi] = c_gas
else
data[vi] = c_oil
end
end
end
--send data back to voxelmanip
vm:set_data(data)
--calc lighting
vm:set_lighting({day = 0, night = 0})
vm:calc_lighting()
vm:update_liquids()
--write it to world
vm:write_to_map()
local chunk_generation_time = math.ceil((os.clock() - t_start) * 1000) --grab how long it took
if chunk_generation_time < 1000 then
minetest.log("info", "[df_caverns] oil sea mapblock generation took "..chunk_generation_time.." ms") --tell people how long
else
minetest.log("warning", "[df_caverns] oil sea took "..chunk_generation_time.." ms to generate map block "
.. minetest.pos_to_string(minp) .. minetest.pos_to_string(maxp))
end
end)
minetest.register_ore({
ore_type = "scatter",
ore = "oil:gas_seep",
wherein = "default:stone",
clust_scarcity = 32 * 32 * 32,
clust_num_ores = 27,
clust_size = 6,
y_max = df_caverns.config.sunless_sea_min,
y_min = y_min,
})

View File

@ -0,0 +1,35 @@
local outer_stair = "stairs:stair_outer_slade_brick"
if stairs.register_stair_outer == nil then -- 0.4.16 compatibility
outer_stair = "df_underworld_items:slade_brick"
end
local n1 = { name = "df_underworld_items:slade_block", force_place=true }
local n2 = { name = outer_stair, param2 = 1, force_place=true }
local n3 = { name = "stairs:stair_slade_brick", force_place=true }
local n4 = { name = outer_stair, force_place=true }
local n5 = { name = "air", force_place=true }
local n6 = { name = "df_underworld_items:slade_seal", force_place=true }
local n7 = { name = "stairs:stair_slade_brick", param2 = 1, force_place=true }
local n8 = { name = "df_underworld_items:slade_brick", force_place=true }
local n9 = { name = "stairs:stair_slade_brick", param2 = 3, force_place=true }
local n10 = { name = "df_underworld_items:slade_wall", force_place=true }
local n11 = { name = "default:meselamp", force_place=true }
local n12 = { name = outer_stair, param2 = 2, force_place=true }
local n13 = { name = "stairs:stair_slade_brick", param2 = 2, force_place=true }
local n14 = { name = outer_stair, param2 = 3, force_place=true }
return {
name = "df_caverns:lamppost",
size = {x = 3, y = 15, z = 3},
center_pos = {x = 1, y = 7, z = 1},
data = {
n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1,
n1, n1, n1, n1, n1, n1, n1, n2, n3, n4, n5, n5, n5, n5, n5, n5, n5,
n5, n5, n5, n5, n5, n5, n5, n5, n5, n5, n5, n1, n1, n1, n1, n5, n1,
n1, n5, n1, n1, n5, n1, n1, n5, n1, n1, n5, n1, n1, n5, n1, n1, n6,
n1, n7, n8, n9, n5, n8, n5, n5, n8, n5, n5, n10, n5, n5, n10, n5, n5,
n11, n5, n5, n5, n5, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1,
n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n12, n13, n14, n5,
n5, n5, n5, n5, n5, n5, n5, n5, n5, n5, n5, n5, n5, n5, n5, n5, n5,
}
}

View File

@ -0,0 +1,120 @@
local outer_stair = "stairs:stair_outer_slade_brick"
if stairs.register_stair_outer == nil then -- 0.4.16 compatibility
outer_stair = "df_underworld_items:slade_brick"
end
local n1 = { name = "ignore"}
local n8 = { name = "air", force_place=true }
local n3 = { name = "df_underworld_items:slade_brick", force_place=true }
local n4 = { name = "df_underworld_items:slade_wall", force_place=true }
local n5 = { name = outer_stair, param2 = 1, force_place=true }
local n6 = { name = "stairs:stair_slade_brick", force_place=true }
local n7 = { name = outer_stair, force_place=true }
local n9 = { name = "stairs:slab_slade_brick", param2 = 23, force_place=true }
local n10 = { name = "stairs:stair_slade_brick", param2 = 1, force_place=true }
local n11 = { name = "stairs:stair_slade_brick", param2 = 3, force_place=true }
local n14 = { name = "stairs:stair_slade_brick", param2 = 23, force_place=true }
local n15 = { name = outer_stair, param2 = 2, force_place=true }
local n16 = { name = "stairs:stair_slade_brick", param2 = 2, force_place=true }
local n17 = { name = outer_stair, param2 = 3, force_place=true }
-- foundation nodes
local n2 = { name = "df_underworld_items:slade_brick", force_place=false, place_on_condition=mapgen_helper.buildable_to }
local n12 = { name = "df_underworld_items:slade_wall", force_place=false, place_on_condition=mapgen_helper.buildable_to }
local n13 = { name = "stairs:stair_slade_brick", param2 = 1, force_place=false, place_on_condition=mapgen_helper.buildable_to }
return {
name = "df_caverns:medium_building",
size = {x = 15, y = 12, z = 8},
center_pos = {x = 10, y = 6, z = 3},
data = {
n1, n1, n1, n1, n1, n1, n1, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1,
n1, n1, n1, n1, n1, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n1, n1,
n1, n1, n1, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n1, n1, n1, n1,
n1, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n1, n1, n1, n1, n1, n2,
n2, n2, n2, n2, n2, n2, n2, n1, n1, n1, n1, n1, n1, n1, n3, n3, n3,
n3, n3, n3, n3, n3, n1, n1, n1, n1, n1, n1, n1, n3, n4, n4, n4, n4,
n4, n4, n3, n1, n1, n1, n1, n1, n1, n1, n3, n4, n4, n4, n4, n4, n4,
n3, n1, n1, n1, n1, n1, n1, n1, n3, n3, n3, n3, n3, n3, n3, n3, n1,
n1, n1, n1, n1, n1, n1, n3, n4, n4, n4, n4, n4, n4, n3, n1, n1, n1,
n1, n1, n1, n1, n3, n4, n4, n4, n4, n4, n4, n3, n1, n1, n1, n1, n1,
n1, n1, n5, n6, n6, n6, n6, n6, n6, n7, n1, n1, n1, n1, n1, n1, n1,
n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n1, n1, n1, n1, n1, n2, n2,
n2, n2, n2, n2, n2, n2, n1, n1, n1, n1, n1, n1, n1, n2, n2, n2, n2,
n2, n2, n2, n2, n1, n1, n1, n1, n1, n1, n1, n2, n2, n2, n2, n2, n2,
n2, n2, n1, n1, n1, n1, n1, n1, n1, n2, n2, n2, n2, n2, n2, n2, n2,
n1, n1, n1, n1, n1, n1, n1, n3, n3, n3, n3, n3, n3, n3, n3, n1, n1,
n1, n1, n1, n1, n8, n4, n8, n8, n8, n8, n8, n8, n4, n1, n1, n1, n1,
n1, n1, n8, n4, n8, n8, n8, n8, n8, n8, n4, n1, n1, n1, n1, n1, n1,
n1, n3, n9, n9, n9, n9, n9, n9, n3, n1, n1, n1, n1, n1, n1, n1, n4,
n8, n8, n8, n8, n8, n8, n4, n1, n1, n1, n1, n1, n1, n1, n4, n8, n8,
n8, n8, n8, n8, n4, n1, n1, n1, n1, n1, n1, n1, n10, n9, n9, n9, n9,
n9, n9, n11, n12, n12, n2, n2, n2, n2, n2, n2, n2, n2, n2, n2, n2,
n2, n2, n1, n12, n12, n2, n2, n2, n2, n2, n2, n2, n2, n2, n2, n2, n2,
n1, n1, n12, n12, n2, n2, n2, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1,
n1, n12, n12, n2, n2, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n1, n1,
n12, n12, n2, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n1, n1, n1,
n12, n12, n3, n3, n3, n3, n3, n3, n3, n3, n1, n1, n1, n1, n1, n1,
n12, n3, n8, n8, n8, n8, n8, n8, n4, n1, n1, n1, n1, n1, n1, n8, n3,
n8, n8, n8, n8, n8, n8, n4, n1, n1, n1, n1, n1, n1, n1, n3, n9, n9,
n9, n9, n9, n9, n3, n1, n1, n1, n1, n1, n1, n1, n4, n8, n8, n8, n8,
n8, n8, n4, n1, n1, n1, n1, n1, n1, n1, n4, n8, n8, n8, n8, n8, n8,
n4, n1, n1, n1, n1, n1, n1, n1, n10, n9, n9, n9, n9, n9, n9, n11, n1,
n13, n2, n2, n2, n2, n2, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n13,
n2, n2, n2, n2, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n1, n13, n2,
n2, n2, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n1, n1, n13, n2, n2,
n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n1, n1, n1, n13, n2, n2, n2,
n2, n2, n2, n2, n2, n2, n1, n1, n1, n1, n1, n1, n13, n3, n3, n3, n3,
n3, n3, n3, n3, n1, n1, n1, n1, n1, n1, n8, n8, n8, n8, n8, n8, n8,
n8, n4, n1, n1, n1, n1, n1, n1, n8, n8, n8, n8, n8, n8, n8, n8, n4,
n1, n1, n1, n1, n1, n1, n1, n3, n9, n9, n9, n9, n9, n9, n3, n1, n1,
n1, n1, n1, n1, n1, n4, n8, n8, n8, n8, n8, n8, n4, n1, n1, n1, n1,
n1, n1, n1, n4, n8, n8, n8, n8, n8, n8, n4, n1, n1, n1, n1, n1, n1,
n1, n10, n9, n9, n9, n9, n9, n9, n11, n1, n13, n2, n2, n2, n2, n2,
n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n13, n2, n2, n2, n2, n2, n2,
n2, n2, n2, n2, n2, n2, n1, n1, n1, n13, n2, n2, n2, n2, n2, n2, n2,
n2, n2, n2, n2, n1, n1, n1, n1, n13, n2, n2, n2, n2, n2, n2, n2, n2,
n2, n2, n1, n1, n1, n1, n1, n13, n2, n2, n2, n2, n2, n2, n2, n2, n2,
n1, n1, n1, n1, n1, n1, n13, n3, n3, n3, n3, n3, n3, n3, n3, n1, n1,
n1, n1, n1, n1, n8, n8, n8, n8, n8, n8, n8, n8, n4, n1, n1, n1, n1,
n1, n1, n8, n8, n8, n8, n8, n8, n8, n8, n4, n1, n1, n1, n1, n1, n1,
n1, n3, n9, n9, n9, n9, n9, n9, n3, n1, n1, n1, n1, n1, n1, n1, n4,
n8, n8, n8, n8, n8, n8, n4, n1, n1, n1, n1, n1, n1, n1, n4, n8, n8,
n8, n8, n8, n8, n4, n1, n1, n1, n1, n1, n1, n1, n10, n9, n9, n9, n9,
n9, n9, n11, n12, n12, n2, n2, n2, n2, n2, n2, n2, n2, n2, n2, n2,
n2, n2, n1, n12, n12, n2, n2, n2, n2, n2, n2, n2, n2, n2, n2, n2, n2,
n1, n1, n12, n12, n2, n2, n2, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1,
n1, n12, n12, n2, n2, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n1, n1,
n12, n12, n12, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n1, n1, n1,
n12, n12, n3, n3, n3, n3, n3, n3, n3, n3, n1, n1, n1, n1, n1, n1,
n12, n3, n8, n8, n8, n8, n8, n8, n4, n1, n1, n1, n1, n1, n1, n8, n3,
n8, n8, n8, n8, n8, n8, n4, n1, n1, n1, n1, n1, n1, n1, n3, n9, n9,
n9, n9, n9, n9, n3, n1, n1, n1, n1, n1, n1, n1, n4, n8, n8, n8, n8,
n8, n8, n4, n1, n1, n1, n1, n1, n1, n1, n4, n8, n8, n8, n8, n8, n8,
n4, n1, n1, n1, n1, n1, n1, n1, n10, n9, n9, n9, n9, n9, n9, n11, n1,
n1, n1, n1, n1, n1, n1, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n1,
n1, n1, n1, n1, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n1, n1, n1,
n1, n1, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n1, n1, n1, n1, n1,
n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n1, n1, n1, n1, n1, n2, n2,
n2, n2, n2, n2, n2, n2, n1, n1, n1, n1, n1, n1, n1, n3, n3, n3, n3,
n3, n3, n3, n3, n1, n1, n1, n1, n1, n1, n8, n4, n8, n8, n14, n11, n8,
n8, n4, n1, n1, n1, n1, n1, n1, n8, n4, n8, n14, n11, n8, n8, n8, n4,
n1, n1, n1, n1, n1, n1, n1, n3, n14, n11, n8, n8, n8, n9, n3, n1, n1,
n1, n1, n1, n1, n1, n4, n8, n8, n8, n8, n8, n8, n4, n1, n1, n1, n1,
n1, n1, n1, n4, n8, n8, n8, n8, n8, n8, n4, n1, n1, n1, n1, n1, n1,
n1, n10, n9, n9, n9, n9, n9, n9, n11, n1, n1, n1, n1, n1, n1, n1, n2,
n2, n2, n2, n2, n2, n2, n2, n1, n1, n1, n1, n1, n1, n1, n2, n2, n2,
n2, n2, n2, n2, n2, n1, n1, n1, n1, n1, n1, n1, n2, n2, n2, n2, n2,
n2, n2, n2, n1, n1, n1, n1, n1, n1, n1, n2, n2, n2, n2, n2, n2, n2,
n2, n1, n1, n1, n1, n1, n1, n1, n2, n2, n2, n2, n2, n2, n2, n2, n1,
n1, n1, n1, n1, n1, n1, n3, n3, n3, n3, n3, n3, n3, n3, n1, n1, n1,
n1, n1, n1, n1, n3, n4, n4, n4, n4, n4, n4, n3, n1, n1, n1, n1, n1,
n1, n1, n3, n4, n4, n4, n4, n4, n4, n3, n1, n1, n1, n1, n1, n1, n1,
n3, n3, n3, n3, n3, n3, n3, n3, n1, n1, n1, n1, n1, n1, n1, n3, n4,
n4, n4, n4, n4, n4, n3, n1, n1, n1, n1, n1, n1, n1, n3, n4, n4, n4,
n4, n4, n4, n3, n1, n1, n1, n1, n1, n1, n1, n15, n16, n16, n16, n16,
n16, n16, n17,
}
}

View File

@ -0,0 +1,29 @@
local outer_stair = "stairs:stair_outer_slade_brick"
if stairs.register_stair_outer == nil then -- 0.4.16 compatibility
outer_stair = "df_underworld_items:slade_brick"
end
local n1 = { name = "df_underworld_items:slade_block", force_place=true }
local n2 = { name = outer_stair, param2 = 1, force_place=true }
local n3 = { name = "stairs:stair_slade_brick", force_place=true }
local n4 = { name = outer_stair, force_place=true }
local n5 = { name = "air", force_place=true }
local n6 = { name = "df_underworld_items:slade_seal", force_place=true }
local n7 = { name = "stairs:stair_slade_brick", param2 = 1, force_place=true }
local n8 = { name = "stairs:stair_slade_brick", param2 = 3, force_place=true }
local n9 = { name = outer_stair, param2 = 2, force_place=true }
local n10 = { name = "stairs:stair_slade_brick", param2 = 2, force_place=true }
local n11 = { name = outer_stair, param2 = 3, force_place=true }
return {
name="df_caverns:oubliette",
size = {x = 3, y = 9, z = 3},
center_pos = {x = 1, y = 7, z = 1},
data = {
n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1,
n1, n1, n1, n1, n1, n1, n1, n2, n3, n4, n1, n1, n1, n1, n5, n1, n1,
n5, n1, n1, n5, n1, n1, n5, n1, n1, n5, n1, n1, n5, n1, n1, n6, n1,
n7, n5, n8, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n1,
n1, n1, n1, n1, n1, n1, n1, n1, n1, n1, n9, n10, n11,
},
}

View File

@ -0,0 +1,76 @@
local outer_stair = "stairs:stair_outer_slade_brick"
if stairs.register_stair_outer == nil then -- 0.4.16 compatibility
outer_stair = "df_underworld_items:slade_brick"
end
local n1 = { name = "ignore" }
local n10 = { name = "air", force_place=true }
local n3 = { name = "df_underworld_items:slade_brick", force_place=true }
local n4 = { name = "df_underworld_items:slade_wall", force_place=true }
local n5 = { name = outer_stair, param2 = 1, force_place=true }
local n6 = { name = "stairs:stair_slade_brick", force_place=true }
local n7 = { name = outer_stair, force_place=true }
local n11 = { name = "stairs:stair_slade_brick", param2 = 1, force_place=true }
local n12 = { name = "stairs:slab_slade_brick", param2 = 22, force_place=true}
local n13 = { name = "stairs:stair_slade_brick", param2 = 3, force_place=true }
local n15 = { name = outer_stair, param2 = 2, force_place=true }
local n16 = { name = "stairs:stair_slade_brick", param2 = 2, force_place=true }
local n17 = { name = outer_stair, param2 = 3, force_place=true }
-- foundation nodes
local n2 = { name = "df_underworld_items:slade_brick", force_place=false, place_on_condition=mapgen_helper.buildable_to }
local n8 = { name = "stairs:stair_slade_brick", param2 = 2, force_place=false, place_on_condition=mapgen_helper.buildable_to }
local n9 = { name = "stairs:stair_slade_brick", force_place=false, place_on_condition=mapgen_helper.buildable_to }
local n14 = { name = "stairs:stair_slade_brick", param2 = 1, force_place=false, place_on_condition=mapgen_helper.buildable_to }
return {
name = "df_caverns:small_building",
size = {x = 11, y = 9, z = 7},
center_pos = {x = 7, y = 5, z = 3},
data = {
n1, n1, n2, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n2, n2, n2, n2,
n2, n2, n2, n2, n2, n1, n1, n2, n2, n2, n2, n2, n2, n2, n2, n2, n1,
n1, n2, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n1, n1, n2, n2, n2,
n2, n2, n2, n2, n1, n1, n1, n1, n3, n3, n3, n3, n3, n3, n3, n1, n1,
n1, n1, n3, n4, n4, n4, n4, n4, n3, n1, n1, n1, n1, n3, n4, n4, n4,
n4, n4, n3, n1, n1, n1, n1, n5, n6, n6, n6, n6, n6, n7, n1, n1, n2,
n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n2, n2, n2, n2, n2, n2, n2,
n2, n2, n1, n1, n2, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n8, n2,
n2, n2, n2, n2, n2, n2, n2, n1, n1, n1, n9, n2, n2, n2, n2, n2, n2,
n2, n1, n1, n1, n1, n3, n3, n3, n3, n3, n3, n3, n1, n1, n1, n10, n4,
n10, n10, n10, n10, n10, n4, n1, n1, n1, n10, n4, n10, n10, n10, n10,
n10, n4, n1, n1, n1, n1, n11, n12, n12, n12, n12, n12, n13, n1, n1,
n2, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n2, n2, n2, n2, n2, n2,
n2, n2, n2, n1, n1, n8, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n1,
n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n1, n2, n2, n2, n2, n2, n2,
n2, n2, n1, n1, n1, n9, n3, n3, n3, n3, n3, n3, n3, n1, n1, n1, n10,
n3, n10, n10, n10, n10, n10, n4, n1, n1, n1, n10, n3, n10, n10, n10,
n10, n10, n4, n1, n1, n1, n1, n11, n12, n12, n12, n12, n12, n13, n14,
n2, n2, n2, n2, n2, n2, n2, n2, n2, n2, n1, n14, n2, n2, n2, n2, n2,
n2, n2, n2, n2, n1, n1, n1, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1,
n1, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n1, n2, n2, n2, n2, n2,
n2, n2, n2, n1, n1, n1, n2, n3, n3, n3, n3, n3, n3, n3, n1, n1, n1,
n10, n10, n10, n10, n10, n10, n10, n4, n1, n1, n1, n10, n10, n10,
n10, n10, n10, n10, n4, n1, n1, n1, n1, n11, n12, n12, n12, n12, n12,
n13, n1, n1, n2, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n2, n2, n2,
n2, n2, n2, n2, n2, n2, n1, n1, n9, n2, n2, n2, n2, n2, n2, n2, n2,
n1, n1, n1, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n1, n2, n2, n2,
n2, n2, n2, n2, n2, n1, n1, n1, n8, n3, n3, n3, n3, n3, n3, n3, n1,
n1, n1, n10, n3, n10, n10, n10, n10, n10, n4, n1, n1, n1, n10, n3,
n10, n10, n10, n10, n10, n4, n1, n1, n1, n1, n11, n12, n12, n12, n12,
n12, n13, n1, n1, n2, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n2, n2,
n2, n2, n2, n2, n2, n2, n2, n1, n1, n2, n2, n2, n2, n2, n2, n2, n2,
n2, n1, n1, n9, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n1, n8, n2,
n2, n2, n2, n2, n2, n2, n1, n1, n1, n1, n3, n3, n3, n3, n3, n3, n3,
n1, n1, n1, n10, n4, n10, n10, n10, n10, n10, n4, n1, n1, n1, n10,
n4, n10, n10, n10, n10, n10, n4, n1, n1, n1, n1, n11, n12, n12, n12,
n12, n12, n13, n1, n1, n2, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1,
n2, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n2, n2, n2, n2, n2, n2,
n2, n2, n2, n1, n1, n2, n2, n2, n2, n2, n2, n2, n2, n2, n1, n1, n1,
n1, n2, n2, n2, n2, n2, n2, n2, n1, n1, n1, n1, n3, n3, n3, n3, n3,
n3, n3, n1, n1, n1, n1, n3, n4, n4, n4, n4, n4, n3, n1, n1, n1, n1,
n3, n4, n4, n4, n4, n4, n3, n1, n1, n1, n1, n15, n16, n16, n16, n16,
n16, n17,
}
}

View File

@ -0,0 +1,21 @@
local inner_stair = "stairs:stair_inner_slade_brick"
if stairs.register_stair_inner == nil then -- 0.4.16 compatibility
inner_stair = "df_underworld_items:slade_brick"
end
local n1 = { name = "df_underworld_items:slade_brick", force_place=false, place_on_condition=mapgen_helper.buildable_to }
local n2 = { name = inner_stair, param2 = 1, force_place=true }
local n3 = { name = inner_stair, force_place=true }
local n4 = { name = "df_underworld_items:slade_brick", force_place=true }
local n5 = { name = inner_stair, param2 = 2, force_place=true }
local n6 = { name = inner_stair, param2 = 3, force_place=true }
return {
name = "df_caverns:small_slab",
size = {y = 2, x = 2, z = 3},
center_pos = {x = 1, y = 1, z = 1},
data = {
n1, n1, n2, n3, n1, n1, n4, n4, n1, n1, n5, n6,
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -0,0 +1,40 @@
[Cavern dimensions]
#Note that this doesn't guarantee caverns of this setting's size. This setting
#affects the scale of features in the perlin noise that is used to build caverns.
#Most caverns will be smaller than this (and a few might be larger)
dfcaverns_vertical_cavern_scale (Vertical cavern dimension scale) float 256
#Note that this doesn't guarantee caverns of this setting's size. This setting
#affects the scale of features in the perlin noise that is used to build caverns.
#Most caverns will be smaller than this (and a few might be larger)
dfcaverns_horizontal_cavern_scale (Horizontal cavern dimension scale) float 256
#Determines threshold for cave generation. Higher number means sparser, smaller caverns
dfcaverns_cavern_threshold (Cavern threshold) float 0.5 0.0 1.0
#Determines threshold for lower sea cave generation. Higher number means sparser, smaller caverns
dfcaverns_sunless_sea_threshold (Cavern threshold for sunless sea) float 0.4 0.0 1.0
#Determines how far out water extends into tunnels below the 'sea level' of from flooded
#caverns. Lower numbers give more flooded tunnel. If this number equals the cavern
#threshold tunnels will not be flooded at all, if it is 0 then half the tunnels will be flooded.
dfcaverns_tunnel_flooding_threshold (Tunnel flooding threshold) float 0.25 0.0 1.0
[Cavern depth borders]
#maximum boundary for cavern depths are most efficient when they fit the formula (x*80-32-1)
#where x is an integer. That way you don't get map blocks that straddle two cavern layers.
dfcaverns_ymax (Upper limit of level 1) int -193
#minimum boundaries for cavern depths are most efficient when they fit the formula (x*80-32)
#where x is an integer. that way you don't get map blocks that straddle two cavern layers.
dfcaverns_level1_min (Upper limit of level 2) int -832
dfcaverns_level2_min (Upper limit of level 3) int -1472
dfcaverns_level3_min (Upper limit of the sunless sea) int -2112
dfcaverns_sunless_sea_min (Lower limit of the sunless sea) int -2512
[Lower Levels]
dfcaverns_enable_oil_sea (Generate oil sea) bool true
dfcaverns_oil_sea_level (Oil sea level) int -2700
dfcaverns_enable_lava_sea (Generate magma sea) bool true
dfcaverns_lava_sea_level (Lava sea level) int -2900
dfcaverns_enable_underworld (Generate underworld) bool true
dfcaverns_underworld_level (Underworld level) int -3200
#Set this to 0 to disable glowing pit generation entirely.
dfcaverns_underworld_glowing_pit_mapblocks(Average pit spacing measured in mapblocks) int 8

210
df_caverns/shared.lua Normal file
View File

@ -0,0 +1,210 @@
-- This file contains code that is used by multiple different cavern layers.
local c_water = minetest.get_content_id("default:water_source")
local c_air = minetest.get_content_id("air")
local c_dirt = minetest.get_content_id("default:dirt")
local c_gravel = minetest.get_content_id("default:gravel")
local c_dirt_moss = minetest.get_content_id("df_mapitems:dirt_with_cave_moss")
local c_cobble_fungus = minetest.get_content_id("df_mapitems:cobble_with_floor_fungus")
local c_cobble_fungus_fine = minetest.get_content_id("df_mapitems:cobble_with_floor_fungus_fine")
local c_cobble = minetest.get_content_id("default:cobble")
local c_mossycobble = minetest.get_content_id("default:mossycobble")
local c_wet_flowstone = minetest.get_content_id("df_mapitems:wet_flowstone")
local c_dry_flowstone = minetest.get_content_id("df_mapitems:dry_flowstone")
df_caverns.data_param2 = {}
--------------------------------------------------
df_caverns.stalagmites = function(abs_cracks, vert_rand, vi, area, data, data_param2, wet, reverse_sign)
local flowstone
local stalagmite_ids
if wet then
flowstone = c_wet_flowstone
stalagmite_ids = df_mapitems.wet_stalagmite_ids
else
flowstone = c_dry_flowstone
stalagmite_ids = df_mapitems.dry_stalagmite_ids
end
local height_mult = 1
local ystride = area.ystride
if reverse_sign then
ystride = - ystride
height_mult = -1
end
if vert_rand < 0.004 then
if reverse_sign then
subterrane.big_stalactite(vi+ystride, area, data, 6, 15, flowstone, flowstone, flowstone)
else
subterrane.big_stalagmite(vi+ystride, area, data, 6, 15, flowstone, flowstone, flowstone)
end
else
local param2 = abs_cracks*1000000 - math.floor(abs_cracks*1000000/4)*4
local height = math.floor(abs_cracks * 50)
subterrane.stalagmite(vi+ystride, area, data, data_param2, param2, height*height_mult, stalagmite_ids)
end
data[vi] = flowstone
end
df_caverns.stalactites = function(abs_cracks, vert_rand, vi, area, data, data_param2, wet)
df_caverns.stalagmites(abs_cracks, vert_rand, vi, area, data, data_param2, wet, true)
end
--------------------------------------------------
df_caverns.flooded_cavern_floor = function(abs_cracks, vert_rand, vi, area, data)
local ystride = area.ystride
if abs_cracks < 0.25 then
data[vi] = c_mossycobble
elseif data[vi-ystride] ~= c_water then
data[vi] = c_dirt
end
-- put in only the large stalagmites that won't get in the way of the water
if abs_cracks < 0.1 then
if vert_rand < 0.004 then
subterrane.big_stalagmite(vi+ystride, area, data, 6, 15, c_wet_flowstone, c_wet_flowstone, c_wet_flowstone)
end
end
end
local c_dead_fungus
if minetest.get_modpath("df_farming") then
c_dead_fungus = minetest.get_content_id("df_farming:dead_fungus")
end
df_caverns.dry_cavern_floor = function(abs_cracks, vert_rand, vi, area, data, data_param2)
if abs_cracks < 0.075 then
df_caverns.stalagmites(abs_cracks, vert_rand, vi, area, data, data_param2, false)
elseif abs_cracks < 0.4 then
data[vi] = c_cobble
elseif abs_cracks < 0.6 then
data[vi] = c_cobble_fungus_fine
else
data[vi] = c_cobble_fungus
if c_dead_fungus and math.random() < 0.05 then
data[vi+area.ystride] = c_dead_fungus
end
end
end
df_caverns.wet_cavern_floor = function(abs_cracks, vert_rand, vi, area, data, data_param2)
if abs_cracks < 0.1 then
df_caverns.stalagmites(abs_cracks, vert_rand, vi, area, data, data_param2, true)
elseif abs_cracks < 0.6 then
data[vi] = c_cobble
else
data[vi] = c_mossycobble
if c_dead_fungus and math.random() < 0.05 then
data[vi+area.ystride] = c_dead_fungus
end
end
end
--------------------------------------
df_caverns.glow_worm_cavern_ceiling = function(abs_cracks, vert_rand, vi, area, data, data_param2)
if abs_cracks < 0.1 then
df_caverns.stalactites(abs_cracks, vert_rand, vi, area, data, data_param2, true)
elseif abs_cracks < 0.5 and abs_cracks > 0.3 and math.random() < 0.3 then
df_mapitems.glow_worm_ceiling(area, data, vi-area.ystride)
end
end
local content_in_list=function(content, list)
for i, v in ipairs(list) do
if content == v then return true end
end
return false
end
df_caverns.tunnel_floor = function(minp, maxp, area, vi, nvals_cracks, data, data_param2, wet)
local ystride = area.ystride
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local cracks = nvals_cracks[index2d]
local abs_cracks = math.abs(cracks)
if wet then
if abs_cracks < 0.05 and data[vi+ystride] == c_air and not content_in_list(data[vi], df_mapitems.wet_stalagmite_ids) then -- make sure data[vi] is not already flowstone. Stalagmites from lower levels are acting as base for further stalagmites
local param2 = abs_cracks*1000000 - math.floor(abs_cracks*1000000/4)*4
local height = math.floor(abs_cracks * 100)
subterrane.stalagmite(vi+ystride, area, data, data_param2, param2, height, df_mapitems.wet_stalagmite_ids)
data[vi] = c_wet_flowstone
end
else
if abs_cracks < 0.025 and data[vi+ystride] == c_air and not content_in_list(data[vi], df_mapitems.dry_stalagmite_ids) then -- make sure data[vi] is not already flowstone. Stalagmites from lower levels are acting as base for further stalagmites
local param2 = abs_cracks*1000000 - math.floor(abs_cracks*1000000/4)*4
local height = math.floor(abs_cracks * 100)
subterrane.stalagmite(vi+ystride, area, data, data_param2, param2, height, df_mapitems.dry_stalagmite_ids)
elseif cracks > 0.5 and data[vi-ystride] ~= c_air then
data[vi] = c_gravel
end
end
end
df_caverns.tunnel_ceiling = function(minp, maxp, area, vi, nvals_cracks, data, data_param2, wet)
local ystride = area.ystride
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local cracks = nvals_cracks[index2d]
local abs_cracks = math.abs(cracks)
if wet then
if abs_cracks < 0.05 and data[vi-ystride] == c_air and not content_in_list(data[vi], df_mapitems.wet_stalagmite_ids) then -- make sure data[vi] is not already flowstone. Stalagmites from lower levels are acting as base for further stalagmites
local param2 = abs_cracks*1000000 - math.floor(abs_cracks*1000000/4)*4
local height = math.floor(abs_cracks * 100)
subterrane.stalactite(vi-ystride, area, data, data_param2, param2, height, df_mapitems.wet_stalagmite_ids)
data[vi] = c_wet_flowstone
end
else
if abs_cracks < 0.025 and data[vi-ystride] == c_air and not content_in_list(data[vi], df_mapitems.dry_stalagmite_ids) then -- make sure data[vi] is not already flowstone. Stalagmites from lower levels are acting as base for further stalagmites
local param2 = abs_cracks*1000000 - math.floor(abs_cracks*1000000/4)*4
local height = math.floor(abs_cracks * 100)
subterrane.stalactite(vi-ystride, area, data, data_param2, param2, height, df_mapitems.dry_stalagmite_ids)
end
end
end
df_caverns.perlin_cave = {
offset = 0,
scale = 1,
spread = {x=df_caverns.config.horizontal_cavern_scale, y=df_caverns.config.vertical_cavern_scale, z=df_caverns.config.horizontal_cavern_scale},
seed = -400000000089,
octaves = 3,
persist = 0.67
}
df_caverns.perlin_wave = {
offset = 0,
scale = 1,
spread = {x=df_caverns.config.horizontal_cavern_scale * 2, y=df_caverns.config.vertical_cavern_scale, z=df_caverns.config.horizontal_cavern_scale * 2}, -- squashed 2:1
seed = 59033,
octaves = 6,
persist = 0.63
}
-- Used for making lines of dripstone, and in various other places where small-scale patterns are needed
df_caverns.np_cracks = {
offset = 0,
scale = 1,
spread = {x = 20, y = 20, z = 20},
seed = 5717,
octaves = 3,
persist = 0.63,
lacunarity = 2.0,
}
---------------------------------------------------------------------------------
df_caverns.place_shrub = function(vi, area, data, param2_data, shrub_list)
if shrub_list == nil then
return
end
local shrub = shrub_list[math.random(#shrub_list)]
shrub(vi, area, data, param2_data)
end

391
df_caverns/sunless_sea.lua Normal file
View File

@ -0,0 +1,391 @@
local c_water = minetest.get_content_id("default:water_source")
local c_air = minetest.get_content_id("air")
local c_dirt = minetest.get_content_id("default:dirt")
local c_dirt_moss = minetest.get_content_id("df_mapitems:dirt_with_cave_moss")
local c_sand = minetest.get_content_id("default:sand")
local c_gravel = minetest.get_content_id("default:gravel")
local c_wet_flowstone = minetest.get_content_id("df_mapitems:wet_flowstone")
local c_dry_flowstone = minetest.get_content_id("df_mapitems:dry_flowstone")
local c_lava = minetest.get_content_id("default:lava_source")
local c_obsidian = minetest.get_content_id("default:obsidian")
local mushroom_shrublist
local fungispore_shrublist
if minetest.get_modpath("df_farming") then
mushroom_shrublist = {
df_farming.spawn_plump_helmet_vm,
df_farming.spawn_plump_helmet_vm,
df_farming.spawn_dimple_cup_vm,
df_farming.spawn_dead_fungus_vm,
df_farming.spawn_cavern_fungi_vm,
}
fungispore_shrublist = {
df_farming.spawn_pig_tail_vm,
df_farming.spawn_sweet_pod_vm,
df_farming.spawn_cave_wheat_vm,
df_farming.spawn_cave_wheat_vm,
df_farming.spawn_dead_fungus_vm,
df_farming.spawn_cavern_fungi_vm,
}
end
------------------------------------------------------------------------------------------
local perlin_cave_sunless_sea = {
offset = 0,
scale = 1,
spread = {x=df_caverns.config.horizontal_cavern_scale * 2, y=df_caverns.config.vertical_cavern_scale * 0.5, z=df_caverns.config.horizontal_cavern_scale * 2},
seed = -400000000089,
octaves = 3,
persist = 0.67
}
local perlin_wave_sunless_sea = {
offset = 0,
scale = 1,
spread = {x=df_caverns.config.horizontal_cavern_scale * 4, y=df_caverns.config.vertical_cavern_scale * 0.5, z=df_caverns.config.horizontal_cavern_scale * 4}, -- squashed 2:1
seed = 59033,
octaves = 6,
persist = 0.63
}
local perlin_cave_rivers = {
offset = 0,
scale = 1,
spread = {x=400, y=400, z=400},
seed = -400000000089,
octaves = 3,
persist = 0.67,
flags = "", -- remove "eased" flag, makes the paths of rivers a bit jaggedier and more interesting that curvy smooth paths
}
-- large-scale rise and fall to make the seam between roof and floor less razor-flat and make the rivers shallower and deeper in various places
local perlin_wave_rivers = {
offset = 0,
scale = 1,
spread = {x=800, y=800, z=800},
seed = -4000089,
octaves = 3,
persist = 0.67,
}
local sea_level = df_caverns.config.level3_min - (df_caverns.config.level3_min - df_caverns.config.sunless_sea_min) * 0.5
local floor_mult = 100
local floor_displace = -10
local ceiling_mult = -200
local ceiling_displace = 20
local wave_mult = 7
local ripple_mult = 15
local y_max_river = sea_level + 2*wave_mult + ceiling_displace + ripple_mult
local y_min_river = sea_level - 2*wave_mult + floor_displace
local hot_zone_boundary = 70
local middle_zone_boundary = 50
local cool_zone_boundary = 30
local mushroom_cavern_floor = function(abs_cracks, vert_rand, vi, area, data, data_param2)
local ystride = area.ystride
if abs_cracks < 0.1 then
df_caverns.stalagmites(abs_cracks, vert_rand, vi, area, data, data_param2, true)
elseif data[vi-ystride] ~= c_air and data[vi-ystride] ~= c_water then -- leave the ground as rock if it's only one node thick
if math.random() < 0.25 then
data[vi] = c_dirt
else
data[vi] = c_dirt_moss
end
if math.random() < 0.1 then
df_caverns.place_shrub(vi+ystride, area, data, data_param2, mushroom_shrublist)
elseif abs_cracks > 0.25 then
if math.random() < 0.01 then
df_trees.spawn_tower_cap_vm(vi+ystride, area, data)
elseif math.random() < 0.01 then
df_trees.spawn_goblin_cap_vm(vi+ystride, area, data)
end
end
end
end
local fungispore_cavern_floor = function(abs_cracks, vert_rand, vi, area, data, data_param2)
local ystride = area.ystride
if abs_cracks < 0.1 then
df_caverns.stalagmites(abs_cracks, vert_rand, vi, area, data, data_param2, true)
elseif data[vi-ystride] ~= c_air and data[vi-ystride] ~= c_water then -- leave the ground as rock if it's only one node thick
if math.random() < 0.25 then
data[vi] = c_dirt
else
data[vi] = c_dirt_moss
end
if math.random() < 0.1 then
df_caverns.place_shrub(vi+ystride, area, data, data_param2, fungispore_shrublist)
elseif abs_cracks > 0.35 then
if math.random() < 0.025 then
df_trees.spawn_fungiwood_vm(vi+ystride, area, data)
elseif math.random() < 0.025 then
df_trees.spawn_spore_tree_vm(vi+ystride, area, data)
end
end
end
end
local cool_zone_ceiling = function(abs_cracks, vert_rand, vi, area, data, data_param2)
if abs_cracks < 0.1 then
df_caverns.stalactites(abs_cracks, vert_rand, vi, area, data, data_param2, false)
end
end
local hot_zone_ceiling = function(abs_cracks, vert_rand, vi, area, data, data_param2)
-- dry zone ceiling, add crystals
if abs_cracks < 0.1 then
df_caverns.stalactites(abs_cracks, vert_rand, vi, area, data, data_param2, false)
end
if abs_cracks > 0.3 and math.random() < 0.005 then
df_mapitems.place_big_crystal_cluster(area, data, data_param2, vi, math.random(0,3), true)
end
end
local cool_zone_floor = df_caverns.dry_cavern_floor
local hot_zone_floor = function(abs_cracks, vert_rand, vi, area, data, data_param2)
if abs_cracks < 0.075 then
df_caverns.stalagmites(abs_cracks, vert_rand, vi, area, data, data_param2, false)
elseif abs_cracks > 0.3 and math.random() < 0.005 then
df_mapitems.place_big_crystal_cluster(area, data, data_param2, vi+area.ystride, math.random(0,2), false)
end
end
local decorate_sunless_sea = function(minp, maxp, seed, vm, node_arrays, area, data)
math.randomseed(minp.x + minp.y*2^8 + minp.z*2^16 + seed) -- make decorations consistent between runs
local heatmap = minetest.get_mapgen_object("heatmap")
local data_param2 = df_caverns.data_param2
vm:get_param2_data(data_param2)
local nvals_cracks = mapgen_helper.perlin2d("df_cavern:cracks", minp, maxp, df_caverns.np_cracks)
local minp_below = minp.y <= sea_level
local maxp_above = maxp.y > sea_level
local nvals_cave = mapgen_helper.perlin2d("df_caverns:sunless_sea", minp, maxp, perlin_cave_rivers) --cave noise for structure
local nvals_wave = mapgen_helper.perlin2d("df_caverns:sunless_sea_wave", minp, maxp, perlin_wave_rivers) --cave noise for structure
local skip_next = false -- mapgen is proceeding upward on the y axis,
--if this is true it skips a step to allow for things to be placed above the floor
-- creates "river" caverns
for vi, x, y, z in area:iterp_yxz(minp, maxp) do
if not skip_next then
if y < y_max_river and y > y_min_river then
local index2d = mapgen_helper.index2d(minp, maxp, x, z)
local abs_cave = math.abs(nvals_cave[index2d])
local wave = nvals_wave[index2d] * wave_mult
local cracks = nvals_cracks[index2d]
local ripple = cracks * ((y - y_min_river) / (y_max_river - y_min_river)) * ripple_mult
-- above floor and below ceiling
local floor_height = math.floor(abs_cave * floor_mult + sea_level + floor_displace + wave)
local ceiling_height = math.floor(abs_cave * ceiling_mult + sea_level + ceiling_displace + wave + ripple)
-- deal with lava
if y <= floor_height and y > floor_height - 3 and y < sea_level + 5 and data[vi] == c_lava then
data[vi] = c_obsidian
end
if y == floor_height and y < sea_level and not mapgen_helper.buildable_to(data[vi]) then
if cracks > 0.2 then
data[vi] = c_sand
if cracks > 0.5 then
data[vi+area.ystride] = c_sand
skip_next = true
end
else
data[vi] = c_gravel
end
elseif y > floor_height and y < ceiling_height and data[vi] ~= c_wet_flowstone then
data[vi] = c_air
elseif y == ceiling_height and not mapgen_helper.buildable_to(data[vi]) then
df_caverns.glow_worm_cavern_ceiling(math.abs(cracks),
mapgen_helper.xz_consistent_randomi(area, vi), vi, area, data, data_param2)
end
-- Deal with lava
if y >= ceiling_height and y < ceiling_height + 5 and y > sea_level - 5 and data[vi] == c_lava then
data[vi] = c_obsidian
end
end
-- convert all air below sea level into water
if y <= sea_level and data[vi] == c_air then
data[vi] = c_water
end
else
skip_next = false
end
end
---------------------------------------------------------
-- Cavern floors
for _, vi in ipairs(node_arrays.cavern_floor_nodes) do
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local heat = heatmap[index2d]
local cracks = nvals_cracks[index2d]
local abs_cracks = math.abs(cracks)
local vert_rand = mapgen_helper.xz_consistent_randomi(area, vi)
local y = area:get_y(vi)
-- The vertically squished aspect of these caverns produces too many very thin shelves, this blunts them
if mapgen_helper.buildable_to(data[vi-area.ystride]) then
if y <= sea_level then
data[vi] = c_water
else
data[vi] = c_air
end
end
-- extra test is needed because the rivers can remove nodes that Subterrane marked as floor.
if not mapgen_helper.buildable_to(data[vi]) then
if y >= sea_level then
if heat > hot_zone_boundary then
hot_zone_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
elseif heat > middle_zone_boundary then
fungispore_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
elseif heat > cool_zone_boundary then
mushroom_cavern_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
else
cool_zone_floor(abs_cracks, vert_rand, vi, area, data, data_param2)
end
elseif y >= sea_level - 30 then
if math.random() < 0.005 then
df_mapitems.place_snareweed_patch(area, data, vi, data_param2, 6)
else
data[vi] = c_dirt
end
else
data[vi] = c_sand
if math.random() < 0.001 then
local iterations = math.random(1, 6)
df_mapitems.spawn_coral_pile(area, data, vi, iterations)
df_mapitems.spawn_cave_coral(area, data, vi+area.ystride, iterations)
end
end
end
end
--------------------------------------
-- Cavern ceilings
for _, vi in ipairs(node_arrays.cavern_ceiling_nodes) do
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local heat = heatmap[index2d]
local cracks = nvals_cracks[index2d]
local abs_cracks = math.abs(cracks)
local vert_rand = mapgen_helper.xz_consistent_randomi(area, vi)
local y = area:get_y(vi)
if y > sea_level and not mapgen_helper.buildable_to(data[vi]) then
if heat > hot_zone_boundary then
hot_zone_ceiling(abs_cracks, vert_rand, vi, area, data, data_param2)
elseif heat > cool_zone_boundary then
df_caverns.glow_worm_cavern_ceiling(abs_cracks, vert_rand, vi, area, data, data_param2)
else
cool_zone_ceiling(abs_cracks, vert_rand, vi, area, data, data_param2)
end
end
end
----------------------------------------------
-- Tunnel floors
for _, vi in ipairs(node_arrays.tunnel_floor_nodes) do
if area:get_y(vi) >= sea_level and not mapgen_helper.buildable_to(data[vi]) then
df_caverns.tunnel_floor(minp, maxp, area, vi, nvals_cracks, data, data_param2, true)
end
end
------------------------------------------------------
-- Tunnel ceiling
for _, vi in ipairs(node_arrays.tunnel_ceiling_nodes) do
if area:get_y(vi) > sea_level and not mapgen_helper.buildable_to(data[vi]) then
df_caverns.tunnel_ceiling(minp, maxp, area, vi, nvals_cracks, data, data_param2, true)
else
-- air pockets
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local cracks = nvals_cracks[index2d]
local ystride = area.ystride
if cracks > 0.6 and data[vi-ystride] == c_water then
data[vi-ystride] = c_air
if cracks > 0.8 and data[vi-ystride*2] == c_water then
data[vi-ystride*2] = c_air
end
end
end
end
------------------------------------------------------
-- Warren ceiling
for _, vi in ipairs(node_arrays.warren_ceiling_nodes) do
if area:get_y(vi) > sea_level and not mapgen_helper.buildable_to(data[vi]) then
df_caverns.tunnel_ceiling(minp, maxp, area, vi, nvals_cracks, data, data_param2, true)
else
-- air pockets
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local cracks = nvals_cracks[index2d]
local ystride = area.ystride
if cracks > 0.6 and data[vi-ystride] == c_water then
data[vi-ystride] = c_air
if cracks > 0.8 and data[vi-ystride*2] == c_water then
data[vi-ystride*2] = c_air
end
end
end
end
----------------------------------------------
-- Warren floors
for _, vi in ipairs(node_arrays.warren_floor_nodes) do
if area:get_y(vi) >= sea_level and not mapgen_helper.buildable_to(data[vi]) then
df_caverns.tunnel_floor(minp, maxp, area, vi, nvals_cracks, data, data_param2, true)
end
end
-- columns
for _, vi in ipairs(node_arrays.column_nodes) do
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local heat = heatmap[index2d]
if area:get_y(vi) > sea_level and heat > hot_zone_boundary and data[vi] == c_wet_flowstone then
data[vi] = c_dry_flowstone
end
end
vm:set_param2_data(data_param2)
end
--Sunless Sea
subterrane.register_layer({
name = "sunless sea",
y_max = df_caverns.config.level3_min-1,
y_min = df_caverns.config.sunless_sea_min,
cave_threshold = df_caverns.config.sunless_sea_threshold,
perlin_cave = perlin_cave_sunless_sea,
perlin_wave = perlin_wave_sunless_sea,
solidify_lava = true,
columns = {
maximum_radius = 20,
minimum_radius = 5,
node = "df_mapitems:wet_flowstone",
weight = 0.5,
maximum_count = 60,
minimum_count = 10,
},
decorate = decorate_sunless_sea,
double_frequency = false,
})

View File

@ -0,0 +1,66 @@
-- surface tunnels
local y_max = -10
local y_min = df_caverns.config.ymax
minetest.register_on_generated(function(minp, maxp, seed)
--if out of range of cave definition limits, abort
if minp.y > y_max or maxp.y < y_min then
return
end
local t_start = os.clock()
local vm, data, data_param2, area = mapgen_helper.mapgen_vm_data_param2()
local humiditymap = minetest.get_mapgen_object("humiditymap")
local nvals_cracks = mapgen_helper.perlin2d("df_cavern:cracks", minp, maxp, df_caverns.np_cracks)
local previous_state = "outside_region"
local previous_y = minp.y
for vi, x, y, z in area:iterp_yxz(minp, maxp) do
if y < previous_y then
previous_state = "outside_region"
end
previous_y = y
if y < y_max then
if mapgen_helper.buildable_to(data[vi]) then
if previous_state == "in_rock" and not mapgen_helper.buildable_to(data[vi-area.ystride]) then
local index2d = mapgen_helper.index2d(minp, maxp, x, z)
local humidity = humiditymap[index2d]
df_caverns.tunnel_floor(minp, maxp, area, vi-area.ystride, nvals_cracks, data, data_param2, humidity > 30)
end
previous_state = "in_tunnel"
else
if previous_state == "in_tunnel" and not mapgen_helper.buildable_to(data[vi]) then
local index2d = mapgen_helper.index2d(minp, maxp, x, z)
local humidity = humiditymap[index2d]
df_caverns.tunnel_ceiling(minp, maxp, area, vi, nvals_cracks, data, data_param2, humidity > 30)
end
previous_state = "in_rock"
end
end
end
--send data back to voxelmanip
vm:set_data(data)
vm:set_param2_data(data_param2)
--calc lighting
vm:set_lighting({day = 0, night = 0})
vm:calc_lighting()
vm:update_liquids()
--write it to world
vm:write_to_map()
local chunk_generation_time = math.ceil((os.clock() - t_start) * 1000) --grab how long it took
if chunk_generation_time < 1000 then
minetest.log("info", "[df_caverns surface tunnels] "..chunk_generation_time.." ms") --tell people how long
else
minetest.log("warning", "[df_caverns surface tunnels] took "..chunk_generation_time.." ms to generate map block "
.. minetest.pos_to_string(minp) .. minetest.pos_to_string(maxp))
end
end)

396
df_caverns/underworld.lua Normal file
View File

@ -0,0 +1,396 @@
if not df_caverns.config.enable_underworld then
return
end
local c_slade = minetest.get_content_id("df_underworld_items:slade")
local c_air = minetest.get_content_id("air")
local c_water = minetest.get_content_id("default:water_source")
local c_glowstone = minetest.get_content_id("df_underworld_items:glowstone")
local c_amethyst = minetest.get_content_id("df_underworld_items:glow_amethyst")
local c_pit_plasma = minetest.get_content_id("df_underworld_items:pit_plasma")
local MP = minetest.get_modpath(minetest.get_current_modname())
local oubliette_schematic = dofile(MP.."/schematics/oubliette.lua")
local lamppost_schematic = dofile(MP.."/schematics/lamppost.lua")
local small_slab_schematic = dofile(MP.."/schematics/small_slab.lua")
local small_building_schematic = dofile(MP.."/schematics/small_building.lua")
local medium_building_schematic = dofile(MP.."/schematics/medium_building.lua")
local perlin_cave = {
offset = 0,
scale = 1,
spread = {x=200, y=200, z=200},
seed = 88233498,
octaves = 6,
persist = 0.67
}
-- large-scale rise and fall to make the seam between stone and slade less razor-flat
local perlin_wave = {
offset = 0,
scale = 1,
spread = {x=1000, y=1000, z=1000},
seed = 993455,
octaves = 3,
persist = 0.67
}
-- building zones
local perlin_zone = {
offset = 0,
scale = 1,
spread = {x=500, y=500, z=500},
seed = 199422,
octaves = 3,
persist = 0.67
}
local median = df_caverns.config.underworld_level
local floor_mult = 20
local floor_displace = -10
local ceiling_mult = -40
local ceiling_displace = 20
local wave_mult = 50
local y_max = median + 2*wave_mult + ceiling_displace + -2*ceiling_mult
local y_min = median - 2*wave_mult + floor_displace - 2*floor_mult
---------------------------------------------------------
-- Buildings
local oubliette_threshold = 0.8
local town_threshold = 1.1
local local_random = function(x, z)
math.randomseed(x + z*2^16)
return math.random()
end
-- create a deterministic list of buildings
local get_buildings = function(emin, emax, nvals_zone)
local buildings = {}
for x = emin.x, emax.x do
for z = emin.z, emax.z do
local index2d = mapgen_helper.index2d(emin, emax, x, z)
local zone = math.abs(nvals_zone[index2d])
if zone > oubliette_threshold and zone < town_threshold then
-- oubliette zone
--zone = (zone - oubliette_threshold)/(town_threshold-oubliette_threshold) -- turn this into a 0-1 spread
local building_val = local_random(x, z)
if building_val > 0.98 then
building_val = (building_val - 0.98)/0.02
local building_type
if building_val < 0.8 then
building_type = "oubliette"
elseif building_val < 0.9 then
building_type = "open oubliette"
else
building_type = "lamppost"
end
table.insert(buildings,
{
pos = {x=x, y=0, z=z}, -- y to be determined later
building_type = building_type,
bounding_box = {minpos={x=x-2, z=z-2}, maxpos={x=x+2, z=z+2}},
priority = math.floor(building_val * 10000000) % 1000, -- indended to allow for deterministic removal of overlapping buildings
}
)
end
elseif zone > town_threshold then
-- town zone
local building_val = local_random(x, z)
if building_val > 0.9925 then
building_val = (building_val - 0.9925)/0.0075
local building_type
local bounding_box
local priority = math.floor(building_val * 10000000) % 1000
local rotation = (priority % 4) * 90
if building_val < 0.75 then
building_type = "small building"
local boundmin, boundmax = mapgen_helper.get_schematic_bounding_box({x=x, y=0, z=z}, small_building_schematic, rotation)
bounding_box = {minpos=boundmin, maxpos=boundmax}
elseif building_val < 0.85 then
building_type = "medium building"
local boundmin, boundmax = mapgen_helper.get_schematic_bounding_box({x=x, y=0, z=z}, medium_building_schematic, rotation)
bounding_box = {minpos=boundmin, maxpos=boundmax}
else
building_type = "small slab"
local boundmin, boundmax = mapgen_helper.get_schematic_bounding_box({x=x, y=0, z=z}, small_slab_schematic, rotation)
bounding_box = {minpos=boundmin, maxpos=boundmax}
end
table.insert(buildings,
{
pos = {x=x, y=0, z=z}, -- y to be determined later
building_type = building_type,
bounding_box = bounding_box,
rotation = rotation,
priority = priority, -- indended to allow for deterministic removal of overlapping buildings
}
)
end
end
end
end
-- eliminate overlapping buildings
local building_count = table.getn(buildings)
local overlap_count = 0
for i = 1, building_count-1 do
local curr_building = buildings[i]
for j = i+1, building_count do
local test_building = buildings[j]
if test_building ~= nil and curr_building ~= nil and mapgen_helper.intersect_exists_xz(
curr_building.bounding_box.minpos,
curr_building.bounding_box.maxpos,
test_building.bounding_box.minpos,
test_building.bounding_box.maxpos) then
if curr_building.priority < test_building.priority then -- this makes elimination of overlapping buildings deterministic
buildings[i] = nil
j=building_count+1
else
buildings[j] = nil
end
overlap_count = overlap_count + 1
end
end
end
if building_count > 50 and overlap_count > building_count * 2/3 then
minetest.log("warning", "[df_caverns] underworld mapgen generated " ..
tostring(building_count) .. " buildings and " .. tostring(overlap_count) ..
" were eliminated as overlapping, if this happens a lot consider reducing building" ..
" generation probability to improve efficiency.")
end
local compacted_buildings = {}
for _, building in pairs(buildings) do
compacted_buildings[minetest.hash_node_position(building.pos)] = building
end
return compacted_buildings
end
-----------------------------------------------------------
-- Pits
local radius_pit_max = 40 -- won't actually be this wide, there'll be crystal spires around it
local radius_pit_variance = 10
local plasma_depth_min = 5
local plasma_depth_max = 75
local region_mapblocks = df_caverns.config.underworld_glowing_pit_mapblocks -- One glowing pit in each region this size
local mapgen_chunksize = tonumber(minetest.get_mapgen_setting("chunksize"))
local pit_region_size = region_mapblocks * mapgen_chunksize * 16
local scatter_2d = function(min_xz, gridscale, border_width)
local bordered_scale = gridscale - 2 * border_width
local point = {}
point.x = math.random() * bordered_scale + min_xz.x + border_width
point.y = 0
point.z = math.random() * bordered_scale + min_xz.z + border_width
return point
end
-- For some reason, map chunks generate with -32, -32, -32 as the "origin" minp. To make the large-scale grid align with map chunks it needs to be offset like this.
local get_corner = function(pos)
return {x = math.floor((pos.x+32) / pit_region_size) * pit_region_size - 32, z = math.floor((pos.z+32) / pit_region_size) * pit_region_size - 32}
end
local mapgen_seed = tonumber(minetest.get_mapgen_setting("seed"))
local get_pit = function(pos)
if region_mapblocks < 1 then return nil end
local corner_xz = get_corner(pos)
local next_seed = math.random(1, 1000000000)
math.randomseed(corner_xz.x + corner_xz.z * 2 ^ 8 + mapgen_seed)
local location = scatter_2d(corner_xz, pit_region_size, radius_pit_max + radius_pit_variance)
local variance_multiplier = math.random()
local radius = variance_multiplier * (radius_pit_max - 15) + 15
local variance = radius_pit_variance/2 + radius_pit_variance*variance_multiplier/2
local depth = math.random(plasma_depth_min, plasma_depth_max)
math.randomseed(next_seed)
return {location = location, radius = radius, variance = variance, depth = depth}
end
local perlin_pit = {
offset = 0,
scale = 1,
spread = {x=30, y=30, z=30},
seed = 901,
octaves = 3,
persist = 0.67
}
-------------------------------------
minetest.register_on_generated(function(minp, maxp, seed)
--if out of range of cave definition limits, abort
if minp.y > y_max or maxp.y < y_min then
return
end
local t_start = os.clock()
local vm, data, data_param2, area = mapgen_helper.mapgen_vm_data_param2()
local emin = area.MinEdge
local emax = area.MaxEdge
local nvals_cave = mapgen_helper.perlin2d("df_caverns:underworld_cave", emin, emax, perlin_cave) --cave noise for structure
local nvals_wave = mapgen_helper.perlin2d("df_caverns:underworld_wave", emin, emax, perlin_wave) --cave noise for structure
local nvals_zone = mapgen_helper.perlin2d("df_caverns:underworld_zone", emin, emax, perlin_zone) --building zones
local pit = get_pit(minp)
--minetest.chat_send_all(minetest.pos_to_string(pit.location))
local buildings = get_buildings(emin, emax, nvals_zone)
local pit_uninitialized = true
local nvals_pit, area_pit
for vi, x, y, z in area:iterp_yxz(minp, maxp) do
if y > y_min then
local index2d = mapgen_helper.index2d(emin, emax, x, z)
local abs_cave = math.abs(nvals_cave[index2d]) -- range is from 0 to approximately 2, with 0 being connected and 2s being islands
local wave = nvals_wave[index2d] * wave_mult
local floor_height = math.floor(abs_cave * floor_mult + median + floor_displace + wave)
local ceiling_height = math.floor(abs_cave * ceiling_mult + median + ceiling_displace + wave)
if y <= floor_height then
data[vi] = c_slade
if pit and
pit.location.x - radius_pit_max - radius_pit_variance < maxp.x and
pit.location.x + radius_pit_max + radius_pit_variance > minp.x and
pit.location.z - radius_pit_max - radius_pit_variance < maxp.z and
pit.location.z + radius_pit_max + radius_pit_variance > minp.z
then
-- there's a pit nearby
if pit_uninitialized then
nvals_pit, area_pit = mapgen_helper.perlin3d("df_cavern:perlin_cave", minp, maxp, perlin_pit) -- determine which areas are spongey with warrens
pit_uninitialized = false
end
local pit_value = nvals_pit[area_pit:index(x,y,z)] * pit.variance
local distance = vector.distance({x=x, y=y, z=z}, {x=pit.location.x, y=y, z=pit.location.z}) + pit_value
if distance < pit.radius -3 then
if y < y_min + 4 then -- make a layer of amethyst at the bottom of the pit to keep the plasma from digging infinitely downward.
data[vi] = c_amethyst
elseif y < median + floor_displace + wave - pit.depth then
data[vi] = c_pit_plasma
else
data[vi] = c_air
end
elseif distance < pit.radius then
data[vi] = c_amethyst
elseif distance < radius_pit_max and y == floor_height - 4 then
if math.random() > 0.95 then
df_underworld_items.underworld_shard(data, area, vi)
end
end
end
elseif y < ceiling_height and data[vi] ~= c_amethyst then
data[vi] = c_air
elseif data[vi] == c_water then
data[vi] = c_air -- no water down here
end
end
end
-- Ceiling decoration
for x = minp.x + 1, maxp.x-1 do
for z = minp.z + 1, maxp.z -1 do
local index2d = mapgen_helper.index2d(emin, emax, x, z)
local abs_cave = math.abs(nvals_cave[index2d]) -- range is from 0 to approximately 2, with 0 being connected and 2s being islands
local wave = nvals_wave[index2d] * wave_mult
local floor_height = math.floor(abs_cave * floor_mult + median + floor_displace + wave)
local ceiling_height = math.floor(abs_cave * ceiling_mult + median + ceiling_displace + wave)
if ceiling_height > floor_height + 5 and ceiling_height < maxp.y and ceiling_height > minp.y then
local vi = area:index(x, ceiling_height, z)
if (
--test if we're nestled in a crevice
(not mapgen_helper.buildable_to(data[vi-area.ystride + 1]) and not mapgen_helper.buildable_to(data[vi-area.ystride - 1])) or
(not mapgen_helper.buildable_to(data[vi-area.ystride + area.zstride]) and not mapgen_helper.buildable_to(data[vi-area.ystride - area.zstride]))
)
then
data[vi] = c_glowstone
end
end
end
end
-- buildings
for x = emin.x + 5, emax.x - 5 do
for z = emin.z + 5, emax.z - 5 do
local skip = false
if pit and
pit.location.x - radius_pit_max - radius_pit_variance < x and
pit.location.x + radius_pit_max + radius_pit_variance > x and
pit.location.z - radius_pit_max - radius_pit_variance < z and
pit.location.z + radius_pit_max + radius_pit_variance > z
then
if vector.distance(pit.location, {x=x, y=0, z=z}) < radius_pit_max + radius_pit_variance then
-- there's a pit nearby
skip = true
end
end
if not skip then
local index2d = mapgen_helper.index2d(emin, emax, x, z)
local abs_cave = math.abs(nvals_cave[index2d]) -- range is from 0 to approximately 2, with 0 being connected and 2s being islands
local wave = nvals_wave[index2d] * wave_mult
local floor_height = math.floor(abs_cave * floor_mult + median + floor_displace + wave)
local ceiling_height = math.floor(abs_cave * ceiling_mult + median + ceiling_displace + wave)
if ceiling_height > floor_height and floor_height <= maxp.y and floor_height >= minp.y then
local building = buildings[minetest.hash_node_position({x=x,y=0,z=z})]
if building ~= nil then
building.pos.y = floor_height
--minetest.chat_send_all("placing " .. building.building_type .. " at " .. minetest.pos_to_string(building.pos))
if building.building_type == "oubliette" then
mapgen_helper.place_schematic_on_data(data, data_param2, area, building.pos, oubliette_schematic)
elseif building.building_type == "open oubliette" then
mapgen_helper.place_schematic_on_data(data, data_param2, area, building.pos, oubliette_schematic, 0, {["df_underworld_items:slade_seal"] = "air"})
elseif building.building_type == "lamppost" then
mapgen_helper.place_schematic_on_data(data, data_param2, area, building.pos, lamppost_schematic)
elseif building.building_type == "small building" then
mapgen_helper.place_schematic_on_data(data, data_param2, area, building.pos, small_building_schematic, building.rotation)
elseif building.building_type == "medium building" then
mapgen_helper.place_schematic_on_data(data, data_param2, area, building.pos, medium_building_schematic, building.rotation)
elseif building.building_type == "small slab" then
mapgen_helper.place_schematic_on_data(data, data_param2, area, building.pos, small_slab_schematic, building.rotation)
else
minetest.log("error", "unrecognized underworld building type: " .. tostring(building.building_type))
end
end
end
end
end
end
--send data back to voxelmanip
vm:set_data(data)
vm:set_param2_data(data_param2)
--calc lighting
vm:set_lighting({day = 0, night = 0})
vm:calc_lighting()
vm:update_liquids()
--write it to world
vm:write_to_map()
local chunk_generation_time = math.ceil((os.clock() - t_start) * 1000) --grab how long it took
if chunk_generation_time < 1000 then
minetest.log("info", "[df_caverns] underworld mapblock generation took "..chunk_generation_time.." ms") --tell people how long
else
minetest.log("warning", "[df_caverns] underworld took "..chunk_generation_time.." ms to generate map block "
.. minetest.pos_to_string(minp) .. minetest.pos_to_string(maxp))
end
end)

26
df_farming/LICENSE.txt Normal file
View File

@ -0,0 +1,26 @@
Dwarf Fortress is copyright 2018 by Tarn Adams. This mod uses no assets or other copyrighted materials from Dwarf Fortress.
Sounds and textures are under various licenses, see the license.txt file in the /sounds and /textures directories for details.
License for Code
----------------
Copyright (C) 2018 FaceDeer
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

54
df_farming/aliases.lua Normal file
View File

@ -0,0 +1,54 @@
minetest.register_alias("dfcaverns:cave_wheat" , "df_farming:cave_wheat" )
minetest.register_alias("dfcaverns:cave_flour" , "df_farming:cave_flour" )
minetest.register_alias("dfcaverns:cave_bread" , "df_farming:cave_bread" )
minetest.register_alias("dfcaverns:pig_tail_thread" , "df_farming:pig_tail_thread" )
minetest.register_alias("dfcaverns:quarry_bush_leaves" , "df_farming:quarry_bush_leaves" )
minetest.register_alias("dfcaverns:sweet_pods" , "df_farming:sweet_pods" )
minetest.register_alias("dfcaverns:sugar" , "df_farming:sugar" )
minetest.register_alias("dfcaverns:dead_fungus" , "df_farming:dead_fungus" )
minetest.register_alias("dfcaverns:cavern_fungi" , "df_farming:cavern_fungi" )
minetest.register_alias("dfcaverns:plump_helmet_spawn" , "df_farming:plump_helmet_spawn" )
minetest.register_alias("dfcaverns:plump_helmet_1" , "df_farming:plump_helmet_1" )
minetest.register_alias("dfcaverns:plump_helmet_2" , "df_farming:plump_helmet_2" )
minetest.register_alias("dfcaverns:plump_helmet_3" , "df_farming:plump_helmet_3" )
minetest.register_alias("dfcaverns:plump_helmet_4" , "df_farming:plump_helmet_4" )
minetest.register_alias("dfcaverns:plump_helmet_4_picked", "df_farming:plump_helmet_4_picked")
minetest.register_alias("dfcaverns:cave_wheat_1" , "df_farming:cave_wheat_1" )
minetest.register_alias("dfcaverns:cave_wheat_2" , "df_farming:cave_wheat_2" )
minetest.register_alias("dfcaverns:cave_wheat_3" , "df_farming:cave_wheat_3" )
minetest.register_alias("dfcaverns:cave_wheat_4" , "df_farming:cave_wheat_4" )
minetest.register_alias("dfcaverns:cave_wheat_5" , "df_farming:cave_wheat_5" )
minetest.register_alias("dfcaverns:cave_wheat_6" , "df_farming:cave_wheat_6" )
minetest.register_alias("dfcaverns:cave_wheat_7" , "df_farming:cave_wheat_7" )
minetest.register_alias("dfcaverns:cave_wheat_8" , "df_farming:cave_wheat_8" )
minetest.register_alias("dfcaverns:cave_wheat_seed" , "df_farming:cave_wheat_seed" )
minetest.register_alias("dfcaverns:dimple_cup_1" , "df_farming:dimple_cup_1" )
minetest.register_alias("dfcaverns:dimple_cup_2" , "df_farming:dimple_cup_2" )
minetest.register_alias("dfcaverns:dimple_cup_3" , "df_farming:dimple_cup_3" )
minetest.register_alias("dfcaverns:dimple_cup_4" , "df_farming:dimple_cup_4" )
minetest.register_alias("dfcaverns:dimple_cup_seed" , "df_farming:dimple_cup_seed" )
minetest.register_alias("dfcaverns:pig_tail_1" , "df_farming:pig_tail_1" )
minetest.register_alias("dfcaverns:pig_tail_2" , "df_farming:pig_tail_2" )
minetest.register_alias("dfcaverns:pig_tail_3" , "df_farming:pig_tail_3" )
minetest.register_alias("dfcaverns:pig_tail_4" , "df_farming:pig_tail_4" )
minetest.register_alias("dfcaverns:pig_tail_5" , "df_farming:pig_tail_5" )
minetest.register_alias("dfcaverns:pig_tail_6" , "df_farming:pig_tail_6" )
minetest.register_alias("dfcaverns:pig_tail_7" , "df_farming:pig_tail_7" )
minetest.register_alias("dfcaverns:pig_tail_8" , "df_farming:pig_tail_8" )
minetest.register_alias("dfcaverns:pig_tail_seed" , "df_farming:pig_tail_seed" )
minetest.register_alias("dfcaverns:quarry_bush_1" , "df_farming:quarry_bush_1" )
minetest.register_alias("dfcaverns:quarry_bush_2" , "df_farming:quarry_bush_2" )
minetest.register_alias("dfcaverns:quarry_bush_3" , "df_farming:quarry_bush_3" )
minetest.register_alias("dfcaverns:quarry_bush_4" , "df_farming:quarry_bush_4" )
minetest.register_alias("dfcaverns:quarry_bush_5" , "df_farming:quarry_bush_5" )
minetest.register_alias("dfcaverns:quarry_bush_seed" , "df_farming:quarry_bush_seed" )
minetest.register_alias("dfcaverns:sweet_pod_1" , "df_farming:sweet_pod_1" )
minetest.register_alias("dfcaverns:sweet_pod_2" , "df_farming:sweet_pod_2" )
minetest.register_alias("dfcaverns:sweet_pod_3" , "df_farming:sweet_pod_3" )
minetest.register_alias("dfcaverns:sweet_pod_4" , "df_farming:sweet_pod_4" )
minetest.register_alias("dfcaverns:sweet_pod_5" , "df_farming:sweet_pod_5" )
minetest.register_alias("dfcaverns:sweet_pod_6" , "df_farming:sweet_pod_6" )
minetest.register_alias("dfcaverns:sweet_pod_seed" , "df_farming:sweet_pod_seed" )
minetest.register_alias("dfcaverns:dwarven_syrup_source" , "df_farming:dwarven_syrup_source" )
minetest.register_alias("dfcaverns:dwarven_syrup_flowing", "df_farming:dwarven_syrup_flowing")
minetest.register_alias("dfcaverns:dwarven_syrup_bucket" , "df_farming:dwarven_syrup_bucket" )

131
df_farming/cave_wheat.lua Normal file
View File

@ -0,0 +1,131 @@
-- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
local wheat_grow_time = df_farming.config.plant_growth_time * df_farming.config.cave_wheat_delay_multiplier / 8
local register_cave_wheat = function(number)
local name = "df_farming:cave_wheat_"..tostring(number)
local def = {
description = S("Cave Wheat"),
_doc_items_longdesc = df_farming.doc.cave_wheat_desc,
_doc_items_usagehelp = df_farming.doc.cave_wheat_usage,
drawtype = "plantlike",
paramtype2 = "meshoptions",
place_param2 = 3,
tiles = {"dfcaverns_cave_wheat_"..tostring(number)..".png"},
inventory_image = "dfcaverns_cave_wheat_"..tostring(number)..".png",
paramtype = "light",
walkable = false,
buildable_to = true,
floodable = true,
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11},
sounds = default.node_sound_leaves_defaults(),
on_timer = function(pos, elapsed)
df_farming.grow_underground_plant(pos, name, elapsed)
end,
drop = {
max_items = 1,
items = {
{
items = {'df_farming:cave_wheat_seed 2', 'df_farming:cave_wheat'},
rarity = 9-number,
},
{
items = {'df_farming:cave_wheat_seed 1', 'df_farming:cave_wheat'},
rarity = 9-number,
},
{
items = {'df_farming:cave_wheat_seed'},
rarity = 9-number,
},
},
},
}
if number < 8 then
def._dfcaverns_next_stage_time = wheat_grow_time
def._dfcaverns_next_stage = "df_farming:cave_wheat_"..tostring(number+1)
end
minetest.register_node(name, def)
end
for i = 1,8 do
register_cave_wheat(i)
end
local place_list = {
minetest.get_content_id("df_farming:cave_wheat_1"),
minetest.get_content_id("df_farming:cave_wheat_2"),
minetest.get_content_id("df_farming:cave_wheat_3"),
minetest.get_content_id("df_farming:cave_wheat_4"),
minetest.get_content_id("df_farming:cave_wheat_5"),
minetest.get_content_id("df_farming:cave_wheat_6"),
minetest.get_content_id("df_farming:cave_wheat_7"),
minetest.get_content_id("df_farming:cave_wheat_8"),
}
-- doesn't set the timer running, so plants placed by this method won't grow
df_farming.spawn_cave_wheat_vm = function(vi, area, data, param2_data)
data[vi] = place_list[math.random(1,8)]
param2_data[vi] = 3
end
df_farming.register_seed(
"cave_wheat_seed",
S("Cave Wheat Seed"),
"dfcaverns_cave_wheat_seed.png",
"df_farming:cave_wheat_1",
wheat_grow_time,
df_farming.doc.cave_wheat_desc,
df_farming.doc.cave_wheat_usage)
minetest.register_craftitem("df_farming:cave_wheat", {
description = S("Cave Wheat"),
_doc_items_longdesc = df_farming.doc.cave_wheat_desc,
_doc_items_usagehelp = df_farming.doc.cave_wheat_usage,
inventory_image = "dfcaverns_cave_wheat.png",
stack_max = 99,
})
minetest.register_craft({
type = "fuel",
recipe = "df_farming:cave_wheat",
burntime = 2
})
minetest.register_craftitem("df_farming:cave_flour", {
description = S("Cave Wheat Flour"),
_doc_items_longdesc = df_farming.doc.cave_flour_desc,
_doc_items_usagehelp = df_farming.doc.cave_flour_usage,
inventory_image = "dfcaverns_flour.png",
groups = {flammable = 1, dfcaverns_cookable = 1},
})
minetest.register_craftitem("df_farming:cave_bread", {
description = S("Dwarven Bread"),
_doc_items_longdesc = df_farming.doc.cave_bread_desc,
_doc_items_usagehelp = df_farming.doc.cave_bread_usage,
inventory_image = "dfcaverns_bread.png",
on_use = minetest.item_eat(5),
groups = {flammable = 2, food = 5},
})
if minetest.get_modpath("cottages") then
cottages.handmill_product["df_farming:cave_wheat"] = "df_farming:cave_flour";
else
minetest.register_craft({
type = "shapeless",
output = "df_farming:cave_flour",
recipe = {"df_farming:cave_wheat", "df_farming:cave_wheat", "df_farming:cave_wheat", "df_farming:cave_wheat"}
})
end
minetest.register_craft({
type = "cooking",
cooktime = 15,
output = "df_farming:cave_bread",
recipe = "df_farming:cave_flour"
})

43
df_farming/config.lua Normal file
View File

@ -0,0 +1,43 @@
local CONFIG_FILE_PREFIX = "dfcaverns_"
df_farming.config = {}
local print_settingtypes = false
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
df_farming.config[name] = value
if print_settingtypes then
minetest.debug(CONFIG_FILE_PREFIX..name.." ("..description..") "..stype.." "..tostring(default))
end
end
local plants = {
{name="cave_wheat", delay_multiplier=1},
{name="dimple_cup", delay_multiplier=3},
{name="pig_tail", delay_multiplier=1},
{name="plump_helmet", delay_multiplier=3},
{name="quarry_bush", delay_multiplier=2},
{name="sweet_pod", delay_multiplier=2},
}
--Plants
setting("int", "plant_growth_time", 500, "Base plant growth time")
for _, plant in pairs(plants) do
setting("float", plant.name.."_delay_multiplier", plant.delay_multiplier, plant.name.." growth delay multiplier")
end
setting("bool", "light_kills_fungus", true, "Light kills fungus")

98
df_farming/cooking.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")
local register_cooking_recipes = function(prefix, item, name, returns)
minetest.register_craftitem("df_farming:"..item.."_biscuit", {
description = S("@1 Biscuit", name),
_doc_items_longdesc = df_farming.doc.biscuit_desc,
_doc_items_usagehelp = df_farming.doc.biscuit_usage,
inventory_image = "dfcaverns_biscuit.png",
on_use = minetest.item_eat(4),
groups = {food = 4},
})
minetest.register_craftitem("df_farming:"..item.."_stew", {
description = S("@1 Stew", name),
_doc_items_longdesc = df_farming.doc.stew_desc,
_doc_items_usagehelp = df_farming.doc.stew_usage,
inventory_image = "dfcaverns_stew.png",
on_use = minetest.item_eat(6),
groups = {food = 6},
})
minetest.register_craftitem("df_farming:"..item.."_roast", {
description = S("@1 Roast", name),
_doc_items_longdesc = df_farming.doc.roast_desc,
_doc_items_usagehelp = df_farming.doc.roast_usage,
inventory_image = "dfcaverns_roast.png",
on_use = minetest.item_eat(8),
groups = {food = 8},
})
minetest.register_alias("dfcaverns:"..item.."_biscuit", "df_farming:"..item.."_biscuit")
minetest.register_alias("dfcaverns:"..item.."_stew", "df_farming:"..item.."_stew")
minetest.register_alias("dfcaverns:"..item.."_roast", "df_farming:"..item.."_roast")
if minetest.get_modpath("simplecrafting_lib") then
simplecrafting_lib.register("cooking", {
input = {
["group:dfcaverns_cookable"] = 1,
[prefix..":"..item] = 1,
},
output = {
["df_farming:"..item.."_biscuit"] = 1,
},
cooktime = 5.0,
})
simplecrafting_lib.register("cooking", {
input = {
["group:dfcaverns_cookable"] = 2,
[prefix..":"..item] = 1,
},
output = {
["df_farming:"..item.."_stew"] = 1,
},
cooktime = 10.0,
})
simplecrafting_lib.register("cooking", {
input = {
["group:dfcaverns_cookable"] = 3,
[prefix..":"..item] = 1,
},
output = {
["df_farming:"..item.."_roast"] = 1,
},
cooktime = 15.0,
})
else
minetest.register_craft({
type = "shapeless",
output = "df_farming:"..item.."_biscuit",
recipe = {"group:dfcaverns_cookable", prefix..":"..item},
replacements = returns
})
minetest.register_craft({
type = "shapeless",
output = "df_farming:"..item.."_stew",
recipe = {"group:dfcaverns_cookable", "group:dfcaverns_cookable", prefix..":"..item},
replacements = returns
})
minetest.register_craft({
type = "shapeless",
output = "df_farming:"..item.."_roast",
recipe = {"group:dfcaverns_cookable", "group:dfcaverns_cookable", "group:dfcaverns_cookable", prefix..":"..item},
replacements = returns
})
end
end
register_cooking_recipes("df_farming", "cave_flour", S("Cave Wheat Flour"))
register_cooking_recipes("df_farming", "cave_wheat_seed", S("Cave Wheat Seed"))
register_cooking_recipes("df_farming", "sweet_pod_seed", S("Sweet Pod Spore"))
register_cooking_recipes("df_farming", "sugar", S("Sweet Pod Sugar"))
register_cooking_recipes("group", "plump_helmet", S("Plump Helmet"))
register_cooking_recipes("df_farming", "plump_helmet_spawn", S("Plump Helmet Spawn"))
register_cooking_recipes("df_farming", "quarry_bush_leaves", S("Quarry Bush Leaf"))
register_cooking_recipes("df_farming", "quarry_bush_seed", S("Rock Nut"))
register_cooking_recipes("df_farming", "dimple_cup_seed", S("Dimple Cup Spore"))
register_cooking_recipes("df_farming", "pig_tail_seed", S("Pig Tail Spore"))
register_cooking_recipes("df_farming", "dwarven_syrup_bucket", S("Dwarven Syrup"), {{"df_farming:dwarven_syrup_bucket", "bucket:bucket_empty"}})

View File

@ -1,12 +1,9 @@
default
subterrane
farming?
cottages?
bucket?
dynamic_liquid?
wool?
magma_conduits?
intllib?
doc?
simplecrafting_lib?
radiant_damage?

View File

@ -0,0 +1 @@
Adds farmable underground plants that die in sunlight. Also includes various cooking reactions.

73
df_farming/dimple_cup.lua Normal file
View File

@ -0,0 +1,73 @@
-- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
local dimple_grow_time = df_farming.config.plant_growth_time * df_farming.config.dimple_cup_delay_multiplier / 4
local register_dimple_cup = function(number)
local name = "df_farming:dimple_cup_"..tostring(number)
local def = {
description = S("Dimple Cup"),
_doc_items_longdesc = df_farming.doc.dimple_cup_desc,
_doc_items_usagehelp = df_farming.doc.dimple_cup_usage,
drawtype = "plantlike",
tiles = {"dfcaverns_dimple_cup_"..tostring(number)..".png"},
inventory_image = "dfcaverns_dimple_cup_"..tostring(number)..".png",
paramtype = "light",
walkable = false,
floodable = true,
buildable_to = true,
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, color_blue = 1, light_sensitive_fungus = 11, flower = 1},
sounds = default.node_sound_leaves_defaults(),
on_timer = function(pos, elapsed)
df_farming.grow_underground_plant(pos, name, elapsed)
end,
drop = {
max_items = 1,
items = {
{
items = {'df_farming:dimple_cup_seed 2', 'df_farming:dimple_cup_4'},
rarity = 7-number,
},
{
items = {'df_farming:dimple_cup_seed 1', 'df_farming:dimple_cup_4'},
rarity = 5-number,
},
},
},
}
if number < 4 then
def._dfcaverns_next_stage_time = dimple_grow_time
def._dfcaverns_next_stage = "df_farming:dimple_cup_"..tostring(number+1)
end
minetest.register_node(name, def)
end
for i = 1,4 do
register_dimple_cup(i)
end
local place_list = {
minetest.get_content_id("df_farming:dimple_cup_1"),
minetest.get_content_id("df_farming:dimple_cup_2"),
minetest.get_content_id("df_farming:dimple_cup_3"),
minetest.get_content_id("df_farming:dimple_cup_4"),
}
-- doesn't set the timer running, so plants placed by this method won't grow
df_farming.spawn_dimple_cup_vm = function(vi, area, data, param2_data)
data[vi] = place_list[math.random(1,4)]
param2_data[vi] = 0
end
df_farming.register_seed(
"dimple_cup_seed",
S("Dimple Cup Spores"),
"dfcaverns_dimple_cup_seed.png",
"df_farming:dimple_cup_1",
dimple_grow_time,
df_farming.doc.dimple_cup_desc,
df_farming.doc.dimple_cup_usage)

62
df_farming/doc.lua Normal file
View File

@ -0,0 +1,62 @@
df_farming.doc = {}
if not minetest.get_modpath("doc") then
return
end
-- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
df_farming.doc.biscuit_desc = S("A meal made from the admixture of two ingredients, biscuits keep well but are not a rich source of nutrients.")
df_farming.doc.biscuit_usage = nil
df_farming.doc.stew_desc = S("Stews mix three ingredients together. They're more wholesome than biscuits, packing more nutrition into a single serving.")
df_farming.doc.stew_usage = nil
df_farming.doc.roast_desc = S("Four finely minced ingredients combine into a roast, which serves as a full meal.")
df_farming.doc.roast_usage = nil
-- Plants
df_farming.doc.dead_fungus_desc = S("Whatever this fungus was in life, it is now dead.")
df_farming.doc.dead_fungus_usage = S("Dead fungus quickly decays into an unrecognizable mess. It can be used as weak fuel or terrible decor.")
df_farming.doc.cavern_fungi_desc = S("A species of lavender mushroom ubiquitous in caves that is most notable for the soft bioluminescence it produces.")
df_farming.doc.cavern_fungi_usage = S("This mushroom is inedible but continues producing modest levels of light long after it's picked.")
df_farming.doc.cave_wheat_desc = S("Cave wheat is literally a breed of grain-producing grass that somehow lost its ability to photosynthesize and adapted to a more fungal style of life.")
df_farming.doc.cave_wheat_usage = S("Like its surface cousin, cave wheat produces grain that can be ground into a form of flour.")
df_farming.doc.cave_flour_desc = S("Cave wheat seed ground into a powder suitable for cooking.")
df_farming.doc.cave_flour_usage = S("When baked alone it forms an edible bread, but it combines well with other more flavorful ingredients.")
df_farming.doc.cave_bread_desc = S("Bread baked from cave wheat flour is tough and durable. A useful ration for long expeditions.")
df_farming.doc.cave_bread_usage = S("It's not tasty, but it keeps you going.")
df_farming.doc.dimple_cup_desc = S("The distinctive midnight-blue caps of these mushrooms are inverted, exposing their gills to any breeze that might pass, and have dimpled edges that give them their name.")
df_farming.doc.dimple_cup_usage = S("Dimple cups can be dried, ground, and processed to extract a deep blue dye.")
df_farming.doc.pig_tail_desc = S("Pig tails are a fibrous fungal growth that's most notable for its twisting stalks. In a mature stand of pig tails the helical stalks intertwine into a dense mesh.")
df_farming.doc.pig_tail_usage = S("Pig tail stalks can be processed to extract fibers useful as thread.")
df_farming.doc.pig_tail_thread_desc = S("Threads of pig tail fiber.")
df_farming.doc.pig_tail_thread_usage = S("A crafting item that can be woven into textiles and other similar items.")
df_farming.doc.plump_helmet_desc = S("Plump helmets are a thick, fleshy mushroom that's edible picked straight from the ground. They form a staple diet for both lost cave explorers and the fauna that preys on them.")
df_farming.doc.plump_helmet_usage = S("While they can be eaten fresh, they can be monotonous fare and are perhaps better appreciated as part of a more complex prepared dish.")
df_farming.doc.quarry_bush_desc = S("A rare breed of fungus from deep underground that produces a bushy cluster of rumpled gray 'blades'. The biological function of these blades is not known, as quarry bushes reproduce via hard-shelled nodules that grow down at the blade's base.")
df_farming.doc.quarry_bush_usage = S("Quarry bush leaves and nodules (called 'rock nuts') can be harvested and are edible with processing.")
df_farming.doc.quarry_bush_leaves_desc = S("The dried blades of a quarry bush add a welcome zing to recipes containing otherwise-bland subterranean foodstuffs, but they're too spicy to be eaten on their own.")
df_farming.doc.quarry_bush_leaves_usage = S("Quarry bush leaves can be used as an ingredient in foodstuffs.")
df_farming.doc.sweet_pod_desc = S("Sweet pods grow in rich soil, and once they reach maturity they draw that supply of nutrients up to concentrate it in their fruiting bodies. They turn bright red when ripe and can be processed in a variety of ways to extract the sugars they contain.")
if minetest.get_modpath("cottages") then
df_farming.doc.sweet_pod_usage = S("When milled, sweet pods produce a granular sugary substance.")
else
df_farming.doc.sweet_pod_usage = S("When dried in an oven, sweet pods produce a granular sugary substance.")
end
df_farming.doc.sweet_pod_usage = df_farming.doc.sweet_pod_usage .. " " .. S("Crushing them in a bucket squeezes out a flavorful syrup.")
df_farming.doc.sweet_pod_sugar_desc = S("Sweet pod sugar has a pink tint to it.")
df_farming.doc.sweet_pod_sugar_usage = S("Too sweet to be eaten directly, it makes an excellent ingredient in food recipes.")
df_farming.doc.sweet_pod_syrup_desc = S("Sweet pod syrup is thick and flavorful.")
df_farming.doc.sweet_pod_syrup_usage = S("Too strong and thick to drink straight, sweet pod syrup is useful in food recipes.")

18
df_farming/init.lua Normal file
View File

@ -0,0 +1,18 @@
df_farming = {}
--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.."/doc.lua")
dofile(modpath.."/aliases.lua")
dofile(modpath.."/plants.lua") -- general functions
dofile(modpath.."/cave_wheat.lua")
dofile(modpath.."/dimple_cup.lua")
dofile(modpath.."/pig_tail.lua")
dofile(modpath.."/plump_helmet.lua")
dofile(modpath.."/quarry_bush.lua")
dofile(modpath.."/sweet_pod.lua")
dofile(modpath.."/cooking.lua")

336
df_farming/locale/it.po Normal file
View File

@ -0,0 +1,336 @@
# ITALIAN LOCALE FOR THE DFCAVERNS MODULE
# Copyright (C) 2017 FaceDeer <derksenmobile@gmail.com>
# This file is distributed under the same license as the DFCAVERNS package.
# Hamlet <h4mlet@riseup.net>, 2017.
#
msgid ""
msgstr ""
"Project-Id-Version: dfcaverns module's Italian locale\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-12-23 00:27-0700\n"
"PO-Revision-Date: 2017-08-17 23:01+0100\n"
"Last-Translator: H4mlet <h4mlet@riseup.net>\n"
"Language-Team: ITALIANO\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.6.10\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: df_farming\cave_wheat.lua:10
#: df_farming\cave_wheat.lua:70
msgid "Cave Wheat"
msgstr "Grano di caverna"
#: df_farming\cave_wheat.lua:62
#: df_farming\cooking.lua:89
msgid "Cave Wheat Seed"
msgstr "Seme di grano di caverna"
#: df_farming\cave_wheat.lua:83
#: df_farming\cooking.lua:88
msgid "Cave Wheat Flour"
msgstr "Farina di grano di caverna"
#: df_farming\cave_wheat.lua:91
msgid "Dwarven Bread"
msgstr "Pane nanico"
#: df_farming\cooking.lua:7
msgid "@1 Biscuit"
msgstr "Biscotto di @1"
#: df_farming\cooking.lua:15
msgid "@1 Stew"
msgstr "Stufato di @1"
#: df_farming\cooking.lua:23
msgid "@1 Roast"
msgstr "Arrosto di @1"
#: df_farming\cooking.lua:90
msgid "Sweet Pod Spore"
msgstr "Spora di baccello dolce"
#: df_farming\cooking.lua:91
#: df_farming\sweet_pod.lua:84
msgid "Sweet Pod Sugar"
msgstr "Zucchero di baccello dolce"
#: df_farming\cooking.lua:92
#: df_farming\plump_helmet.lua:92
#: df_farming\plump_helmet.lua:129
#: df_farming\plump_helmet.lua:164
#: df_farming\plump_helmet.lua:199
#: df_farming\plump_helmet.lua:251
msgid "Plump Helmet"
msgstr "Elmo rotondo"
#: df_farming\cooking.lua:93
#: df_farming\plump_helmet.lua:61
msgid "Plump Helmet Spawn"
msgstr "Prole di elmo rotondo"
#: df_farming\cooking.lua:94
msgid "Quarry Bush Leaf"
msgstr "Foglia di cespuglio di cava"
#: df_farming\cooking.lua:95
msgid "Rock Nut"
msgstr "Noce di roccia"
#: df_farming\cooking.lua:96
msgid "Dimple Cup Spore"
msgstr "Spora di coppa increspata"
#: df_farming\cooking.lua:97
#: df_farming\pig_tail.lua:62
msgid "Pig Tail Spore"
msgstr "Spora di coda di maiale"
#: df_farming\cooking.lua:98
msgid "Dwarven Syrup"
msgstr "Sciroppo nanico"
#: df_farming\dimple_cup.lua:10
msgid "Dimple Cup"
msgstr "Coppa increspata"
#: df_farming\dimple_cup.lua:56
msgid "Dimple Cup Spores"
msgstr "Spore di coppa increspata"
#: df_farming\doc.lua:11
msgid ""
"A meal made from the admixture of two ingredients, biscuits keep well but "
"are not a rich source of nutrients."
msgstr ""
#: df_farming\doc.lua:13
msgid ""
"Stews mix three ingredients together. They're more wholesome than biscuits, "
"packing more nutrition into a single serving."
msgstr ""
#: df_farming\doc.lua:15
msgid ""
"Four finely minced ingredients combine into a roast, which serves as a full "
"meal."
msgstr ""
#: df_farming\doc.lua:21
msgid "Whatever this fungus was in life, it is now dead."
msgstr ""
#: df_farming\doc.lua:22
msgid ""
"Dead fungus quickly decays into an unrecognizable mess. It can be used as "
"weak fuel or terrible decor."
msgstr ""
#: df_farming\doc.lua:24
msgid ""
"A species of lavender mushroom ubiquitous in caves that is most notable for "
"the soft bioluminescence it produces."
msgstr ""
#: df_farming\doc.lua:25
msgid ""
"This mushroom is inedible but continues producing modest levels of light "
"long after it's picked."
msgstr ""
#: df_farming\doc.lua:27
msgid ""
"Cave wheat is literally a breed of grain-producing grass that somehow lost "
"its ability to photosynthesize and adapted to a more fungal style of life."
msgstr ""
#: df_farming\doc.lua:28
msgid ""
"Like its surface cousin, cave wheat produces grain that can be ground into a "
"form of flour."
msgstr ""
#: df_farming\doc.lua:29
msgid "Cave wheat seed ground into a powder suitable for cooking."
msgstr ""
#: df_farming\doc.lua:30
msgid ""
"When baked alone it forms an edible bread, but it combines well with other "
"more flavorful ingredients."
msgstr ""
#: df_farming\doc.lua:31
msgid ""
"Bread baked from cave wheat flour is tough and durable. A useful ration for "
"long expeditions."
msgstr ""
#: df_farming\doc.lua:32
msgid "It's not tasty, but it keeps you going."
msgstr ""
#: df_farming\doc.lua:34
msgid ""
"The distinctive midnight-blue caps of these mushrooms are inverted, exposing "
"their gills to any breeze that might pass, and have dimpled edges that give "
"them their name."
msgstr ""
#: df_farming\doc.lua:35
msgid ""
"Dimple cups can be dried, ground, and processed to extract a deep blue dye."
msgstr ""
#: df_farming\doc.lua:37
msgid ""
"Pig tails are a fibrous fungal growth that's most notable for its twisting "
"stalks. In a mature stand of pig tails the helical stalks intertwine into a "
"dense mesh."
msgstr ""
#: df_farming\doc.lua:38
msgid "Pig tail stalks can be processed to extract fibers useful as thread."
msgstr ""
#: df_farming\doc.lua:39
msgid "Threads of pig tail fiber."
msgstr ""
#: df_farming\doc.lua:40
msgid ""
"A crafting item that can be woven into textiles and other similar items."
msgstr ""
#: df_farming\doc.lua:42
msgid ""
"Plump helmets are a thick, fleshy mushroom that's edible picked straight "
"from the ground. They form a staple diet for both lost cave explorers and "
"the fauna that preys on them."
msgstr ""
#: df_farming\doc.lua:43
msgid ""
"While they can be eaten fresh, they can be monotonous fare and are perhaps "
"better appreciated as part of a more complex prepared dish."
msgstr ""
#: df_farming\doc.lua:45
msgid ""
"A rare breed of fungus from deep underground that produces a bushy cluster "
"of rumpled gray 'blades'. The biological function of these blades is not "
"known, as quarry bushes reproduce via hard-shelled nodules that grow down at "
"the blade's base."
msgstr ""
#: df_farming\doc.lua:46
msgid ""
"Quarry bush leaves and nodules (called 'rock nuts') can be harvested and are "
"edible with processing."
msgstr ""
#: df_farming\doc.lua:47
msgid ""
"The dried blades of a quarry bush add a welcome zing to recipes containing "
"otherwise-bland subterranean foodstuffs, but they're too spicy to be eaten "
"on their own."
msgstr ""
#: df_farming\doc.lua:48
msgid "Quarry bush leaves can be used as an ingredient in foodstuffs."
msgstr ""
#: df_farming\doc.lua:50
msgid ""
"Sweet pods grow in rich soil, and once they reach maturity they draw that "
"supply of nutrients up to concentrate it in their fruiting bodies. They turn "
"bright red when ripe and can be processed in a variety of ways to extract "
"the sugars they contain."
msgstr ""
#: df_farming\doc.lua:53
msgid "When milled, sweet pods produce a granular sugary substance."
msgstr ""
#: df_farming\doc.lua:55
msgid "When dried in an oven, sweet pods produce a granular sugary substance."
msgstr ""
#: df_farming\doc.lua:57
msgid "Crushing them in a bucket squeezes out a flavorful syrup."
msgstr ""
#: df_farming\doc.lua:59
msgid "Sweet pod sugar has a pink tint to it."
msgstr ""
#: df_farming\doc.lua:60
msgid ""
"Too sweet to be eaten directly, it makes an excellent ingredient in food "
"recipes."
msgstr ""
#: df_farming\doc.lua:61
msgid "Sweet pod syrup is thick and flavorful."
msgstr ""
#: df_farming\doc.lua:62
msgid ""
"Too strong and thick to drink straight, sweet pod syrup is useful in food "
"recipes."
msgstr ""
#: df_farming\pig_tail.lua:10
msgid "Pig Tail"
msgstr "Coda di maiale"
#: df_farming\pig_tail.lua:70
msgid "Pig tail thread"
msgstr "Filo di coda di maiale"
#: df_farming\plants.lua:10
msgid "Dead Fungus"
msgstr "Fungo morto"
#: df_farming\plants.lua:36
msgid "Cavern Fungi"
msgstr "Funghi di caverna"
#: df_farming\quarry_bush.lua:10
msgid "Quarry Bush"
msgstr "Cespuglio di cava"
#: df_farming\quarry_bush.lua:62
msgid "Rock Nuts"
msgstr "Noci di roccia"
#: df_farming\quarry_bush.lua:71
msgid "Quarry Bush Leaves"
msgstr "Foglie di cespuglio di cava"
#: df_farming\sweet_pod.lua:10
msgid "Sweet Pod"
msgstr "Baccello dolce"
#: df_farming\sweet_pod.lua:60
msgid "Sweet Pod Spores"
msgstr "Spore di baccello dolce"
#: df_farming\sweet_pod.lua:68
msgid "Sweet Pods"
msgstr "Baccelli dolci"
#: df_farming\sweet_pod.lua:107
msgid "Dwarven Syrup Source"
msgstr "Fonte di sciroppo nanico"
#: df_farming\sweet_pod.lua:155
msgid "Flowing Dwarven Syrup"
msgstr "Sciroppo nanico che scorre"
#: df_farming\sweet_pod.lua:208
msgid "Dwarven Syrup Bucket"
msgstr "Secchio di sciroppo nanico"

View File

@ -0,0 +1,335 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-12-23 00:27-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: df_farming\cave_wheat.lua:10
#: df_farming\cave_wheat.lua:70
msgid "Cave Wheat"
msgstr ""
#: df_farming\cave_wheat.lua:62
#: df_farming\cooking.lua:89
msgid "Cave Wheat Seed"
msgstr ""
#: df_farming\cave_wheat.lua:83
#: df_farming\cooking.lua:88
msgid "Cave Wheat Flour"
msgstr ""
#: df_farming\cave_wheat.lua:91
msgid "Dwarven Bread"
msgstr ""
#: df_farming\cooking.lua:7
msgid "@1 Biscuit"
msgstr ""
#: df_farming\cooking.lua:15
msgid "@1 Stew"
msgstr ""
#: df_farming\cooking.lua:23
msgid "@1 Roast"
msgstr ""
#: df_farming\cooking.lua:90
msgid "Sweet Pod Spore"
msgstr ""
#: df_farming\cooking.lua:91
#: df_farming\sweet_pod.lua:84
msgid "Sweet Pod Sugar"
msgstr ""
#: df_farming\cooking.lua:92
#: df_farming\plump_helmet.lua:92
#: df_farming\plump_helmet.lua:129
#: df_farming\plump_helmet.lua:164
#: df_farming\plump_helmet.lua:199
#: df_farming\plump_helmet.lua:251
msgid "Plump Helmet"
msgstr ""
#: df_farming\cooking.lua:93
#: df_farming\plump_helmet.lua:61
msgid "Plump Helmet Spawn"
msgstr ""
#: df_farming\cooking.lua:94
msgid "Quarry Bush Leaf"
msgstr ""
#: df_farming\cooking.lua:95
msgid "Rock Nut"
msgstr ""
#: df_farming\cooking.lua:96
msgid "Dimple Cup Spore"
msgstr ""
#: df_farming\cooking.lua:97
#: df_farming\pig_tail.lua:62
msgid "Pig Tail Spore"
msgstr ""
#: df_farming\cooking.lua:98
msgid "Dwarven Syrup"
msgstr ""
#: df_farming\dimple_cup.lua:10
msgid "Dimple Cup"
msgstr ""
#: df_farming\dimple_cup.lua:56
msgid "Dimple Cup Spores"
msgstr ""
#: df_farming\doc.lua:11
msgid ""
"A meal made from the admixture of two ingredients, biscuits keep well but "
"are not a rich source of nutrients."
msgstr ""
#: df_farming\doc.lua:13
msgid ""
"Stews mix three ingredients together. They're more wholesome than biscuits, "
"packing more nutrition into a single serving."
msgstr ""
#: df_farming\doc.lua:15
msgid ""
"Four finely minced ingredients combine into a roast, which serves as a full "
"meal."
msgstr ""
#: df_farming\doc.lua:21
msgid "Whatever this fungus was in life, it is now dead."
msgstr ""
#: df_farming\doc.lua:22
msgid ""
"Dead fungus quickly decays into an unrecognizable mess. It can be used as "
"weak fuel or terrible decor."
msgstr ""
#: df_farming\doc.lua:24
msgid ""
"A species of lavender mushroom ubiquitous in caves that is most notable for "
"the soft bioluminescence it produces."
msgstr ""
#: df_farming\doc.lua:25
msgid ""
"This mushroom is inedible but continues producing modest levels of light "
"long after it's picked."
msgstr ""
#: df_farming\doc.lua:27
msgid ""
"Cave wheat is literally a breed of grain-producing grass that somehow lost "
"its ability to photosynthesize and adapted to a more fungal style of life."
msgstr ""
#: df_farming\doc.lua:28
msgid ""
"Like its surface cousin, cave wheat produces grain that can be ground into a "
"form of flour."
msgstr ""
#: df_farming\doc.lua:29
msgid "Cave wheat seed ground into a powder suitable for cooking."
msgstr ""
#: df_farming\doc.lua:30
msgid ""
"When baked alone it forms an edible bread, but it combines well with other "
"more flavorful ingredients."
msgstr ""
#: df_farming\doc.lua:31
msgid ""
"Bread baked from cave wheat flour is tough and durable. A useful ration for "
"long expeditions."
msgstr ""
#: df_farming\doc.lua:32
msgid "It's not tasty, but it keeps you going."
msgstr ""
#: df_farming\doc.lua:34
msgid ""
"The distinctive midnight-blue caps of these mushrooms are inverted, exposing "
"their gills to any breeze that might pass, and have dimpled edges that give "
"them their name."
msgstr ""
#: df_farming\doc.lua:35
msgid ""
"Dimple cups can be dried, ground, and processed to extract a deep blue dye."
msgstr ""
#: df_farming\doc.lua:37
msgid ""
"Pig tails are a fibrous fungal growth that's most notable for its twisting "
"stalks. In a mature stand of pig tails the helical stalks intertwine into a "
"dense mesh."
msgstr ""
#: df_farming\doc.lua:38
msgid "Pig tail stalks can be processed to extract fibers useful as thread."
msgstr ""
#: df_farming\doc.lua:39
msgid "Threads of pig tail fiber."
msgstr ""
#: df_farming\doc.lua:40
msgid ""
"A crafting item that can be woven into textiles and other similar items."
msgstr ""
#: df_farming\doc.lua:42
msgid ""
"Plump helmets are a thick, fleshy mushroom that's edible picked straight "
"from the ground. They form a staple diet for both lost cave explorers and "
"the fauna that preys on them."
msgstr ""
#: df_farming\doc.lua:43
msgid ""
"While they can be eaten fresh, they can be monotonous fare and are perhaps "
"better appreciated as part of a more complex prepared dish."
msgstr ""
#: df_farming\doc.lua:45
msgid ""
"A rare breed of fungus from deep underground that produces a bushy cluster "
"of rumpled gray 'blades'. The biological function of these blades is not "
"known, as quarry bushes reproduce via hard-shelled nodules that grow down at "
"the blade's base."
msgstr ""
#: df_farming\doc.lua:46
msgid ""
"Quarry bush leaves and nodules (called 'rock nuts') can be harvested and are "
"edible with processing."
msgstr ""
#: df_farming\doc.lua:47
msgid ""
"The dried blades of a quarry bush add a welcome zing to recipes containing "
"otherwise-bland subterranean foodstuffs, but they're too spicy to be eaten "
"on their own."
msgstr ""
#: df_farming\doc.lua:48
msgid "Quarry bush leaves can be used as an ingredient in foodstuffs."
msgstr ""
#: df_farming\doc.lua:50
msgid ""
"Sweet pods grow in rich soil, and once they reach maturity they draw that "
"supply of nutrients up to concentrate it in their fruiting bodies. They turn "
"bright red when ripe and can be processed in a variety of ways to extract "
"the sugars they contain."
msgstr ""
#: df_farming\doc.lua:53
msgid "When milled, sweet pods produce a granular sugary substance."
msgstr ""
#: df_farming\doc.lua:55
msgid "When dried in an oven, sweet pods produce a granular sugary substance."
msgstr ""
#: df_farming\doc.lua:57
msgid "Crushing them in a bucket squeezes out a flavorful syrup."
msgstr ""
#: df_farming\doc.lua:59
msgid "Sweet pod sugar has a pink tint to it."
msgstr ""
#: df_farming\doc.lua:60
msgid ""
"Too sweet to be eaten directly, it makes an excellent ingredient in food "
"recipes."
msgstr ""
#: df_farming\doc.lua:61
msgid "Sweet pod syrup is thick and flavorful."
msgstr ""
#: df_farming\doc.lua:62
msgid ""
"Too strong and thick to drink straight, sweet pod syrup is useful in food "
"recipes."
msgstr ""
#: df_farming\pig_tail.lua:10
msgid "Pig Tail"
msgstr ""
#: df_farming\pig_tail.lua:70
msgid "Pig tail thread"
msgstr ""
#: df_farming\plants.lua:10
msgid "Dead Fungus"
msgstr ""
#: df_farming\plants.lua:36
msgid "Cavern Fungi"
msgstr ""
#: df_farming\quarry_bush.lua:10
msgid "Quarry Bush"
msgstr ""
#: df_farming\quarry_bush.lua:62
msgid "Rock Nuts"
msgstr ""
#: df_farming\quarry_bush.lua:71
msgid "Quarry Bush Leaves"
msgstr ""
#: df_farming\sweet_pod.lua:10
msgid "Sweet Pod"
msgstr ""
#: df_farming\sweet_pod.lua:60
msgid "Sweet Pod Spores"
msgstr ""
#: df_farming\sweet_pod.lua:68
msgid "Sweet Pods"
msgstr ""
#: df_farming\sweet_pod.lua:107
msgid "Dwarven Syrup Source"
msgstr ""
#: df_farming\sweet_pod.lua:155
msgid "Flowing Dwarven Syrup"
msgstr ""
#: df_farming\sweet_pod.lua:208
msgid "Dwarven Syrup Bucket"
msgstr ""

View File

@ -3,4 +3,4 @@ setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
cd ..
set LIST=
for /r %%X in (*.lua) do set LIST=!LIST! %%X
..\intllib\tools\xgettext.bat %LIST%
..\..\intllib\tools\xgettext.bat %LIST%

1
df_farming/mod.conf Normal file
View File

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

117
df_farming/pig_tail.lua Normal file
View File

@ -0,0 +1,117 @@
-- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
local pig_tail_grow_time = df_farming.config.plant_growth_time * df_farming.config.pig_tail_delay_multiplier / 8
local register_pig_tail = function(number)
local name = "df_farming:pig_tail_"..tostring(number)
local def = {
description = S("Pig Tail"),
_doc_items_longdesc = df_farming.doc.pig_tail_desc,
_doc_items_usagehelp = df_farming.doc.pig_tail_usage,
drawtype = "plantlike",
paramtype2 = "meshoptions",
place_param2 = 3,
tiles = {"dfcaverns_pig_tail_"..tostring(number)..".png"},
inventory_image = "dfcaverns_pig_tail_"..tostring(number)..".png",
paramtype = "light",
walkable = false,
floodable = true,
buildable_to = true,
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11},
sounds = default.node_sound_leaves_defaults(),
on_timer = function(pos, elapsed)
df_farming.grow_underground_plant(pos, name, elapsed)
end,
drop = {
max_items = 1,
items = {
{
items = {'df_farming:pig_tail_seed 2', 'df_farming:pig_tail_thread 2'},
rarity = 9-number,
},
{
items = {'df_farming:pig_tail_seed 1', 'df_farming:pig_tail_thread'},
rarity = 9-number,
},
{
items = {'df_farming:pig_tail_seed'},
rarity = 9-number,
},
},
},
}
if number < 8 then
def._dfcaverns_next_stage_time = pig_tail_grow_time
def._dfcaverns_next_stage = "df_farming:pig_tail_"..tostring(number+1)
end
minetest.register_node(name, def)
end
for i = 1,8 do
register_pig_tail(i)
end
local place_list = {
minetest.get_content_id("df_farming:pig_tail_1"),
minetest.get_content_id("df_farming:pig_tail_2"),
minetest.get_content_id("df_farming:pig_tail_3"),
minetest.get_content_id("df_farming:pig_tail_4"),
minetest.get_content_id("df_farming:pig_tail_5"),
minetest.get_content_id("df_farming:pig_tail_6"),
minetest.get_content_id("df_farming:pig_tail_7"),
minetest.get_content_id("df_farming:pig_tail_8"),
}
-- doesn't set the timer running, so plants placed by this method won't grow
df_farming.spawn_pig_tail_vm = function(vi, area, data, param2_data)
data[vi] = place_list[math.random(1,8)]
param2_data[vi] = 3
end
df_farming.register_seed(
"pig_tail_seed",
S("Pig Tail Spore"),
"dfcaverns_pig_tail_seed.png",
"df_farming:pig_tail_1",
pig_tail_grow_time,
df_farming.doc.pig_tail_desc,
df_farming.doc.pig_tail_usage)
minetest.register_craftitem("df_farming:pig_tail_thread", {
description = S("Pig tail thread"),
_doc_items_longdesc = df_farming.doc.pig_tail_thread_desc,
_doc_items_usagehelp = df_farming.doc.pig_tail_thread_usage,
inventory_image = "dfcaverns_pig_tail_thread.png",
groups = {flammable = 1, thread = 1},
})
if minetest.get_modpath("wool") then
minetest.register_craft({
output = "wool:white",
recipe = {
{"group:thread", "group:thread"},
{"group:thread", "group:thread"},
}
})
end
if minetest.get_modpath("farming") then
minetest.register_craft({
output = "farming:string 2",
recipe = {
{"group:thread"},
{"group:thread"},
}
})
end
minetest.register_craft({
type = "fuel",
recipe = "df_farming:pig_tail_thread",
burntime = 1,
})

View File

@ -6,16 +6,17 @@ local S, NS = dofile(MP.."/intllib.lua")
-- Plants
minetest.register_node("dfcaverns:dead_fungus", {
minetest.register_node("df_farming:dead_fungus", {
description = S("Dead Fungus"),
_doc_items_longdesc = dfcaverns.doc.dead_fungus_desc,
_doc_items_usagehelp = dfcaverns.doc.dead_fungus_usage,
_doc_items_longdesc = df_farming.doc.dead_fungus_desc,
_doc_items_usagehelp = df_farming.doc.dead_fungus_usage,
drawtype = "plantlike",
tiles = {"dfcaverns_dead_fungus.png"},
inventory_image = "dfcaverns_dead_fungus.png",
paramtype = "light",
walkable = false,
buildable_to = true,
floodable = true,
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, flow_through = 1},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
@ -26,21 +27,28 @@ minetest.register_node("dfcaverns:dead_fungus", {
minetest.register_craft({
type = "fuel",
recipe = "dfcaverns:dead_fungus",
recipe = "df_farming:dead_fungus",
burntime = 2
})
local c_dead_fungus = minetest.get_content_id("df_farming:dead_fungus")
df_farming.spawn_dead_fungus_vm = function(vi, area, data, param2_data)
data[vi] = c_dead_fungus
param2_data[vi] = 0
end
-- not DF canon
minetest.register_node("dfcaverns:cavern_fungi", {
minetest.register_node("df_farming:cavern_fungi", {
description = S("Cavern Fungi"),
_doc_items_longdesc = dfcaverns.doc.cavern_fungi_desc,
_doc_items_usagehelp = dfcaverns.doc.cavern_fungi_usage,
_doc_items_longdesc = df_farming.doc.cavern_fungi_desc,
_doc_items_usagehelp = df_farming.doc.cavern_fungi_usage,
drawtype = "plantlike",
tiles = {"dfcaverns_fungi.png"},
inventory_image = "dfcaverns_fungi.png",
paramtype = "light",
walkable = false,
buildable_to = true,
floodable = true,
light_source = 6,
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11, flow_through = 1},
sounds = default.node_sound_leaves_defaults(),
@ -52,16 +60,22 @@ minetest.register_node("dfcaverns:cavern_fungi", {
minetest.register_craft({
type = "fuel",
recipe = "dfcaverns:cavern_fungi",
recipe = "df_farming:cavern_fungi",
burntime = 2
})
local c_cavern_fungi = minetest.get_content_id("df_farming:cavern_fungi")
df_farming.spawn_cavern_fungi_vm = function(vi, area, data, param2_data)
data[vi] = c_cavern_fungi
param2_data[vi] = 0
end
-----------------------------------------------------------------------------------------
local marginal = {["default:dirt"] = true, ["dfcaverns:dirt_with_cave_moss"] = true, ["dfcaverns:cobble_with_floor_fungus"] = true}
local growable = {["farming:soil_wet"] = true, ["default:dirt"] = true, ["dfcaverns:dirt_with_cave_moss"] = true, ["dfcaverns:cobble_with_floor_fungus"] = true}
local marginal = {["default:dirt"] = true, ["df_farming:dirt_with_cave_moss"] = true, ["df_farming:cobble_with_floor_fungus"] = true}
local growable = {["farming:soil_wet"] = true, ["default:dirt"] = true, ["df_farming:dirt_with_cave_moss"] = true, ["df_farming:cobble_with_floor_fungus"] = true}
dfcaverns.plant_timer = function(pos, plantname, elapsed)
df_farming.plant_timer = function(pos, plantname, elapsed)
local next_stage_time = minetest.registered_nodes[plantname]._dfcaverns_next_stage_time
if not next_stage_time then return end
@ -119,14 +133,14 @@ local place_seed = function(itemstack, placer, pointed_thing, plantname)
-- add the node and remove 1 item from the itemstack
minetest.add_node(pt.above, {name = plantname, param2 = 1})
dfcaverns.plant_timer(pt.above, plantname)
df_farming.plant_timer(pt.above, plantname)
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end
dfcaverns.register_seed = function(name, description, image, stage_one, grow_time, desc, usage)
df_farming.register_seed = function(name, description, image, stage_one, grow_time, desc, usage)
local def = {
description = description,
_doc_items_longdesc = desc,
@ -141,6 +155,7 @@ dfcaverns.register_seed = function(name, description, image, stage_one, grow_tim
_dfcaverns_next_stage_time = grow_time,
paramtype = "light",
walkable = false,
floodable = true,
sunlight_propagates = true,
selection_box = {
type = "fixed",
@ -148,23 +163,23 @@ dfcaverns.register_seed = function(name, description, image, stage_one, grow_tim
},
on_place = function(itemstack, placer, pointed_thing)
return place_seed(itemstack, placer, pointed_thing, "dfcaverns:"..name)
return place_seed(itemstack, placer, pointed_thing, "df_farming:"..name)
end,
on_timer = function(pos, elapsed)
dfcaverns.grow_underground_plant(pos, "dfcaverns:"..name, elapsed)
df_farming.grow_underground_plant(pos, "df_farming:"..name, elapsed)
end,
}
minetest.register_node("dfcaverns:"..name, def)
minetest.register_node("df_farming:"..name, def)
minetest.register_craft({
type = "fuel",
recipe = "dfcaverns:"..name,
recipe = "df_farming:"..name,
burntime = 1
})
end
dfcaverns.grow_underground_plant = function(pos, plant_name, elapsed)
df_farming.grow_underground_plant = function(pos, plant_name, elapsed)
local node_def = minetest.registered_nodes[plant_name]
local next_stage = node_def._dfcaverns_next_stage
if next_stage then
@ -173,26 +188,26 @@ dfcaverns.grow_underground_plant = function(pos, plant_name, elapsed)
local next_def = minetest.registered_nodes[next_stage]
local node = minetest.get_node(pos)
minetest.swap_node(pos, {name=next_stage, param2 = next_def.place_param2 or node.param2})
dfcaverns.plant_timer(pos, next_stage, elapsed)
df_farming.plant_timer(pos, next_stage, elapsed)
else
dfcaverns.plant_timer(pos, plant_name) -- reset timer, check again later
df_farming.plant_timer(pos, plant_name) -- reset timer, check again later
end
end
end
if dfcaverns.config.light_kills_fungus then
if df_farming.config.light_kills_fungus then
minetest.register_abm({
label = "dfcaverns:kill_light_sensitive_fungus",
label = "df_farming:kill_light_sensitive_fungus",
nodenames = {"group:light_sensitive_fungus"},
catch_up = true,
interval = 30,
chance = 5,
action = function(pos, node)
local node_def = minetest.registered_nodes[node.name]
local dead_node = node_def._dfcaverns_dead_node or "dfcaverns:dead_fungus"
local dead_node = node_def._dfcaverns_dead_node or "df_farming:dead_fungus"
-- 11 is the value adjacent to a torch
local light_level = minetest.get_node_light(pos)
if light_level and node_def.groups.light_sensitive_fungus and light_level > node_def.groups.light_sensitive_fungus then
if light_level and light_level > node_def.groups.light_sensitive_fungus then
minetest.set_node(pos, {name=dead_node, param2 = node.param2})
end
end

View File

@ -5,7 +5,7 @@ local S, NS = dofile(MP.."/intllib.lua")
local displace_x = 0.125
local displace_z = 0.125
local plump_helmet_grow_time = dfcaverns.config.plant_growth_time * dfcaverns.config.cave_wheat_delay_multiplier / 4
local plump_helmet_grow_time = df_farming.config.plant_growth_time * df_farming.config.cave_wheat_delay_multiplier / 4
local plump_helmet_on_place = function(itemstack, placer, pointed_thing, plantname)
local pt = pointed_thing
@ -49,7 +49,7 @@ local plump_helmet_on_place = function(itemstack, placer, pointed_thing, plantn
-- add the node and remove 1 item from the itemstack
minetest.add_node(pt.above, {name = plantname, param2 = math.random(0,3)})
dfcaverns.plant_timer(pt.above, plantname)
df_farming.plant_timer(pt.above, plantname)
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
@ -57,20 +57,21 @@ local plump_helmet_on_place = function(itemstack, placer, pointed_thing, plantn
end
minetest.register_node("dfcaverns:plump_helmet_spawn", {
minetest.register_node("df_farming:plump_helmet_spawn", {
description = S("Plump Helmet Spawn"),
_doc_items_longdesc = dfcaverns.doc.plump_helmet_desc,
_doc_items_usagehelp = dfcaverns.doc.plump_helmet_usage,
_doc_items_longdesc = df_farming.doc.plump_helmet_desc,
_doc_items_usagehelp = df_farming.doc.plump_helmet_usage,
tiles = {
"dfcaverns_plump_helmet_cap.png",
},
groups = {snappy = 3, flammable = 2, plant = 1, attached_node = 1, light_sensitive_fungus = 11, dfcaverns_cookable = 1, digtron_on_place=1},
_dfcaverns_next_stage = "dfcaverns:plump_helmet_1",
_dfcaverns_next_stage = "df_farming:plump_helmet_1",
_dfcaverns_next_stage_time = plump_helmet_grow_time,
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
walkable = false,
floodable = true,
node_box = {
type = "fixed",
fixed = {
@ -79,30 +80,31 @@ minetest.register_node("dfcaverns:plump_helmet_spawn", {
},
on_place = function(itemstack, placer, pointed_thing)
return plump_helmet_on_place(itemstack, placer, pointed_thing, "dfcaverns:plump_helmet_spawn")
return plump_helmet_on_place(itemstack, placer, pointed_thing, "df_farming:plump_helmet_spawn")
end,
on_timer = function(pos, elapsed)
dfcaverns.grow_underground_plant(pos, "dfcaverns:plump_helmet_spawn", elapsed)
df_farming.grow_underground_plant(pos, "df_farming:plump_helmet_spawn", elapsed)
end,
})
minetest.register_node("dfcaverns:plump_helmet_1", {
minetest.register_node("df_farming:plump_helmet_1", {
description = S("Plump Helmet"),
_doc_items_longdesc = dfcaverns.doc.plump_helmet_desc,
_doc_items_usagehelp = dfcaverns.doc.plump_helmet_usage,
_doc_items_longdesc = df_farming.doc.plump_helmet_desc,
_doc_items_usagehelp = df_farming.doc.plump_helmet_usage,
tiles = {
"dfcaverns_plump_helmet_cap.png",
"dfcaverns_plump_helmet_cap.png",
"dfcaverns_plump_helmet_cap.png^[lowpart:5:dfcaverns_plump_helmet_stem.png",
},
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11, dfcaverns_cookable = 1, plump_helmet = 1, food = 1, digtron_on_place=1},
_dfcaverns_next_stage = "dfcaverns:plump_helmet_2",
_dfcaverns_next_stage = "df_farming:plump_helmet_2",
_dfcaverns_next_stage_time = plump_helmet_grow_time,
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
walkable = false,
floodable = true,
node_box = {
type = "fixed",
fixed = {
@ -112,33 +114,34 @@ minetest.register_node("dfcaverns:plump_helmet_1", {
},
on_place = function(itemstack, placer, pointed_thing)
return plump_helmet_on_place(itemstack, placer, pointed_thing, "dfcaverns:plump_helmet_1")
return plump_helmet_on_place(itemstack, placer, pointed_thing, "df_farming:plump_helmet_1")
end,
on_use = minetest.item_eat(1),
on_timer = function(pos, elapsed)
dfcaverns.grow_underground_plant(pos, "dfcaverns:plump_helmet_1", elapsed)
df_farming.grow_underground_plant(pos, "df_farming:plump_helmet_1", elapsed)
end,
})
minetest.register_node("dfcaverns:plump_helmet_2", {
minetest.register_node("df_farming:plump_helmet_2", {
description = S("Plump Helmet"),
_doc_items_longdesc = dfcaverns.doc.plump_helmet_desc,
_doc_items_usagehelp = dfcaverns.doc.plump_helmet_usage,
_doc_items_longdesc = df_farming.doc.plump_helmet_desc,
_doc_items_usagehelp = df_farming.doc.plump_helmet_usage,
tiles = {
"dfcaverns_plump_helmet_cap.png",
"dfcaverns_plump_helmet_cap.png",
"dfcaverns_plump_helmet_cap.png^[lowpart:15:dfcaverns_plump_helmet_stem.png",
},
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11, dfcaverns_cookable = 1, plump_helmet = 1, food = 2, digtron_on_place=1},
_dfcaverns_next_stage = "dfcaverns:plump_helmet_3",
_dfcaverns_next_stage = "df_farming:plump_helmet_3",
_dfcaverns_next_stage_time = plump_helmet_grow_time,
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
walkable = false,
floodable = true,
node_box = {
type = "fixed",
fixed = {
@ -147,32 +150,33 @@ minetest.register_node("dfcaverns:plump_helmet_2", {
}
},
on_place = function(itemstack, placer, pointed_thing)
return plump_helmet_on_place(itemstack, placer, pointed_thing, "dfcaverns:plump_helmet_2")
return plump_helmet_on_place(itemstack, placer, pointed_thing, "df_farming:plump_helmet_2")
end,
on_use = minetest.item_eat(2),
on_timer = function(pos, elapsed)
dfcaverns.grow_underground_plant(pos, "dfcaverns:plump_helmet_2", elapsed)
df_farming.grow_underground_plant(pos, "df_farming:plump_helmet_2", elapsed)
end,
})
minetest.register_node("dfcaverns:plump_helmet_3", {
minetest.register_node("df_farming:plump_helmet_3", {
description = S("Plump Helmet"),
_doc_items_longdesc = dfcaverns.doc.plump_helmet_desc,
_doc_items_usagehelp = dfcaverns.doc.plump_helmet_usage,
_doc_items_longdesc = df_farming.doc.plump_helmet_desc,
_doc_items_usagehelp = df_farming.doc.plump_helmet_usage,
tiles = {
"dfcaverns_plump_helmet_cap.png",
"dfcaverns_plump_helmet_cap.png",
"dfcaverns_plump_helmet_cap.png^[lowpart:35:dfcaverns_plump_helmet_stem.png",
},
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11, dfcaverns_cookable = 1, plump_helmet = 1, food = 3, digtron_on_place=1},
_dfcaverns_next_stage = "dfcaverns:plump_helmet_4",
_dfcaverns_next_stage = "df_farming:plump_helmet_4",
_dfcaverns_next_stage_time = plump_helmet_grow_time,
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
walkable = false,
floodable = true,
node_box = {
type = "fixed",
fixed = {
@ -181,20 +185,20 @@ minetest.register_node("dfcaverns:plump_helmet_3", {
}
},
on_place = function(itemstack, placer, pointed_thing)
return plump_helmet_on_place(itemstack, placer, pointed_thing, "dfcaverns:plump_helmet_3")
return plump_helmet_on_place(itemstack, placer, pointed_thing, "df_farming:plump_helmet_3")
end,
on_use = minetest.item_eat(3),
on_timer = function(pos, elapsed)
dfcaverns.grow_underground_plant(pos, "dfcaverns:plump_helmet_3", elapsed)
df_farming.grow_underground_plant(pos, "df_farming:plump_helmet_3", elapsed)
end,
})
minetest.register_node("dfcaverns:plump_helmet_4", {
minetest.register_node("df_farming:plump_helmet_4", {
description = S("Plump Helmet"),
_doc_items_longdesc = dfcaverns.doc.plump_helmet_desc,
_doc_items_usagehelp = dfcaverns.doc.plump_helmet_usage,
_doc_items_longdesc = df_farming.doc.plump_helmet_desc,
_doc_items_usagehelp = df_farming.doc.plump_helmet_usage,
tiles = {
"dfcaverns_plump_helmet_cap.png",
"dfcaverns_plump_helmet_cap.png",
@ -205,6 +209,7 @@ minetest.register_node("dfcaverns:plump_helmet_4", {
paramtype = "light",
paramtype2 = "facedir",
walkable = false,
floodable = false, -- I figure full grown plump helmets are sturdy enough to survive inundation
node_box = {
type = "fixed",
fixed = {
@ -217,35 +222,35 @@ minetest.register_node("dfcaverns:plump_helmet_4", {
max_items = 4,
items = {
{
items = {'dfcaverns:plump_helmet_4_picked'},
items = {'df_farming:plump_helmet_4_picked'},
rarity = 1,
},
{
items = {'dfcaverns:plump_helmet_spawn'},
items = {'df_farming:plump_helmet_spawn'},
rarity = 1,
},
{
items = {'dfcaverns:plump_helmet_spawn'},
items = {'df_farming:plump_helmet_spawn'},
rarity = 2,
},
{
items = {'dfcaverns:plump_helmet_spawn'},
items = {'df_farming:plump_helmet_spawn'},
rarity = 2,
},
},
},
on_place = function(itemstack, placer, pointed_thing)
return plump_helmet_on_place(itemstack, placer, pointed_thing, "dfcaverns:plump_helmet_4")
return plump_helmet_on_place(itemstack, placer, pointed_thing, "df_farming:plump_helmet_4")
end,
on_use = minetest.item_eat(4),
})
minetest.register_node("dfcaverns:plump_helmet_4_picked", {
-- Need a separate picked type to prevent it from giving infinite spawn by just placing and re-harvesting
minetest.register_node("df_farming:plump_helmet_4_picked", {
description = S("Plump Helmet"),
_doc_items_longdesc = dfcaverns.doc.plump_helmet_desc,
_doc_items_usagehelp = dfcaverns.doc.plump_helmet_usage,
_doc_items_longdesc = df_farming.doc.plump_helmet_desc,
_doc_items_usagehelp = df_farming.doc.plump_helmet_usage,
tiles = {
"dfcaverns_plump_helmet_cap.png",
"dfcaverns_plump_helmet_cap.png",
@ -256,6 +261,7 @@ minetest.register_node("dfcaverns:plump_helmet_4_picked", {
paramtype = "light",
paramtype2 = "facedir",
walkable = false,
floodable = false,
node_box = {
type = "fixed",
fixed = {
@ -265,39 +271,52 @@ minetest.register_node("dfcaverns:plump_helmet_4_picked", {
}
},
on_place = function(itemstack, placer, pointed_thing)
return plump_helmet_on_place(itemstack, placer, pointed_thing, "dfcaverns:plump_helmet_4_picked")
return plump_helmet_on_place(itemstack, placer, pointed_thing, "df_farming:plump_helmet_4_picked")
end,
on_use = minetest.item_eat(4),
})
local place_list = {
minetest.get_content_id("df_farming:plump_helmet_spawn"),
minetest.get_content_id("df_farming:plump_helmet_1"),
minetest.get_content_id("df_farming:plump_helmet_2"),
minetest.get_content_id("df_farming:plump_helmet_3"),
minetest.get_content_id("df_farming:plump_helmet_4"),
}
-- doesn't set the timer running, so plants placed by this method won't grow
df_farming.spawn_plump_helmet_vm = function(vi, area, data, param2_data)
data[vi] = place_list[math.random(1,5)]
param2_data[vi] = math.random(1,4)-1
end
minetest.register_craft({
type = "fuel",
recipe = "dfcaverns:plump_helmet_spawn",
recipe = "df_farming:plump_helmet_spawn",
burntime = 1
})
minetest.register_craft({
type = "fuel",
recipe = "dfcaverns:plump_helmet_1",
recipe = "df_farming:plump_helmet_1",
burntime = 1
})
minetest.register_craft({
type = "fuel",
recipe = "dfcaverns:plump_helmet_2",
recipe = "df_farming:plump_helmet_2",
burntime = 2
})
minetest.register_craft({
type = "fuel",
recipe = "dfcaverns:plump_helmet_3",
recipe = "df_farming:plump_helmet_3",
burntime = 3
})
minetest.register_craft({
type = "fuel",
recipe = "dfcaverns:plump_helmet_4",
recipe = "df_farming:plump_helmet_4",
burntime = 4
})
minetest.register_craft({
type = "fuel",
recipe = "dfcaverns:plump_helmet_4_picked",
recipe = "df_farming:plump_helmet_4_picked",
burntime = 4
})

View File

@ -0,0 +1,95 @@
-- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
local quarry_grow_time = df_farming.config.plant_growth_time * df_farming.config.quarry_bush_delay_multiplier / 5
local register_quarry_bush = function(number)
local name = "df_farming:quarry_bush_"..tostring(number)
local def = {
description = S("Quarry Bush"),
_doc_items_longdesc = df_farming.doc.quarry_bush_desc,
_doc_items_usagehelp = df_farming.doc.quarry_bush_usage,
drawtype = "plantlike",
paramtype2 = "meshoptions",
place_param2 = 4,
tiles = {"dfcaverns_quarry_bush_"..tostring(number)..".png"},
inventory_image = "dfcaverns_quarry_bush_"..tostring(number)..".png",
paramtype = "light",
walkable = false,
buildable_to = true,
floodable = true,
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11},
sounds = default.node_sound_leaves_defaults(),
on_timer = function(pos, elapsed)
df_farming.grow_underground_plant(pos, name, elapsed)
end,
drop = {
max_items = 2,
items = {
{
items = {'df_farming:quarry_bush_seed 2', 'df_farming:quarry_bush_leaves 2'},
rarity = 6-number,
},
{
items = {'df_farming:quarry_bush_seed 1', 'df_farming:quarry_bush_leaves'},
rarity = 6-number,
},
{
items = {'df_farming:quarry_bush_seed'},
rarity = 6-number,
},
},
},
}
if number < 5 then
def._dfcaverns_next_stage_time = quarry_grow_time
def._dfcaverns_next_stage = "df_farming:quarry_bush_"..tostring(number+1)
end
minetest.register_node(name, def)
end
for i = 1,5 do
register_quarry_bush(i)
end
local place_list = {
minetest.get_content_id("df_farming:quarry_bush_1"),
minetest.get_content_id("df_farming:quarry_bush_2"),
minetest.get_content_id("df_farming:quarry_bush_3"),
minetest.get_content_id("df_farming:quarry_bush_4"),
minetest.get_content_id("df_farming:quarry_bush_5"),
}
-- doesn't set the timer running, so plants placed by this method won't grow
df_farming.spawn_quarry_bush_vm = function(vi, area, data, param2_data)
data[vi] = place_list[math.random(1,5)]
param2_data[vi] = 4
end
df_farming.register_seed(
"quarry_bush_seed",
S("Rock Nuts"),
"dfcaverns_rock_nuts.png",
"df_farming:quarry_bush_1",
quarry_grow_time,
df_farming.doc.quarry_bush_desc,
df_farming.doc.quarry_bush_usage
)
minetest.register_craftitem("df_farming:quarry_bush_leaves", {
description = S("Quarry Bush Leaves"),
_doc_items_longdesc = df_farming.doc.quarry_bush_leaves_desc,
_doc_items_usagehelp = df_farming.doc.quarry_bush_leaves_usage,
inventory_image = "dfcaverns_quarry_bush_leaves.png",
groups = {dfcaverns_cookable = 1},
stack_max = 99,
})
minetest.register_craft({
type = "fuel",
recipe = "df_farming:quarry_bush_leaves",
burntime = 4
})

View File

@ -0,0 +1,8 @@
dfcaverns_plant_growth_time (Base plant growth timer interval) int 100
dfcaverns_cave_wheat_delay_multiplier (cave_wheat growth delay multiplier) float 1
dfcaverns_dimple_cup_delay_multiplier (dimple_cup growth delay multiplier) float 3
dfcaverns_pig_tail_delay_multiplier (pig_tail growth delay multiplier) float 1
dfcaverns_plump_helmet_delay_multiplier (plump_helmet growth delay multiplier) float 3
dfcaverns_quarry_bush_delay_multiplier (quarry_bush growth delay multiplier) float 2
dfcaverns_sweet_pod_delay_multiplier (sweet_pod growth delay multiplier) float 2
dfcaverns_light_kills_fungus (Light kills fungus) bool true

View File

@ -2,40 +2,41 @@
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
local sweet_pod_grow_time = dfcaverns.config.plant_growth_time * dfcaverns.config.sweet_pod_delay_multiplier / 6
local sweet_pod_grow_time = df_farming.config.plant_growth_time * df_farming.config.sweet_pod_delay_multiplier / 6
local register_sweet_pod = function(number)
local name = "dfcaverns:sweet_pod_"..tostring(number)
local name = "df_farming:sweet_pod_"..tostring(number)
local def = {
description = S("Sweet Pod"),
_doc_items_longdesc = dfcaverns.doc.sweet_pod_desc,
_doc_items_usagehelp = dfcaverns.doc.sweet_pod_usage,
_doc_items_longdesc = df_farming.doc.sweet_pod_desc,
_doc_items_usagehelp = df_farming.doc.sweet_pod_usage,
drawtype = "plantlike",
tiles = {"dfcaverns_sweet_pod_"..tostring(number)..".png"},
inventory_image = "dfcaverns_sweet_pod_"..tostring(number)..".png",
paramtype = "light",
walkable = false,
buildable_to = true,
floodable = true,
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11},
sounds = default.node_sound_leaves_defaults(),
on_timer = function(pos, elapsed)
dfcaverns.grow_underground_plant(pos, name, elapsed)
df_farming.grow_underground_plant(pos, name, elapsed)
end,
drop = {
max_items = 2,
items = {
{
items = {'dfcaverns:sweet_pod_seed 2', 'dfcaverns:sweet_pods 2'},
items = {'df_farming:sweet_pod_seed 2', 'df_farming:sweet_pods 2'},
rarity = 7-number,
},
{
items = {'dfcaverns:sweet_pod_seed', 'dfcaverns:sweet_pods'},
items = {'df_farming:sweet_pod_seed', 'df_farming:sweet_pods'},
rarity = 7-number,
},
{
items = {'dfcaverns:sweet_pod_seed'},
items = {'df_farming:sweet_pod_seed'},
rarity = 7-number,
},
},
@ -43,7 +44,7 @@ local register_sweet_pod = function(number)
}
if number < 6 then
def._dfcaverns_next_stage = "dfcaverns:sweet_pod_"..tostring(number+1)
def._dfcaverns_next_stage = "df_farming:sweet_pod_"..tostring(number+1)
def._dfcaverns_next_stage_time = sweet_pod_grow_time
end
@ -54,47 +55,61 @@ for i = 1,6 do
register_sweet_pod(i)
end
dfcaverns.register_seed(
local place_list = {
minetest.get_content_id("df_farming:sweet_pod_1"),
minetest.get_content_id("df_farming:sweet_pod_2"),
minetest.get_content_id("df_farming:sweet_pod_3"),
minetest.get_content_id("df_farming:sweet_pod_4"),
minetest.get_content_id("df_farming:sweet_pod_5"),
minetest.get_content_id("df_farming:sweet_pod_6"),
}
-- doesn't set the timer running, so plants placed by this method won't grow
df_farming.spawn_sweet_pod_vm = function(vi, area, data, param2_data)
data[vi] = place_list[math.random(1,8)]
param2_data[vi] = 0
end
df_farming.register_seed(
"sweet_pod_seed",
S("Sweet Pod Spores"),
"dfcaverns_sweet_pod_seed.png",
"dfcaverns:sweet_pod_1",
"df_farming:sweet_pod_1",
sweet_pod_grow_time,
dfcaverns.doc.sweet_pod_desc,
dfcaverns.doc.sweet_pod_usage)
df_farming.doc.sweet_pod_desc,
df_farming.doc.sweet_pod_usage)
minetest.register_craftitem("dfcaverns:sweet_pods", {
minetest.register_craftitem("df_farming:sweet_pods", {
description = S("Sweet Pods"),
_doc_items_longdesc = dfcaverns.doc.sweet_pod_desc,
_doc_items_usagehelp = dfcaverns.doc.sweet_pod_usage,
_doc_items_longdesc = df_farming.doc.sweet_pod_desc,
_doc_items_usagehelp = df_farming.doc.sweet_pod_usage,
inventory_image = "dfcaverns_sweet_pods.png",
stack_max = 99,
})
minetest.register_craft({
type = "fuel",
recipe = "dfcaverns:sweet_pods",
recipe = "df_farming:sweet_pods",
burntime = 4
})
---------------------------------------------
-- Sugar
minetest.register_craftitem("dfcaverns:sugar", {
minetest.register_craftitem("df_farming:sugar", {
description = S("Sweet Pod Sugar"),
_doc_items_longdesc = dfcaverns.doc.sweet_pod_sugar_desc,
_doc_items_usagehelp = dfcaverns.doc.sweet_pod_sugar_usage,
_doc_items_longdesc = df_farming.doc.sweet_pod_sugar_desc,
_doc_items_usagehelp = df_farming.doc.sweet_pod_sugar_usage,
inventory_image = "dfcaverns_sugar.png",
groups = {dfcaverns_cookable = 1},
})
if minetest.get_modpath("cottages") then
cottages.handmill_product["dfcaverns:sweet_pods"] = "dfcaverns:sugar";
cottages.handmill_product["df_farming:sweet_pods"] = "df_farming:sugar";
else
minetest.register_craft({
type = "cooking",
cooktime = 3,
output = "dfcaverns:sugar",
recipe = "dfcaverns:sweet_pods",
output = "df_farming:sugar",
recipe = "df_farming:sweet_pods",
})
end
@ -102,10 +117,10 @@ end
-- Syrup
if minetest.get_modpath("bucket") then
minetest.register_node("dfcaverns:dwarven_syrup_source", {
minetest.register_node("df_farming:dwarven_syrup_source", {
description = S("Dwarven Syrup Source"),
_doc_items_longdesc = dfcaverns.doc.sweet_pod_syrup_desc,
_doc_items_usagehelp = dfcaverns.doc.sweet_pod_syrup_usage,
_doc_items_longdesc = df_farming.doc.sweet_pod_syrup_desc,
_doc_items_usagehelp = df_farming.doc.sweet_pod_syrup_usage,
drawtype = "liquid",
tiles = {
{
@ -140,8 +155,8 @@ if minetest.get_modpath("bucket") then
drop = "",
drowning = 1,
liquidtype = "source",
liquid_alternative_flowing = "dfcaverns:dwarven_syrup_flowing",
liquid_alternative_source = "dfcaverns:dwarven_syrup_source",
liquid_alternative_flowing = "df_farming:dwarven_syrup_flowing",
liquid_alternative_source = "df_farming:dwarven_syrup_source",
liquid_viscosity = 7,
liquid_renewable = false,
liquid_range = 2,
@ -150,10 +165,10 @@ if minetest.get_modpath("bucket") then
sounds = default.node_sound_water_defaults(),
})
minetest.register_node("dfcaverns:dwarven_syrup_flowing", {
minetest.register_node("df_farming:dwarven_syrup_flowing", {
description = S("Flowing Dwarven Syrup"),
_doc_items_longdesc = dfcaverns.doc.sweet_pod_syrup_desc,
_doc_items_usagehelp = dfcaverns.doc.sweet_pod_syrup_usage,
_doc_items_longdesc = df_farming.doc.sweet_pod_syrup_desc,
_doc_items_usagehelp = df_farming.doc.sweet_pod_syrup_usage,
drawtype = "flowingliquid",
tiles = {"dfcaverns_dwarven_syrup.png"},
special_tiles = {
@ -189,8 +204,8 @@ if minetest.get_modpath("bucket") then
drop = "",
drowning = 1,
liquidtype = "flowing",
liquid_alternative_flowing = "dfcaverns:dwarven_syrup_flowing",
liquid_alternative_source = "dfcaverns:dwarven_syrup_source",
liquid_alternative_flowing = "df_farming:dwarven_syrup_flowing",
liquid_alternative_source = "df_farming:dwarven_syrup_source",
liquid_viscosity = 7,
liquid_renewable = false,
liquid_range = 2,
@ -200,9 +215,9 @@ if minetest.get_modpath("bucket") then
})
bucket.register_liquid(
"dfcaverns:dwarven_syrup_source",
"dfcaverns:dwarven_syrup_flowing",
"dfcaverns:dwarven_syrup_bucket",
"df_farming:dwarven_syrup_source",
"df_farming:dwarven_syrup_flowing",
"df_farming:dwarven_syrup_bucket",
"dfcaverns_bucket_dwarven_syrup.png",
S("Dwarven Syrup Bucket")
)
@ -211,22 +226,22 @@ if minetest.get_modpath("bucket") then
simplecrafting_lib.register("cooking", {
input = {
["bucket:bucket_empty"] = 1,
["dfcaverns:sugar"] = 3,
["df_farming:sugar"] = 3,
},
output = {
["dfcaverns:dwarven_syrup_bucket"] = 1,
["df_farming:dwarven_syrup_bucket"] = 1,
},
cooktime = 5.0,
})
else
minetest.register_craft({
type = "shapeless",
output = "dfcaverns:dwarven_syrup_bucket",
recipe = {"bucket:bucket_empty", "dfcaverns:sugar", "dfcaverns:sugar", "dfcaverns:sugar"},
output = "df_farming:dwarven_syrup_bucket",
recipe = {"bucket:bucket_empty", "df_farming:sugar", "df_farming:sugar", "df_farming:sugar"},
})
end
if minetest.get_modpath("dynamic_liquid") then
dynamic_liquid.liquid_abm("dfcaverns:dwarven_syrup_source", "dfcaverns:dwarven_syrup_flowing", 5)
dynamic_liquid.liquid_abm("df_farming:dwarven_syrup_source", "df_farming:dwarven_syrup_flowing", 5)
end
end

View File

Before

Width:  |  Height:  |  Size: 602 B

After

Width:  |  Height:  |  Size: 602 B

View File

Before

Width:  |  Height:  |  Size: 533 B

After

Width:  |  Height:  |  Size: 533 B

View File

Before

Width:  |  Height:  |  Size: 392 B

After

Width:  |  Height:  |  Size: 392 B

View File

Before

Width:  |  Height:  |  Size: 398 B

After

Width:  |  Height:  |  Size: 398 B

View File

Before

Width:  |  Height:  |  Size: 173 B

After

Width:  |  Height:  |  Size: 173 B

View File

Before

Width:  |  Height:  |  Size: 218 B

After

Width:  |  Height:  |  Size: 218 B

View File

Before

Width:  |  Height:  |  Size: 282 B

After

Width:  |  Height:  |  Size: 282 B

View File

Before

Width:  |  Height:  |  Size: 321 B

After

Width:  |  Height:  |  Size: 321 B

View File

Before

Width:  |  Height:  |  Size: 367 B

After

Width:  |  Height:  |  Size: 367 B

View File

Before

Width:  |  Height:  |  Size: 392 B

After

Width:  |  Height:  |  Size: 392 B

View File

Before

Width:  |  Height:  |  Size: 406 B

After

Width:  |  Height:  |  Size: 406 B

View File

Before

Width:  |  Height:  |  Size: 441 B

After

Width:  |  Height:  |  Size: 441 B

View File

Before

Width:  |  Height:  |  Size: 242 B

After

Width:  |  Height:  |  Size: 242 B

View File

Before

Width:  |  Height:  |  Size: 812 B

After

Width:  |  Height:  |  Size: 812 B

View File

Before

Width:  |  Height:  |  Size: 422 B

After

Width:  |  Height:  |  Size: 422 B

View File

Before

Width:  |  Height:  |  Size: 481 B

After

Width:  |  Height:  |  Size: 481 B

View File

Before

Width:  |  Height:  |  Size: 703 B

After

Width:  |  Height:  |  Size: 703 B

View File

Before

Width:  |  Height:  |  Size: 840 B

After

Width:  |  Height:  |  Size: 840 B

View File

Before

Width:  |  Height:  |  Size: 357 B

After

Width:  |  Height:  |  Size: 357 B

View File

Before

Width:  |  Height:  |  Size: 632 B

After

Width:  |  Height:  |  Size: 632 B

View File

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

Before

Width:  |  Height:  |  Size: 262 B

After

Width:  |  Height:  |  Size: 262 B

View File

Before

Width:  |  Height:  |  Size: 150 B

After

Width:  |  Height:  |  Size: 150 B

View File

Before

Width:  |  Height:  |  Size: 980 B

After

Width:  |  Height:  |  Size: 980 B

View File

Before

Width:  |  Height:  |  Size: 997 B

After

Width:  |  Height:  |  Size: 997 B

View File

Before

Width:  |  Height:  |  Size: 1002 B

After

Width:  |  Height:  |  Size: 1002 B

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Some files were not shown because too many files have changed in this diff Show More