Mapgen: changes due to added noise annotation

This commit is contained in:
Van
2025-10-05 14:51:09 +03:00
parent 8022bca8ac
commit 60e1023408
3 changed files with 10 additions and 18 deletions

View File

@@ -4,10 +4,11 @@ local mathCeil, mathAbs
-- --- MapGen default moises ---
local oceanNoise
---@type NoiseParams
local oceanNoiseParams = {
offset = -30,
scale = 10,
spread = {x = 100, y = 100, z = 100},
spread = vector.new(100, 100, 100),
seed = 47,
octaves = 8,
persistence = 0.4,
@@ -204,10 +205,12 @@ local function generatorHandler(mapGenerator, data, index, x, y, z)
for _, region in ipairs(regions) do
local noise = region:getMultinoise().landscapeNoise
if noise ~= nil then
-- The further a point is from the center of a region, the less noise affects it.
local weight = calculateWeight2D(region:getMinPos(), region:getMaxPos(), x, z, region.getWeightFactor())
local weight = calculateWeight2D(region:getMinPos(), region:getMaxPos(), x, z, region.getWeightFactor())
noiseHeightValue = noiseHeightValue + ( noise:get_2d({x = x, y = z}) * weight )
noiseHeightValue = noiseHeightValue + ( noise:get_2d(vector.new(x, z, 0)) * weight )
end
end
generateNode(mapGenerator, noiseHeightValue, data, index, x, y, z)