forked from Apancore.Studio/simple-makes-complex
MapGen: fix biome scattering
This commit is contained in:
@@ -349,31 +349,33 @@ local function generateNode(mapGenerator, layer, height, temp, humidity, data, i
|
|||||||
local waterLevel = mapGenerator.waterLevel
|
local waterLevel = mapGenerator.waterLevel
|
||||||
|
|
||||||
-- Creating a rougher biome boundary.
|
-- Creating a rougher biome boundary.
|
||||||
local scatteringGorizontal = layer.biomesGorizontalScattering
|
local scatteringGorizontal = layer.biomesGorizontalScattering or 0
|
||||||
local scatteringVertical = layer.biomesVerticalScattering
|
local scatteringVertical = layer.biomesVerticalScattering or 0
|
||||||
local scattHeight = y
|
local scattTemp = temp
|
||||||
|
local scattHumidity = humidity
|
||||||
|
local scattHeight = y
|
||||||
|
|
||||||
if scatteringGorizontal ~= 0 then
|
if scatteringGorizontal ~= 0 then
|
||||||
---@diagnostic disable-next-line: param-type-not-match
|
---@diagnostic disable-next-line: param-type-not-match
|
||||||
scatteringGorizontal = math.random(scatteringGorizontal * -1, scatteringGorizontal)
|
scattTemp = scattTemp + math.random(scatteringGorizontal * -1, scatteringGorizontal)
|
||||||
temp = temp + scatteringGorizontal
|
---@diagnostic disable-next-line: param-type-not-match
|
||||||
humidity = humidity + scatteringGorizontal
|
scattHumidity = scattHumidity + math.random(scatteringGorizontal * -1, scatteringGorizontal)
|
||||||
end
|
end
|
||||||
|
|
||||||
if scatteringVertical ~= 0 then
|
if scatteringVertical ~= 0 then
|
||||||
---@diagnostic disable-next-line: param-type-not-match
|
---@diagnostic disable-next-line: param-type-not-match
|
||||||
scatteringVertical = math.random(scatteringVertical * -1, scatteringVertical)
|
scattHeight = scattHeight + math.random(scatteringVertical * -1, scatteringVertical)
|
||||||
scattHeight = scattHeight + scatteringVertical
|
|
||||||
end
|
end
|
||||||
|
|
||||||
temp = math.clamp(temp, layer.minTemp, layer.maxTemp)
|
scattTemp = math.clamp(scattTemp, layer.minTemp, layer.maxTemp)
|
||||||
humidity = math.clamp(humidity, layer.minHumidity, layer.maxHumidity)
|
scattHumidity = math.clamp(scattHumidity, layer.minHumidity, layer.maxHumidity)
|
||||||
scattHeight = math.clamp(scattHeight, layer.minY, layer.maxY)
|
scattHeight = math.clamp(scattHeight, layer.minY, layer.maxY)
|
||||||
|
|
||||||
height, scattHeight, temp, humidity = mathRound(height), mathRound(scattHeight), mathRound(temp), mathRound(humidity)
|
scattHeight, scattTemp, scattHumidity = mathRound(scattHeight), mathRound(scattTemp), mathRound(scattHumidity)
|
||||||
|
height, temp, humidity = mathRound(height), mathRound(scattTemp), mathRound(scattHumidity)
|
||||||
|
|
||||||
---@type MapGen.Biome
|
---@type MapGen.Biome
|
||||||
local biome = layer.biomesDiagram[scattHeight][temp][humidity]
|
local biome = layer.biomesDiagram[scattHeight][scattTemp][scattHumidity]
|
||||||
|
|
||||||
-- If the block is above surface height and above water level...
|
-- If the block is above surface height and above water level...
|
||||||
if y > height and y > waterLevel then
|
if y > height and y > waterLevel then
|
||||||
|
|||||||
Reference in New Issue
Block a user