MapGen & mapGenerator: add param2_data
This commit is contained in:
@@ -551,7 +551,7 @@ end
|
|||||||
-- --- GENERATION METHODS ---
|
-- --- GENERATION METHODS ---
|
||||||
|
|
||||||
---@alias MapGen.nodeType 'AIR'|'WATER'|'CAVERN_AIR'|'TURF'|'SOIL'|'ROCK'|'BOTTOM'
|
---@alias MapGen.nodeType 'AIR'|'WATER'|'CAVERN_AIR'|'TURF'|'SOIL'|'ROCK'|'BOTTOM'
|
||||||
---@alias MapGen.postProcessingData {biome:MapGen.Biome, mapGenerator:MapGen, factors:MapGen.factors, data:number[], index:number, x:number, y:number, z:number, nodeType:MapGen.nodeType}
|
---@alias MapGen.postProcessingData {biome:MapGen.Biome, mapGenerator:MapGen, factors:MapGen.factors, index:number, x:number, y:number, z:number, nodeType:MapGen.nodeType}
|
||||||
|
|
||||||
---@type table<number, MapGen.postProcessingData>
|
---@type table<number, MapGen.postProcessingData>
|
||||||
local postProcessing = {}
|
local postProcessing = {}
|
||||||
@@ -559,13 +559,12 @@ local postProcessing = {}
|
|||||||
---@param biome MapGen.Biome
|
---@param biome MapGen.Biome
|
||||||
---@param mapGenerator MapGen
|
---@param mapGenerator MapGen
|
||||||
---@param factors MapGen.factors
|
---@param factors MapGen.factors
|
||||||
---@param data number[]
|
|
||||||
---@param index number
|
---@param index number
|
||||||
---@param x integer
|
---@param x integer
|
||||||
---@param y integer
|
---@param y integer
|
||||||
---@param z integer
|
---@param z integer
|
||||||
---@param nodeType MapGen.nodeType
|
---@param nodeType MapGen.nodeType
|
||||||
local function addPostProccessing(biome, mapGenerator, factors, data, index, x, y, z, nodeType)
|
local function addPostProccessing(biome, mapGenerator, factors, index, x, y, z, nodeType)
|
||||||
if biome.postProcessing == nil then
|
if biome.postProcessing == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -574,7 +573,6 @@ local function addPostProccessing(biome, mapGenerator, factors, data, index, x,
|
|||||||
biome = biome,
|
biome = biome,
|
||||||
mapGenerator = mapGenerator,
|
mapGenerator = mapGenerator,
|
||||||
factors = factors,
|
factors = factors,
|
||||||
data = data,
|
|
||||||
index = index,
|
index = index,
|
||||||
x = x,
|
x = x,
|
||||||
y = y,
|
y = y,
|
||||||
@@ -589,11 +587,12 @@ end
|
|||||||
---@param layer MapGen.Layer
|
---@param layer MapGen.Layer
|
||||||
---@param factors MapGen.factors
|
---@param factors MapGen.factors
|
||||||
---@param data number[]
|
---@param data number[]
|
||||||
|
---@param data2 number[]
|
||||||
---@param index number
|
---@param index number
|
||||||
---@param x integer
|
---@param x integer
|
||||||
---@param y integer
|
---@param y integer
|
||||||
---@param z integer
|
---@param z integer
|
||||||
local function generateNode(mapGenerator, layer, factors, data, index, x, y, z)
|
local function generateNode(mapGenerator, layer, factors, data, data2, index, x, y, z)
|
||||||
|
|
||||||
local ids = mapGenerator.nodeIDs
|
local ids = mapGenerator.nodeIDs
|
||||||
local waterLevel = layer.waterLevel
|
local waterLevel = layer.waterLevel
|
||||||
@@ -629,39 +628,39 @@ local function generateNode(mapGenerator, layer, factors, data, index, x, y, z)
|
|||||||
-- 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
|
||||||
-- ... then airspace is generated.
|
-- ... then airspace is generated.
|
||||||
biome:generateAir(mapGenerator, factors, data, index, x, y, z)
|
biome:generateAir(mapGenerator, factors, data, data2, index, x, y, z)
|
||||||
addPostProccessing(biome, mapGenerator, factors, data, index, x, y, z, 'AIR')
|
addPostProccessing(biome, mapGenerator, factors, index, x, y, z, 'AIR')
|
||||||
|
|
||||||
-- If the block is above the surface height BUT below the water level...
|
-- If the block is above the surface height BUT below the water level...
|
||||||
elseif y > height and y <= waterLevel then
|
elseif y > height and y <= waterLevel then
|
||||||
-- ... then underwater space is generated.
|
-- ... then underwater space is generated.
|
||||||
biome:generateWater(mapGenerator, factors, data, index, x, y, z)
|
biome:generateWater(mapGenerator, factors, data, data2, index, x, y, z)
|
||||||
addPostProccessing(biome, mapGenerator, factors, data, index, x, y, z, 'WATER')
|
addPostProccessing(biome, mapGenerator, factors, index, x, y, z, 'WATER')
|
||||||
|
|
||||||
-- If the block is below the surface height...
|
-- If the block is below the surface height...
|
||||||
elseif y <= height then
|
elseif y <= height then
|
||||||
-- ... and a cavern is generated in the block...
|
-- ... and a cavern is generated in the block...
|
||||||
if mapGenerator:isCavern(layer, x, y, z) then
|
if mapGenerator:isCavern(layer, x, y, z) then
|
||||||
-- ... then airspace is generated.
|
-- ... then airspace is generated.
|
||||||
biome:generateCavernAir(mapGenerator, factors, data, index, x, y, z)
|
biome:generateCavernAir(mapGenerator, factors, data, data2, index, x, y, z)
|
||||||
addPostProccessing(biome, mapGenerator, factors, data, index, x, y, z, 'CAVERN_AIR')
|
addPostProccessing(biome, mapGenerator, factors, index, x, y, z, 'CAVERN_AIR')
|
||||||
|
|
||||||
-- ... or if the surface height is above the water level...
|
-- ... or if the surface height is above the water level...
|
||||||
elseif height > waterLevel then
|
elseif height > waterLevel then
|
||||||
--- ... and the height of the block is equal to the height of the surface...
|
--- ... and the height of the block is equal to the height of the surface...
|
||||||
if y == height then
|
if y == height then
|
||||||
-- ... then turf is generated.
|
-- ... then turf is generated.
|
||||||
biome:generateTurf(mapGenerator, factors, data, index, x, y, z)
|
biome:generateTurf(mapGenerator, factors, data, data2, index, x, y, z)
|
||||||
addPostProccessing(biome, mapGenerator, factors, data, index, x, y, z, 'TURF')
|
addPostProccessing(biome, mapGenerator, factors, index, x, y, z, 'TURF')
|
||||||
-- ... or if the height of the block falls within the thickness of the soil layer...
|
-- ... or if the height of the block falls within the thickness of the soil layer...
|
||||||
elseif y > height - biome.soilHeight then
|
elseif y > height - biome.soilHeight then
|
||||||
-- ... then soil is generated.
|
-- ... then soil is generated.
|
||||||
biome:generateSoil(mapGenerator, factors, data, index, x, y, z)
|
biome:generateSoil(mapGenerator, factors, data, data2, index, x, y, z)
|
||||||
addPostProccessing(biome, mapGenerator, factors, data, index, x, y, z, 'SOIL')
|
addPostProccessing(biome, mapGenerator, factors, index, x, y, z, 'SOIL')
|
||||||
else
|
else
|
||||||
-- ... else a stone is generated.
|
-- ... else a stone is generated.
|
||||||
biome:generateRock(mapGenerator, factors, data, index, x, y, z)
|
biome:generateRock(mapGenerator, factors, data, data2, index, x, y, z)
|
||||||
addPostProccessing(biome, mapGenerator, factors, data, index, x, y, z, 'ROCK')
|
addPostProccessing(biome, mapGenerator, factors, index, x, y, z, 'ROCK')
|
||||||
end
|
end
|
||||||
|
|
||||||
-- ... or if the surface height is below the water level...
|
-- ... or if the surface height is below the water level...
|
||||||
@@ -669,12 +668,12 @@ local function generateNode(mapGenerator, layer, factors, data, index, x, y, z)
|
|||||||
-- ... and if the height of the block falls within the thickness of the soil layer...
|
-- ... and if the height of the block falls within the thickness of the soil layer...
|
||||||
if y > height - biome.soilHeight then
|
if y > height - biome.soilHeight then
|
||||||
-- ... then the river/ocean bottom is generated.
|
-- ... then the river/ocean bottom is generated.
|
||||||
biome:generateBottom(mapGenerator, factors, data, index, x, y, z)
|
biome:generateBottom(mapGenerator, factors, data, data2, index, x, y, z)
|
||||||
addPostProccessing(biome, mapGenerator, factors, data, index, x, y, z, 'BOTTOM')
|
addPostProccessing(biome, mapGenerator, factors, index, x, y, z, 'BOTTOM')
|
||||||
else
|
else
|
||||||
-- ... else a stone is generated.
|
-- ... else a stone is generated.
|
||||||
biome:generateRock(mapGenerator, factors, data, index, x, y, z)
|
biome:generateRock(mapGenerator, factors, data, data2, index, x, y, z)
|
||||||
addPostProccessing(biome, mapGenerator, factors, data, index, x, y, z, 'ROCK')
|
addPostProccessing(biome, mapGenerator, factors, index, x, y, z, 'ROCK')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -828,15 +827,16 @@ end
|
|||||||
---@param mapGenerator MapGen
|
---@param mapGenerator MapGen
|
||||||
---@param layer MapGen.Layer?
|
---@param layer MapGen.Layer?
|
||||||
---@param data number[]
|
---@param data number[]
|
||||||
|
---@param data2 number[]
|
||||||
---@param index number
|
---@param index number
|
||||||
---@param x integer
|
---@param x integer
|
||||||
---@param y integer
|
---@param y integer
|
||||||
---@param z integer
|
---@param z integer
|
||||||
local function generatorHandler(mapGenerator, layer, data, index, x, y, z)
|
local function generatorHandler(mapGenerator, layer, data, data2, index, x, y, z)
|
||||||
-- If the node belongs to a static layer, then a static node is generated.
|
-- If the node belongs to a static layer, then a static node is generated.
|
||||||
local static = mapGenerator:getStaticByHeight(y)
|
local static = mapGenerator:getStaticByHeight(y)
|
||||||
if static ~= nil then
|
if static ~= nil then
|
||||||
static:generateStaticNode(mapGenerator, data, index, x, y, z)
|
static:generateStaticNode(mapGenerator, data, data2, index, x, y, z)
|
||||||
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -870,7 +870,7 @@ local function generatorHandler(mapGenerator, layer, data, index, x, y, z)
|
|||||||
humidity = humidity,
|
humidity = humidity,
|
||||||
}
|
}
|
||||||
|
|
||||||
generateNode(mapGenerator, layer, factors, data, index, x, y, z)
|
generateNode(mapGenerator, layer, factors, data, data2, index, x, y, z)
|
||||||
end
|
end
|
||||||
|
|
||||||
---Chunk generation handler.
|
---Chunk generation handler.
|
||||||
@@ -900,7 +900,7 @@ function MapGen:onMapGenerated(voxelManip, minPos, maxPos, blockseed)
|
|||||||
self:initCavernsNoise()
|
self:initCavernsNoise()
|
||||||
end
|
end
|
||||||
|
|
||||||
local data = voxelManip:get_data()
|
local data, data2 = voxelManip:get_data(), voxelManip:get_param2_data()
|
||||||
-- local param2_data = voxelManip:get_param2_data()
|
-- local param2_data = voxelManip:get_param2_data()
|
||||||
local area = VoxelArea:new({MinEdge = eMin, MaxEdge = eMax})
|
local area = VoxelArea:new({MinEdge = eMin, MaxEdge = eMax})
|
||||||
|
|
||||||
@@ -917,19 +917,19 @@ function MapGen:onMapGenerated(voxelManip, minPos, maxPos, blockseed)
|
|||||||
index = area:index(x, y, z)
|
index = area:index(x, y, z)
|
||||||
|
|
||||||
if data[index] == AIR_ID then
|
if data[index] == AIR_ID then
|
||||||
generatorHandler(self, layer, data, index, x, y, z)
|
generatorHandler(self, layer, data, data2, index, x, y, z)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Post-proccesing generation
|
-- Post-proccesing generation
|
||||||
for _, ppdata in pairs(postProcessing) do
|
for _, ppdata in pairs(postProcessing) do
|
||||||
if ppdata.biome.postProcessing ~= nil then
|
if ppdata.biome.postProcessing ~= nil then
|
||||||
ppdata.biome:postProcessing(ppdata.mapGenerator,
|
ppdata.biome:postProcessing(ppdata.mapGenerator,
|
||||||
ppdata.factors,
|
ppdata.factors,
|
||||||
ppdata.data,
|
data,
|
||||||
|
data2,
|
||||||
ppdata.index,
|
ppdata.index,
|
||||||
ppdata.x,
|
ppdata.x,
|
||||||
ppdata.y,
|
ppdata.y,
|
||||||
@@ -941,17 +941,15 @@ function MapGen:onMapGenerated(voxelManip, minPos, maxPos, blockseed)
|
|||||||
|
|
||||||
-- We make changes back to LVM and recalculate light & liquids
|
-- We make changes back to LVM and recalculate light & liquids
|
||||||
voxelManip:set_data(data)
|
voxelManip:set_data(data)
|
||||||
|
voxelManip:set_param2_data(data2)
|
||||||
|
|
||||||
core.generate_ores(voxelManip, minPos, maxPos)
|
core.generate_ores(voxelManip, minPos, maxPos)
|
||||||
core.generate_decorations(voxelManip, minPos, maxPos)
|
core.generate_decorations(voxelManip, minPos, maxPos)
|
||||||
|
|
||||||
--voxelManip:set_param2_data()
|
|
||||||
voxelManip:set_lighting({ day = 14, night = 0})
|
voxelManip:set_lighting({ day = 14, night = 0})
|
||||||
voxelManip:calc_lighting()
|
voxelManip:calc_lighting()
|
||||||
voxelManip:update_liquids()
|
voxelManip:update_liquids()
|
||||||
|
|
||||||
pastTriangle = nil
|
|
||||||
|
|
||||||
if PROFILE_CHUNK then
|
if PROFILE_CHUNK then
|
||||||
endTime = getUsTime()
|
endTime = getUsTime()
|
||||||
mglog('Chunk end:\n'..
|
mglog('Chunk end:\n'..
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ local getInstance = Class.getInstance
|
|||||||
---@field generateTurf generateFunc
|
---@field generateTurf generateFunc
|
||||||
---@field generateSoil generateFunc
|
---@field generateSoil generateFunc
|
||||||
---@field generateBottom generateFunc
|
---@field generateBottom generateFunc
|
||||||
---@field postProcessing fun(self, mapGenerator:MapGen, factors:MapGen.factors, data:number[], index:number, x:number, y:number, z:number, nodeType:MapGen.nodeType, area:VoxelArea)?
|
---@field postProcessing fun(self, mapGenerator:MapGen, factors:MapGen.factors, data:number[], data2:number[], index:number, x:number, y:number, z:number, nodeType:MapGen.nodeType, area:VoxelArea)?
|
||||||
local Biome = {}
|
local Biome = {}
|
||||||
|
|
||||||
---@alias generateFunc fun(self, mapGenerator:MapGen, factors:MapGen.factors, data:number[], index:number, x:number, y:number, z:number)
|
---@alias generateFunc fun(self, mapGenerator:MapGen, factors:MapGen.factors, data:number[], data2:number[], index:number, x:number, y:number, z:number)
|
||||||
|
|
||||||
---Definition table for the `MapGen.Biome`.
|
---Definition table for the `MapGen.Biome`.
|
||||||
---
|
---
|
||||||
@@ -40,7 +40,7 @@ local Biome = {}
|
|||||||
---@field generateTurf generateFunc?
|
---@field generateTurf generateFunc?
|
||||||
---@field generateSoil generateFunc?
|
---@field generateSoil generateFunc?
|
||||||
---@field generateBottom generateFunc?
|
---@field generateBottom generateFunc?
|
||||||
---@field postProcessing fun(self, mapGenerator:MapGen, factors:MapGen.factors, data:number[], index:number, x:number, y:number, z:number, nodeType:MapGen.nodeType, area:VoxelArea)?
|
---@field postProcessing fun(self, mapGenerator:MapGen, factors:MapGen.factors, data:number[], data2:number[], index:number, x:number, y:number, z:number, nodeType:MapGen.nodeType, area:VoxelArea)?
|
||||||
|
|
||||||
-- Default generate functions
|
-- Default generate functions
|
||||||
|
|
||||||
@@ -48,11 +48,12 @@ local Biome = {}
|
|||||||
---@param mapGenerator MapGen
|
---@param mapGenerator MapGen
|
||||||
---@param factors MapGen.factors
|
---@param factors MapGen.factors
|
||||||
---@param data number[]
|
---@param data number[]
|
||||||
|
---@param data2 number[]
|
||||||
---@param index number
|
---@param index number
|
||||||
---@param x number
|
---@param x number
|
||||||
---@param y number
|
---@param y number
|
||||||
---@param z number
|
---@param z number
|
||||||
local defaultGenerateAir = function(self, mapGenerator, factors, data, index, x, y, z)
|
local defaultGenerateAir = function(self, mapGenerator, factors, data, data2, index, x, y, z)
|
||||||
data[index] = mapGenerator.nodeIDs.air
|
data[index] = mapGenerator.nodeIDs.air
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -60,23 +61,25 @@ end
|
|||||||
---@param mapGenerator MapGen
|
---@param mapGenerator MapGen
|
||||||
---@param factors MapGen.factors
|
---@param factors MapGen.factors
|
||||||
---@param data number[]
|
---@param data number[]
|
||||||
|
---@param data2 number[]
|
||||||
---@param index number
|
---@param index number
|
||||||
---@param x number
|
---@param x number
|
||||||
---@param y number
|
---@param y number
|
||||||
---@param z number
|
---@param z number
|
||||||
local defaultGenerateCavernAir = function(self, mapGenerator, factors, data, index, x, y, z)
|
local defaultGenerateCavernAir = function(self, mapGenerator, factors, data, data2, index, x, y, z)
|
||||||
self:generateAir(mapGenerator, factors, data, index, x, y, z)
|
self:generateAir(mapGenerator, factors, data, data2, index, x, y, z)
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param self MapGen.Biome
|
---@param self MapGen.Biome
|
||||||
---@param mapGenerator MapGen
|
---@param mapGenerator MapGen
|
||||||
---@param factors MapGen.factors
|
---@param factors MapGen.factors
|
||||||
---@param data number[]
|
---@param data number[]
|
||||||
|
---@param data2 number[]
|
||||||
---@param index number
|
---@param index number
|
||||||
---@param x number
|
---@param x number
|
||||||
---@param y number
|
---@param y number
|
||||||
---@param z number
|
---@param z number
|
||||||
local defaultGenerateWater = function(self, mapGenerator, factors, data, index, x, y, z)
|
local defaultGenerateWater = function(self, mapGenerator, factors, data, data2, index, x, y, z)
|
||||||
data[index] = mapGenerator.nodeIDs.water
|
data[index] = mapGenerator.nodeIDs.water
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -84,11 +87,12 @@ end
|
|||||||
---@param mapGenerator MapGen
|
---@param mapGenerator MapGen
|
||||||
---@param factors MapGen.factors
|
---@param factors MapGen.factors
|
||||||
---@param data number[]
|
---@param data number[]
|
||||||
|
---@param data2 number[]
|
||||||
---@param index number
|
---@param index number
|
||||||
---@param x number
|
---@param x number
|
||||||
---@param y number
|
---@param y number
|
||||||
---@param z number
|
---@param z number
|
||||||
local defaultGenerateRock = function(self, mapGenerator, factors, data, index, x, y, z)
|
local defaultGenerateRock = function(self, mapGenerator, factors, data, data2, index, x, y, z)
|
||||||
data[index] = self.groundNodesIDs.rock
|
data[index] = self.groundNodesIDs.rock
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -96,11 +100,12 @@ end
|
|||||||
---@param mapGenerator MapGen
|
---@param mapGenerator MapGen
|
||||||
---@param factors MapGen.factors
|
---@param factors MapGen.factors
|
||||||
---@param data number[]
|
---@param data number[]
|
||||||
|
---@param data2 number[]
|
||||||
---@param index number
|
---@param index number
|
||||||
---@param x number
|
---@param x number
|
||||||
---@param y number
|
---@param y number
|
||||||
---@param z number
|
---@param z number
|
||||||
local defaultGenerateTurf = function(self, mapGenerator, factors, data, index, x, y, z)
|
local defaultGenerateTurf = function(self, mapGenerator, factors, data, data2, index, x, y, z)
|
||||||
data[index] = self.groundNodesIDs.turf
|
data[index] = self.groundNodesIDs.turf
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -108,11 +113,12 @@ end
|
|||||||
---@param mapGenerator MapGen
|
---@param mapGenerator MapGen
|
||||||
---@param factors MapGen.factors
|
---@param factors MapGen.factors
|
||||||
---@param data number[]
|
---@param data number[]
|
||||||
|
---@param data2 number[]
|
||||||
---@param index number
|
---@param index number
|
||||||
---@param x number
|
---@param x number
|
||||||
---@param y number
|
---@param y number
|
||||||
---@param z number
|
---@param z number
|
||||||
local defaultGenerateSoil = function(self, mapGenerator, factors, data, index, x, y, z)
|
local defaultGenerateSoil = function(self, mapGenerator, factors, data, data2, index, x, y, z)
|
||||||
data[index] = self.groundNodesIDs.soil
|
data[index] = self.groundNodesIDs.soil
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -120,11 +126,12 @@ end
|
|||||||
---@param mapGenerator MapGen
|
---@param mapGenerator MapGen
|
||||||
---@param factors MapGen.factors
|
---@param factors MapGen.factors
|
||||||
---@param data number[]
|
---@param data number[]
|
||||||
|
---@param data2 number[]
|
||||||
---@param index number
|
---@param index number
|
||||||
---@param x number
|
---@param x number
|
||||||
---@param y number
|
---@param y number
|
||||||
---@param z number
|
---@param z number
|
||||||
local defaultGenerateBottom = function(self, mapGenerator, factors, data, index, x, y, z)
|
local defaultGenerateBottom = function(self, mapGenerator, factors, data, data2, index, x, y, z)
|
||||||
data[index] = self.groundNodesIDs.bottom
|
data[index] = self.groundNodesIDs.bottom
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ local getInstance = Class.getInstance
|
|||||||
---@field maxY number
|
---@field maxY number
|
||||||
---@field staticNode string
|
---@field staticNode string
|
||||||
---@field staticNodeID number
|
---@field staticNodeID number
|
||||||
---@field generateStaticNode fun(self, mapGenerator:MapGen, data:number[], index:number, x:number, y:number, z:number)
|
---@field generateStaticNode fun(self, mapGenerator:MapGen, data:number[], data2:number[], index:number, x:number, y:number, z:number)
|
||||||
local StaticLayer = {}
|
local StaticLayer = {}
|
||||||
|
|
||||||
---Definition table for the `MapGen.StaticLayer`.
|
---Definition table for the `MapGen.StaticLayer`.
|
||||||
@@ -18,16 +18,17 @@ local StaticLayer = {}
|
|||||||
---@field minY number
|
---@field minY number
|
||||||
---@field maxY number
|
---@field maxY number
|
||||||
---@field staticNode string
|
---@field staticNode string
|
||||||
---@field generateStaticNode fun(self, mapGenerator:MapGen, data:number[], index:number, x:number, y:number, z:number)
|
---@field generateStaticNode fun(self, mapGenerator:MapGen, data:number[], data2:number[], index:number, x:number, y:number, z:number)
|
||||||
|
|
||||||
---@param self MapGen.StaticLayer
|
---@param self MapGen.StaticLayer
|
||||||
---@param mapGenerator MapGen
|
---@param mapGenerator MapGen
|
||||||
---@param data number[]
|
---@param data number[]
|
||||||
|
---@param data2 number[]
|
||||||
---@param index number
|
---@param index number
|
||||||
---@param x number
|
---@param x number
|
||||||
---@param y number
|
---@param y number
|
||||||
---@param z number
|
---@param z number
|
||||||
local defaultGenerateStaticNode = function(self, mapGenerator, data, index, x, y, z)
|
local defaultGenerateStaticNode = function(self, mapGenerator, data, data2, index, x, y, z)
|
||||||
data[index] = self.staticNodeID
|
data[index] = self.staticNodeID
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -16,39 +16,4 @@ core.register_mapgen_script(core.get_modpath('smc__core__map_generator')..'/src/
|
|||||||
-- For now, the generation does not have its own support
|
-- For now, the generation does not have its own support
|
||||||
-- for the generation of ores and decorations, so vanilla ones are used.
|
-- for the generation of ores and decorations, so vanilla ones are used.
|
||||||
|
|
||||||
core.register_ore({
|
|
||||||
ore_type = "scatter",
|
|
||||||
ore = "soils:rocky_soil_baren",
|
|
||||||
wherein = "rocks:sylite",
|
|
||||||
clust_scarcity = 8*8*8,
|
|
||||||
clust_num_ores = 8,
|
|
||||||
clust_size = 3,
|
|
||||||
y_min = -31000,
|
|
||||||
y_max = 64,
|
|
||||||
})
|
|
||||||
|
|
||||||
core.register_decoration({
|
|
||||||
deco_type = "simple",
|
|
||||||
place_on = "soils:turf_swamp",
|
|
||||||
sidelen = 8,
|
|
||||||
fill_ratio = 0.4,
|
|
||||||
decoration = "plants:plants",
|
|
||||||
})
|
|
||||||
|
|
||||||
core.register_decoration({
|
|
||||||
deco_type = "simple",
|
|
||||||
place_on = "soils:turf_swamp",
|
|
||||||
sidelen = 8,
|
|
||||||
fill_ratio = 0.05,
|
|
||||||
decoration = "plants:plant0",
|
|
||||||
})
|
|
||||||
|
|
||||||
core.register_decoration({
|
|
||||||
deco_type = "simple",
|
|
||||||
place_on = "soils:turf_swamp",
|
|
||||||
sidelen = 8,
|
|
||||||
fill_ratio = 0.01,
|
|
||||||
decoration = "plants:plant2",
|
|
||||||
})
|
|
||||||
|
|
||||||
return mapGenerator
|
return mapGenerator
|
||||||
@@ -91,9 +91,9 @@ local ocean = {
|
|||||||
|
|
||||||
local common_lands = {
|
local common_lands = {
|
||||||
['landscape'] = {
|
['landscape'] = {
|
||||||
offset = 0,
|
offset = 10,
|
||||||
scale = 5,
|
scale = 5,
|
||||||
spread = {x = 10, y = 10, z = 10},
|
spread = {x = 15, y = 15, z = 15},
|
||||||
seed = 88005553535,
|
seed = 88005553535,
|
||||||
octaves = 2,
|
octaves = 2,
|
||||||
persistence = 0.4,
|
persistence = 0.4,
|
||||||
@@ -705,6 +705,33 @@ mapGenerator:registerBiome('midgard', 'swamp', {
|
|||||||
generateSoil = generateSoil,
|
generateSoil = generateSoil,
|
||||||
postProcessing = postProcessing
|
postProcessing = postProcessing
|
||||||
})--]]
|
})--]]
|
||||||
|
---@type NoiseParams
|
||||||
|
local ryeNoiseParams = {
|
||||||
|
offset = 0,
|
||||||
|
scale = 10,
|
||||||
|
spread = {x = 30, y = 30, z = 30},
|
||||||
|
seed = 88005553535,
|
||||||
|
octaves = 2,
|
||||||
|
persistence = 0.4,
|
||||||
|
lacunarity = 2,
|
||||||
|
}
|
||||||
|
local ryeNoise
|
||||||
|
|
||||||
|
---@param nodeType MapGen.nodeType
|
||||||
|
---@param area VoxelArea
|
||||||
|
local function meadowPostProcessing(biome, mapGenerator, factors, data, data2, index, x, y, z, nodeType, area)
|
||||||
|
if nodeType ~= 'TURF' then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if ryeNoise == nil then ryeNoise = core.get_value_noise(ryeNoiseParams) end
|
||||||
|
|
||||||
|
if ryeNoise:get_2d({x=x, y=z}) + math.random(0, 3) > 8 then
|
||||||
|
local i = area:index(x,y+1,z)
|
||||||
|
data[i] = id('plants:rye')
|
||||||
|
data2[i] = 3
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
mapGenerator:registerBiome('midgard', 'green_meadow', {
|
mapGenerator:registerBiome('midgard', 'green_meadow', {
|
||||||
tempPoint = 80,
|
tempPoint = 80,
|
||||||
@@ -718,6 +745,7 @@ mapGenerator:registerBiome('midgard', 'green_meadow', {
|
|||||||
bottom = 'soils:humus',
|
bottom = 'soils:humus',
|
||||||
},
|
},
|
||||||
soilHeight = 5,
|
soilHeight = 5,
|
||||||
|
postProcessing = meadowPostProcessing,
|
||||||
--generateRock = generateRock,
|
--generateRock = generateRock,
|
||||||
--generateTurf = generateTurf,
|
--generateTurf = generateTurf,
|
||||||
--generateSoil = generateSoil,
|
--generateSoil = generateSoil,
|
||||||
|
|||||||
Reference in New Issue
Block a user