2021-06-06 13:25:43 +02:00
|
|
|
local def_setting = mapgen_rivers.define_setting
|
|
|
|
|
2020-05-24 11:38:47 +02:00
|
|
|
mapgen_rivers.noise_params = {
|
2021-06-06 13:25:43 +02:00
|
|
|
base = def_setting('np_base', 'noise', {
|
|
|
|
offset = 0,
|
2021-06-25 21:03:33 +02:00
|
|
|
scale = 300,
|
2021-06-06 13:25:43 +02:00
|
|
|
seed = 2469,
|
|
|
|
octaves = 8,
|
2021-06-25 21:03:33 +02:00
|
|
|
spread = {x=2048, y=2048, z=2048},
|
2021-06-06 13:25:43 +02:00
|
|
|
persist = 0.6,
|
|
|
|
lacunarity = 2,
|
2021-07-24 10:23:06 +02:00
|
|
|
flags = "eased",
|
2021-06-06 13:25:43 +02:00
|
|
|
}),
|
|
|
|
|
|
|
|
distort_x = def_setting('np_distort_x', 'noise', {
|
2020-05-24 11:38:47 +02:00
|
|
|
offset = 0,
|
|
|
|
scale = 1,
|
|
|
|
seed = -4574,
|
|
|
|
spread = {x=64, y=32, z=64},
|
|
|
|
octaves = 3,
|
|
|
|
persistence = 0.75,
|
|
|
|
lacunarity = 2,
|
2021-06-06 13:25:43 +02:00
|
|
|
}),
|
2020-05-24 11:38:47 +02:00
|
|
|
|
2021-06-06 13:25:43 +02:00
|
|
|
distort_z = def_setting('np_distort_z', 'noise', {
|
2020-05-24 11:38:47 +02:00
|
|
|
offset = 0,
|
|
|
|
scale = 1,
|
|
|
|
seed = -7940,
|
|
|
|
spread = {x=64, y=32, z=64},
|
|
|
|
octaves = 3,
|
|
|
|
persistence = 0.75,
|
|
|
|
lacunarity = 2,
|
2021-06-06 13:25:43 +02:00
|
|
|
}),
|
2020-05-24 11:38:47 +02:00
|
|
|
|
2021-06-06 13:25:43 +02:00
|
|
|
distort_amplitude = def_setting('np_distort_amplitude', 'noise', {
|
2020-05-24 11:38:47 +02:00
|
|
|
offset = 0,
|
|
|
|
scale = 10,
|
|
|
|
seed = 676,
|
|
|
|
spread = {x=1024, y=1024, z=1024},
|
|
|
|
octaves = 5,
|
|
|
|
persistence = 0.5,
|
|
|
|
lacunarity = 2,
|
|
|
|
flags = "absvalue",
|
2021-06-06 13:25:43 +02:00
|
|
|
}),
|
2020-05-24 11:38:47 +02:00
|
|
|
|
|
|
|
heat = minetest.get_mapgen_setting_noiseparams('mg_biome_np_heat'),
|
|
|
|
heat_blend = minetest.get_mapgen_setting_noiseparams('mg_biome_np_heat_blend'),
|
|
|
|
}
|
|
|
|
|
2021-06-06 13:25:43 +02:00
|
|
|
-- Convert to number because Minetest API is not able to do it cleanly...
|
|
|
|
for name, np in pairs(mapgen_rivers.noise_params) do
|
|
|
|
for field, value in pairs(np) do
|
|
|
|
if field ~= 'flags' and type(value) == 'string' then
|
|
|
|
np[field] = tonumber(value) or value
|
|
|
|
elseif field == 'spread' then
|
|
|
|
for dir, v in pairs(value) do
|
|
|
|
value[dir] = tonumber(v) or v
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local heat = mapgen_rivers.noise_params.heat
|
|
|
|
local base = mapgen_rivers.noise_params.base
|
|
|
|
local settings = mapgen_rivers.settings
|
|
|
|
heat.offset = heat.offset + settings.sea_level * settings.elevation_chill
|
|
|
|
base.spread.x = base.spread.x / settings.blocksize
|
|
|
|
base.spread.y = base.spread.y / settings.blocksize
|
|
|
|
base.spread.z = base.spread.z / settings.blocksize
|
|
|
|
|
|
|
|
for name, np in pairs(mapgen_rivers.noise_params) do
|
|
|
|
local lac = np.lacunarity or 2
|
|
|
|
if lac > 1 then
|
|
|
|
local omax = math.floor(math.log(math.min(np.spread.x, np.spread.y, np.spread.z)) / math.log(lac))+1
|
|
|
|
if np.octaves > omax then
|
2022-01-03 16:22:55 +01:00
|
|
|
minetest.log("warning", "[mapgen_rivers] Noise " .. name .. ": 'octaves' reduced to " .. omax)
|
2021-06-06 13:25:43 +02:00
|
|
|
np.octaves = omax
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|