mapGenerator: minor changes
This commit is contained in:
@@ -15,16 +15,10 @@ local MapGen = mapGenRequire('MapGen')
|
||||
air = 'air',
|
||||
|
||||
-- Rocks
|
||||
sylite = 'rocks:sylite',
|
||||
syliteGray = 'rocks:sylite_gray',
|
||||
syliteBlack = 'rocks:sylite_black',
|
||||
tauititeLight = 'rocks:tauitite_light',
|
||||
--iyellite = 'rocks:iyellite',
|
||||
--falmyte = 'rocks:falmyte',
|
||||
--hapcoryte = 'rocks:hapcoryte',
|
||||
--burcite = 'rocks:burcite',
|
||||
--felhor = 'rocks:felhor',
|
||||
--malachite = 'rocks:malachite',
|
||||
basalt = 'rocks:basalt',
|
||||
granite_red = 'rocks:granite_red',
|
||||
limestone = 'rocks:limestone',
|
||||
dolomit = 'rocks:dolomit',
|
||||
|
||||
-- Liquids
|
||||
water = 'liquids:water_source',
|
||||
@@ -576,114 +570,6 @@ local rocksNoiseParams ={
|
||||
lacunarity = 4,
|
||||
}
|
||||
|
||||
local function generateRock(biome, mapGenerator, factors, data, index, x, y, z)
|
||||
local ids = mapGenerator.nodeIDs
|
||||
|
||||
if rocksNoise == nil then
|
||||
rocksNoise = core.get_value_noise(rocksNoiseParams)
|
||||
end
|
||||
|
||||
local noiseRocksValue = (rocksNoise:get_3d({x = x, y = y, z = z}))
|
||||
--[[if noiseRocksValue == 1 then
|
||||
data[index] = ids.malachite
|
||||
elseif noiseRocksValue == 2 then
|
||||
data[index] = ids.hapcoryte
|
||||
elseif noiseRocksValue == 3 then
|
||||
data[index] = ids.iyellite
|
||||
elseif noiseRocksValue == 4 then
|
||||
data[index] = ids.sylite
|
||||
elseif noiseRocksValue == 5 then
|
||||
data[index] = ids.tauitite
|
||||
elseif noiseRocksValue == 6 then
|
||||
data[index] = ids.falmyte
|
||||
elseif noiseRocksValue == 7 then
|
||||
data[index] = ids.burcite
|
||||
elseif noiseRocksValue == 8 then
|
||||
data[index] = ids.felhor
|
||||
end--]]
|
||||
if noiseRocksValue > 5 then
|
||||
data[index] = ids.syliteBlack
|
||||
elseif noiseRocksValue > 4.5 then
|
||||
data[index] = ids.syliteGray
|
||||
else
|
||||
data[index] = ids.sylite
|
||||
end
|
||||
end
|
||||
|
||||
---@param biome MapGen.Biome
|
||||
local function generateSoil(biome, mapGenerator, factors, data, index, x, y, z)
|
||||
local ids = mapGenerator.nodeIDs
|
||||
if rocksNoise == nil then
|
||||
rocksNoise = core.get_value_noise(rocksNoiseParams)
|
||||
end
|
||||
|
||||
local noiseRocksValue = (rocksNoise:get_3d({x = x, y = y, z = z}))
|
||||
|
||||
if noiseRocksValue > 5 then
|
||||
data[index] = ids.syliteBlack
|
||||
elseif noiseRocksValue > 4.5 then
|
||||
data[index] = ids.syliteGray
|
||||
elseif noiseRocksValue > 4 then
|
||||
data[index] = ids.sylite
|
||||
else
|
||||
data[index] = biome.groundNodesIDs.soil
|
||||
end
|
||||
end
|
||||
|
||||
---@param biome MapGen.Biome
|
||||
local function generateTurf(biome, mapGenerator, factors, data, index, x, y, z)
|
||||
local ids = mapGenerator.nodeIDs
|
||||
if rocksNoise == nil then
|
||||
rocksNoise = core.get_value_noise(rocksNoiseParams)
|
||||
end
|
||||
|
||||
local noiseRocksValue = (rocksNoise:get_3d({x = x, y = y, z = z}))
|
||||
|
||||
if noiseRocksValue > 5 then
|
||||
data[index] = ids.syliteBlack
|
||||
elseif noiseRocksValue > 4.5 then
|
||||
data[index] = ids.syliteGray
|
||||
elseif noiseRocksValue > 4 then
|
||||
data[index] = ids.sylite
|
||||
else
|
||||
data[index] = biome.groundNodesIDs.turf
|
||||
end
|
||||
end
|
||||
|
||||
---@param area VoxelArea
|
||||
local function postProcessing(biome, mapGenerator, factors, data, index, x, y, z, nodeType, area)
|
||||
local trufID = biome.groundNodesIDs.turf
|
||||
local waterID = mapGenerator.nodeIDs.water
|
||||
if data[index] ~= trufID then
|
||||
return
|
||||
end
|
||||
|
||||
if (data[area:index(x+1, y, z)] == trufID or data[area:index(x+1, y, z)] == waterID) and
|
||||
(data[area:index(x-1, y, z)] == trufID or data[area:index(x-1, y, z)] == waterID) and
|
||||
(data[area:index(x, y, z+1)] == trufID or data[area:index(x, y, z+1)] == waterID) and
|
||||
(data[area:index(x, y, z-1)] == trufID or data[area:index(x, y, z-1)] == waterID) then
|
||||
data[index] = mapGenerator.nodeIDs.water
|
||||
end
|
||||
end
|
||||
|
||||
--[[
|
||||
mapGenerator:registerBiome('midgard', 'swamp', {
|
||||
tempPoint = 0,
|
||||
humidityPoint = 80,
|
||||
minY = 100,
|
||||
maxY = -50,
|
||||
groundNodes = {
|
||||
soil = 'soils:rocky_soil_baren',
|
||||
turf = 'soils:turf_swamp',
|
||||
rock = 'rocks:sylite',
|
||||
bottom = 'soils:rocky_soil_baren',
|
||||
},
|
||||
soilHeight = 3,
|
||||
generateRock = generateRock,
|
||||
generateTurf = generateTurf,
|
||||
generateSoil = generateSoil,
|
||||
postProcessing = postProcessing
|
||||
})--]]
|
||||
---@type NoiseParams
|
||||
local ryeNoiseParams = {
|
||||
offset = 0,
|
||||
@@ -724,7 +610,7 @@ local function meadowPostProcessing(biome, mapGenerator, factors, data, data2, i
|
||||
end
|
||||
|
||||
if ryeNoise:get_2d({x=x, y=z}) - math.random(0, 3) < -8 then
|
||||
data[index] = mapGenerator.nodeIDs.tauititeLight
|
||||
data[index] = mapGenerator.nodeIDs.limestone
|
||||
end
|
||||
end
|
||||
|
||||
@@ -736,7 +622,7 @@ mapGenerator:registerBiome('midgard', 'green_meadow', {
|
||||
groundNodes = {
|
||||
soil = 'soils:humus',
|
||||
turf = 'soils:turf_meadow',
|
||||
rock = 'rocks:sylite',
|
||||
rock = 'rocks:basalt',
|
||||
bottom = 'soils:humus',
|
||||
},
|
||||
soilHeight = 5,
|
||||
@@ -757,34 +643,6 @@ mapGenerator:registerBiome('midgard', 'green_meadow', {
|
||||
end
|
||||
end
|
||||
end
|
||||
--generateRock = generateRock,
|
||||
--generateTurf = generateTurf,
|
||||
--generateSoil = generateSoil,
|
||||
--postProcessing = postProcessing
|
||||
})
|
||||
|
||||
mapGenerator:registerBiome('midgard', 'test_factors_biome', {
|
||||
tempPoint = 10,
|
||||
humidityPoint = 10,
|
||||
minY = -1000,
|
||||
maxY = 100,
|
||||
groundNodes = {
|
||||
soil = 'soils:humus',
|
||||
turf = 'soils:turf_meadow',
|
||||
rock = 'rocks:sylite',
|
||||
bottom = 'soils:humus',
|
||||
},
|
||||
soilHeight = 5,
|
||||
generateTurf = function (self, mapGenerator, factors, data, data2, index, x, y, z)
|
||||
local weight = factors.weight
|
||||
if weight <= 0.3 then
|
||||
data[index] = id('rocks:sylite')
|
||||
elseif weight <= 0.6 then
|
||||
data[index] = id('rocks:sylite_gray')
|
||||
else
|
||||
data[index] = id('rocks:sylite_black')
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
mapGenerator:registerTree('test_tree', {
|
||||
|
||||
Reference in New Issue
Block a user