2017-03-17 08:54:42 +01:00
|
|
|
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")
|
2017-03-19 08:03:51 +01:00
|
|
|
local c_sand = minetest.get_content_id("default:sand")
|
2017-03-19 22:54:46 +01:00
|
|
|
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")
|
2018-04-22 16:01:13 +02:00
|
|
|
local c_obsidian = minetest.get_content_id("default:obsidian")
|
2017-03-17 08:54:42 +01:00
|
|
|
|
|
|
|
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
|
2017-03-21 05:44:11 +01:00
|
|
|
local c_dimple_cup = minetest.get_content_id("dfcaverns:dimple_cup_4") -- param2 = 0
|
2017-03-17 08:54:42 +01:00
|
|
|
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")
|
|
|
|
|
2018-04-23 04:16:20 +02:00
|
|
|
local c_wet_flowstone = minetest.get_content_id("dfcaverns:wet_flowstone")
|
2017-03-22 07:36:58 +01:00
|
|
|
|
|
|
|
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)
|
2018-05-26 07:52:46 +02:00
|
|
|
subterrane:small_stalagmite(vi, area, data, param2_data, param2, height, dfcaverns.dry_stalagmite_ids)
|
2017-03-22 07:36:58 +01:00
|
|
|
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)
|
2018-05-26 07:52:46 +02:00
|
|
|
subterrane:small_stalagmite(vi, area, data, param2_data, param2, -height, dfcaverns.dry_stalagmite_ids)
|
2017-03-22 07:36:58 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-03-27 03:45:02 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2017-03-21 05:44:11 +01:00
|
|
|
-- 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,
|
2017-03-22 07:36:58 +01:00
|
|
|
_subterrane_cave_floor_decor = shallow_cave_floor,
|
|
|
|
_subterrane_cave_ceiling_decor = shallow_cave_ceiling,
|
2017-03-21 05:44:11 +01:00
|
|
|
})
|
2017-03-20 02:32:49 +01:00
|
|
|
|
2017-03-22 07:36:58 +01:00
|
|
|
subterrane:register_cave_decor(-113, dfcaverns.config.ymax)
|
|
|
|
|
2017-03-22 05:17:04 +01:00
|
|
|
subterrane:register_cave_layer({
|
|
|
|
minimum_depth = dfcaverns.config.ymax,
|
|
|
|
maximum_depth = dfcaverns.config.level1_min,
|
2017-09-05 08:56:31 +02:00
|
|
|
cave_threshold = dfcaverns.config.cavern_threshold,
|
2017-04-06 06:40:35 +02:00
|
|
|
perlin_cave = perlin_cave,
|
|
|
|
perlin_wave = perlin_wave,
|
2018-05-20 08:45:38 +02:00
|
|
|
columns = {
|
|
|
|
maximum_radius = 10,
|
|
|
|
minimum_radius = 4,
|
|
|
|
node = c_wet_flowstone,
|
|
|
|
weight = 0.25,
|
|
|
|
maximum_count = 20,
|
|
|
|
minimum_count = 0,
|
|
|
|
},
|
2017-03-22 05:17:04 +01:00
|
|
|
})
|
2017-03-21 08:02:46 +01:00
|
|
|
|
2017-03-22 05:17:04 +01:00
|
|
|
subterrane:register_cave_layer({
|
|
|
|
minimum_depth = dfcaverns.config.level1_min,
|
|
|
|
maximum_depth = dfcaverns.config.level2_min,
|
2017-09-05 08:56:31 +02:00
|
|
|
cave_threshold = dfcaverns.config.cavern_threshold,
|
2017-04-06 06:40:35 +02:00
|
|
|
perlin_cave = perlin_cave,
|
|
|
|
perlin_wave = perlin_wave,
|
2018-04-22 16:01:13 +02:00
|
|
|
columns = {
|
2018-05-20 08:45:38 +02:00
|
|
|
maximum_radius = 15,
|
|
|
|
minimum_radius = 4,
|
2018-04-22 16:01:13 +02:00
|
|
|
node = c_wet_flowstone,
|
|
|
|
weight = 0.25,
|
|
|
|
maximum_count = 30,
|
|
|
|
minimum_count = 5,
|
|
|
|
},
|
2017-03-22 05:17:04 +01:00
|
|
|
})
|
2017-03-21 08:02:46 +01:00
|
|
|
|
2017-03-22 05:17:04 +01:00
|
|
|
subterrane:register_cave_layer({
|
|
|
|
minimum_depth = dfcaverns.config.level2_min,
|
|
|
|
maximum_depth = dfcaverns.config.level3_min,
|
2017-09-05 08:56:31 +02:00
|
|
|
cave_threshold = dfcaverns.config.cavern_threshold,
|
2017-04-06 06:40:35 +02:00
|
|
|
perlin_cave = perlin_cave,
|
|
|
|
perlin_wave = perlin_wave,
|
2018-04-22 16:01:13 +02:00
|
|
|
columns = {
|
2018-05-20 08:45:38 +02:00
|
|
|
maximum_radius = 20,
|
|
|
|
minimum_radius = 5,
|
2018-04-22 16:01:13 +02:00
|
|
|
node = c_wet_flowstone,
|
|
|
|
weight = 0.25,
|
|
|
|
maximum_count = 50,
|
|
|
|
minimum_count = 10,
|
|
|
|
},
|
2017-03-22 05:17:04 +01:00
|
|
|
})
|
|
|
|
|
2017-04-06 06:40:35 +02:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2017-03-22 05:17:04 +01:00
|
|
|
subterrane:register_cave_layer({
|
|
|
|
minimum_depth = dfcaverns.config.level3_min,
|
2018-04-22 16:01:13 +02:00
|
|
|
maximum_depth = dfcaverns.config.sunless_sea_min,
|
2017-09-05 05:46:08 +02:00
|
|
|
cave_threshold = dfcaverns.config.lava_sea_threshold,
|
2017-04-06 06:40:35 +02:00
|
|
|
perlin_cave = perlin_cave_lava,
|
|
|
|
perlin_wave = perlin_wave_lava,
|
2018-04-22 16:01:13 +02:00
|
|
|
columns = {
|
|
|
|
maximum_radius = 25,
|
2018-05-20 08:45:38 +02:00
|
|
|
minimum_radius = 5,
|
2018-04-23 04:16:20 +02:00
|
|
|
node = c_stone,
|
2018-04-22 16:01:13 +02:00
|
|
|
weight = 0.25,
|
|
|
|
maximum_count = 100,
|
|
|
|
minimum_count = 25,
|
|
|
|
},
|
2017-03-22 05:17:04 +01:00
|
|
|
})
|
2017-03-21 08:02:46 +01:00
|
|
|
|
2018-04-22 16:01:13 +02:00
|
|
|
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
|
|
|
|
|
2017-03-19 22:54:46 +01:00
|
|
|
dfcaverns.can_support_vegetation = {[c_sand] = true, [c_dirt] = true, [c_coal_ore] = true, [c_gravel] = true}
|
|
|
|
|
2017-03-25 09:49:47 +01:00
|
|
|
dfcaverns.place_shrub = function(data, vi, param2_data, shrub_list)
|
|
|
|
local shrub = shrub_list[math.random(#shrub_list)]
|
|
|
|
|
|
|
|
if shrub == c_quarry_bush then
|
2017-03-19 22:54:46 +01:00
|
|
|
data[vi] = c_quarry_bush
|
|
|
|
param2_data[vi] = 4
|
2017-03-25 09:49:47 +01:00
|
|
|
elseif shrub == c_plump_helmet then
|
2017-03-19 22:54:46 +01:00
|
|
|
data[vi] = c_plump_helmet
|
|
|
|
param2_data[vi] = math.random(0,3)
|
2017-03-25 09:49:47 +01:00
|
|
|
elseif shrub == c_pig_tail then
|
2017-03-19 22:54:46 +01:00
|
|
|
data[vi] = c_pig_tail
|
|
|
|
param2_data[vi] = 3
|
2017-03-25 09:49:47 +01:00
|
|
|
elseif shrub == c_cave_wheat then
|
2017-03-19 22:54:46 +01:00
|
|
|
data[vi] = c_cave_wheat
|
|
|
|
param2_data[vi] = 3
|
2017-03-25 09:49:47 +01:00
|
|
|
else
|
|
|
|
data[vi] = shrub
|
2017-03-19 22:54:46 +01:00
|
|
|
param2_data[vi] = 0
|
2017-03-25 09:49:47 +01:00
|
|
|
end
|
2017-03-19 22:54:46 +01:00
|
|
|
end
|