Added settings for margin, and documented in settingtypes.txt

This commit is contained in:
Gael-de-Sailly 2022-01-03 15:45:27 +01:00
parent fabe107336
commit 6d8ee5af1f
5 changed files with 22 additions and 6 deletions

View File

@ -6,7 +6,7 @@ local transform_quadri = dofile(modpath .. 'geometry.lua')
local sea_level = mapgen_rivers.settings.sea_level
local riverbed_slope = mapgen_rivers.settings.riverbed_slope * mapgen_rivers.settings.blocksize
local MAP_BOTTOM = -31000
local out_elev = mapgen_rivers.settings.margin_elev
-- Localize for performance
local floor, min, max = math.floor, math.min, math.max
@ -128,8 +128,8 @@ local function heightmaps(minp, maxp)
terrain_height_map[i] = terrain_height
lake_height_map[i] = lake_height
else
terrain_height_map[i] = MAP_BOTTOM
lake_height_map[i] = MAP_BOTTOM
terrain_height_map[i] = out_elev
lake_height_map[i] = out_elev
end
i = i + 1
end

View File

@ -14,9 +14,9 @@ local time_step = mapgen_rivers.settings.evol_time_step
local niter = math.ceil(time/time_step)
time_step = time / niter
local use_margin = true
local margin_width = 2000 / blocksize
local margin_elev = -200
local use_margin = mapgen_rivers.settings.margin
local margin_width = mapgen_rivers.settings.margin_width / blocksize
local margin_elev = mapgen_rivers.settings.margin_elev
local function margin(dem, width, elev)
local X, Y = dem.X, dem.Y

View File

@ -95,6 +95,9 @@ mapgen_rivers.settings = {
map_x_size = def_setting('map_x_size', 'number'),
map_z_size = def_setting('map_z_size', 'number'),
margin = def_setting('margin', 'bool'),
margin_width = def_setting('margin_width', 'number'),
margin_elev = def_setting('margin_elev', 'number'),
evol_params = {
K = def_setting('river_erosion_coef', 'number'),
m = def_setting('river_erosion_power', 'number'),

View File

@ -15,6 +15,9 @@
"map_x_size": 15000,
"map_z_size": 15000,
"margin": true,
"margin_width": 2000,
"margin_elev": -200,
"river_erosion_coef": 0.5,
"river_erosion_power": 0.4,
"diffusive_erosion": 0.5,

View File

@ -23,6 +23,16 @@ mapgen_rivers_map_x_size (Map X size) int 15000 500 66000
# When increasing, it is recommended to increase blocksize too
mapgen_rivers_map_z_size (Map Z size) int 15000 500 66000
# If margin is enabled, elevation becomes closer to a fixed value when approaching
# the edges of the map.
mapgen_rivers_margin (Margin) bool true
# Width of the transition at map borders, in nodes
mapgen_rivers_margin_width (Margin width) float 2000.0 0.0 15000.0
# Elevation toward which to converge at map borders
mapgen_rivers_margin_elev (Margin elevation) float -200.0 -31000.0 31000.0
# Minimal catchment area for a river to be drawn, in square nodes
# Lower value means bigger river density
mapgen_rivers_min_catchment (Minimal catchment area) float 3600.0 100.0 1000000.0