Mapgen: changes due to added noise annotation
This commit is contained in:
@@ -4,10 +4,11 @@ local mathCeil, mathAbs
|
|||||||
-- --- MapGen default moises ---
|
-- --- MapGen default moises ---
|
||||||
local oceanNoise
|
local oceanNoise
|
||||||
|
|
||||||
|
---@type NoiseParams
|
||||||
local oceanNoiseParams = {
|
local oceanNoiseParams = {
|
||||||
offset = -30,
|
offset = -30,
|
||||||
scale = 10,
|
scale = 10,
|
||||||
spread = {x = 100, y = 100, z = 100},
|
spread = vector.new(100, 100, 100),
|
||||||
seed = 47,
|
seed = 47,
|
||||||
octaves = 8,
|
octaves = 8,
|
||||||
persistence = 0.4,
|
persistence = 0.4,
|
||||||
@@ -204,10 +205,12 @@ local function generatorHandler(mapGenerator, data, index, x, y, z)
|
|||||||
for _, region in ipairs(regions) do
|
for _, region in ipairs(regions) do
|
||||||
local noise = region:getMultinoise().landscapeNoise
|
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.
|
-- 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
|
end
|
||||||
|
|
||||||
generateNode(mapGenerator, noiseHeightValue, data, index, x, y, z)
|
generateNode(mapGenerator, noiseHeightValue, data, index, x, y, z)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
---For EmmyLua only
|
---For EmmyLua only
|
||||||
|
|
||||||
---@class MapGen.Region.Multinoise
|
---@class MapGen.Region.Multinoise
|
||||||
---@field landscapeNoise ValueNoise? -- TODO: describe ValueNoise class from Luanti (push Alek)
|
---@field landscapeNoise ValueNoise?
|
||||||
---@field tempNoise ValueNoise?
|
---@field tempNoise ValueNoise?
|
||||||
---@field humidityNoise ValueNoise?
|
---@field humidityNoise ValueNoise?
|
||||||
local Multinoise = {}
|
local Multinoise = {}
|
||||||
|
|||||||
@@ -1,20 +1,9 @@
|
|||||||
---For EmmyLua only
|
---For EmmyLua only
|
||||||
|
|
||||||
-- TODO: Когда в хелпер добавятся аннотации шумов, надо будет удалить этот класс и заменить его на хелперский
|
|
||||||
---@class MapGen.Region.NoiseParams
|
|
||||||
---@field offset number
|
|
||||||
---@field scale number
|
|
||||||
---@field spread vector
|
|
||||||
---@field seed number
|
|
||||||
---@field octaves number
|
|
||||||
---@field persistence number
|
|
||||||
---@field lacunarity number
|
|
||||||
---@field flags string?
|
|
||||||
|
|
||||||
---@class MapGen.Region.MultinoiseParams
|
---@class MapGen.Region.MultinoiseParams
|
||||||
---@field landscapeNoise MapGen.Region.NoiseParams?
|
---@field landscapeNoise NoiseParams?
|
||||||
---@field tempNoise MapGen.Region.NoiseParams?
|
---@field tempNoise NoiseParams?
|
||||||
---@field humidityNoise MapGen.Region.NoiseParams?
|
---@field humidityNoise NoiseParams?
|
||||||
local MultinoiseParams = {}
|
local MultinoiseParams = {}
|
||||||
|
|
||||||
return MultinoiseParams
|
return MultinoiseParams
|
||||||
|
|||||||
Reference in New Issue
Block a user