2017-03-20 04:50:03 +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")
|
|
|
|
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")
|
2018-05-18 09:43:56 +02:00
|
|
|
local c_meseore = minetest.get_content_id("default:stone_with_mese")
|
|
|
|
local c_mesecry = minetest.get_content_id("dfcaverns:glow_mese")
|
2017-03-20 04:50:03 +01:00
|
|
|
|
|
|
|
-------------------------------------------------------------------------------------------
|
|
|
|
|
2018-05-31 09:34:22 +02:00
|
|
|
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
|
2018-05-18 09:43:56 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-05-31 09:34:22 +02:00
|
|
|
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
|
2018-05-18 09:43:56 +02:00
|
|
|
|
2018-05-31 09:34:22 +02:00
|
|
|
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 = 80,
|
|
|
|
humidity_point = 20,
|
|
|
|
_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 = 60,
|
|
|
|
humidity_point = 40,
|
|
|
|
_subterrane_ceiling_decor = mese_ore_ceiling,
|
|
|
|
}
|
|
|
|
|
|
|
|
local lava_sea_barren_biome_def = {
|
2017-04-06 06:40:35 +02:00
|
|
|
name = "dfcaverns_lava_sea",
|
2017-03-20 04:50:03 +01:00
|
|
|
y_min = dfcaverns.config.lava_sea_min,
|
2018-04-22 16:01:13 +02:00
|
|
|
y_max = dfcaverns.config.lava_sea_max,
|
2018-05-31 09:34:22 +02:00
|
|
|
heat_point = 40,
|
2017-04-03 17:32:40 +02:00
|
|
|
humidity_point = 50,
|
2017-09-05 08:48:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-05-31 09:34:22 +02:00
|
|
|
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
|
2017-04-06 06:40:35 +02:00
|
|
|
|
|
|
|
local data = {}
|
|
|
|
|
|
|
|
minetest.register_on_generated(function(minp, maxp, seed)
|
|
|
|
--if out of range of cave definition limits, abort
|
2018-05-31 09:34:22 +02:00
|
|
|
if minp.y > lava_sea_level or maxp.y < dfcaverns.config.lava_sea_min then
|
2017-04-06 06:40:35 +02:00
|
|
|
return
|
|
|
|
end
|
2018-05-31 09:34:22 +02:00
|
|
|
|
2017-04-06 06:40:35 +02:00
|
|
|
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
|
|
|
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
|
|
|
|
vm:get_data(data)
|
2018-05-31 09:34:22 +02:00
|
|
|
|
|
|
|
for vi, x, y, z in area:iterp_xyz(minp, maxp) do
|
|
|
|
if y < lava_sea_level + math.random(0,3) then
|
|
|
|
if data[vi] == c_air or data[vi] == c_water then
|
|
|
|
data[vi] = c_lava
|
2017-04-06 06:40:35 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
--send data back to voxelmanip
|
|
|
|
vm:set_data(data)
|
|
|
|
--calc lighting
|
|
|
|
vm:set_lighting({day = 0, night = 0})
|
|
|
|
vm:calc_lighting()
|
2018-05-31 09:34:22 +02:00
|
|
|
|
|
|
|
vm:update_liquids()
|
2017-04-06 06:40:35 +02:00
|
|
|
--write it to world
|
2017-12-11 01:24:25 +01:00
|
|
|
vm:write_to_map()
|
2017-04-06 06:40:35 +02:00
|
|
|
end)
|