Mapgen: write SuperUltraSigmaMapgen part 7 (async)
This commit is contained in:
@@ -62,3 +62,5 @@ function Mod:getModClassExtended(ChildClass)
|
||||
|
||||
return childClass
|
||||
end
|
||||
|
||||
return Mod
|
||||
@@ -34,3 +34,5 @@ function Require.getModRequire(modName, modPath)
|
||||
|
||||
return require
|
||||
end
|
||||
|
||||
return Require
|
||||
@@ -37,7 +37,7 @@ local pastNoise2DCalc = {
|
||||
}
|
||||
}
|
||||
|
||||
local modInfo = Mod.getInfo()
|
||||
local modInfo = Mod.getInfo('smc__core__map_gen')
|
||||
local require = modInfo.require
|
||||
|
||||
---@type MapGen.Layer
|
||||
@@ -70,7 +70,7 @@ local MapGen = {
|
||||
isRunning = false,
|
||||
}
|
||||
|
||||
---@param nodeIDs table<string, string>
|
||||
---@param nodeIDs table<string, number>
|
||||
---@return MapGen
|
||||
function MapGen:new(nodeIDs)
|
||||
---@type MapGen
|
||||
@@ -623,12 +623,15 @@ local function generatorHandler(mapGenerator, data, index, x, y, z)
|
||||
generateNode(mapGenerator, layer, noiseHeightValue, noiseTempValue, noiseHumidityValue, data, index, x, y, z)
|
||||
end
|
||||
|
||||
---@param voxelManip VoxelManip
|
||||
---@param minPos table
|
||||
---@param maxPos table
|
||||
---@param blockseed number
|
||||
function MapGen:onMapGenerated(minPos, maxPos, blockseed)
|
||||
function MapGen:onMapGenerated(voxelManip, minPos, maxPos, blockseed)
|
||||
-- We obtain a generation area for further manipulations
|
||||
local voxelManip, eMin, eMax = core.get_mapgen_object('voxelmanip')
|
||||
--local voxelManip, eMin, eMax = core.get_mapgen_object('voxelmanip')
|
||||
|
||||
local eMin, eMax = voxelManip:get_emerged_area()
|
||||
|
||||
if not self.peaksMultinoiseInitialized then
|
||||
self:initPeaksMultinoise()
|
||||
@@ -665,7 +668,7 @@ function MapGen:onMapGenerated(minPos, maxPos, blockseed)
|
||||
voxelManip:calc_lighting()
|
||||
voxelManip:update_liquids()
|
||||
|
||||
voxelManip:write_to_map()
|
||||
--voxelManip:write_to_map() -- Async edit
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -63,9 +63,9 @@ function Cavern:new(name, def)
|
||||
end
|
||||
|
||||
function instance:initNoise()
|
||||
if not table.is_empty(_noise) then
|
||||
minetest.log('warning', 'Cavern noise has already been initialized. Re-initialization is not recommended.')
|
||||
end
|
||||
--if not table.is_empty(_noise) then
|
||||
-- minetest.log('warning', 'Cavern noise has already been initialized. Re-initialization is not recommended.')
|
||||
--end
|
||||
|
||||
_noise = core.get_value_noise(_noiseParams)
|
||||
end
|
||||
|
||||
@@ -66,9 +66,9 @@ function Peak:new(peakPos, multinoiseParams, groups)
|
||||
end
|
||||
|
||||
function instance:initMultinoise()
|
||||
if not table.is_empty(_multinoise) then
|
||||
minetest.log('warning', 'Multinoise has already been initialized. Re-initialization is not recommended.')
|
||||
end
|
||||
--if not table.is_empty(_multinoise) then
|
||||
-- minetest.log('warning', 'Multinoise has already been initialized. Re-initialization is not recommended.')
|
||||
--end
|
||||
|
||||
_multinoise = multinoiseParamsToMultinoise(_multinoiseParams)
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local mathAbs = math.abs
|
||||
|
||||
local modInfo = Mod.getInfo()
|
||||
local modInfo = Mod.getInfo('smc__core__map_gen')
|
||||
local require = modInfo.require
|
||||
|
||||
---@type MapGen.Triangle
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local mathSqrt, mathAbs
|
||||
= math.sqrt, math.abs
|
||||
|
||||
local modInfo = Mod.getInfo()
|
||||
local modInfo = Mod.getInfo('smc__core__map_gen')
|
||||
local require = modInfo.require
|
||||
|
||||
---@type MapGen.Triangulation.Edge
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
local assert, mathMax, tableRemove
|
||||
= assert, math.max, table.remove
|
||||
|
||||
local modInfo = Mod.getInfo()
|
||||
local modInfo = Mod.getInfo('smc__core__map_gen')
|
||||
local require = modInfo.require
|
||||
|
||||
---@type MapGen.Triangle
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
local modInfo = Mod.getInfo()
|
||||
local modInfo = Mod.getInfo('smc__core__map_gen')
|
||||
local require = modInfo.require
|
||||
|
||||
---@type MapGen.Peak
|
||||
|
||||
146
mods/ENVIRONMENT/MapGenerator/MapGenerator.lua
Normal file
146
mods/ENVIRONMENT/MapGenerator/MapGenerator.lua
Normal file
@@ -0,0 +1,146 @@
|
||||
-- MAPGEN ENVIROMENT ONLY
|
||||
|
||||
local id = core.get_content_id
|
||||
|
||||
Require = dofile(core.get_modpath('smc__api__require')..'/init.lua')
|
||||
|
||||
---@type Mod
|
||||
Mod = dofile(core.get_modpath('smc__api__mod')..'/init.lua')
|
||||
print(core.get_modpath('smc__api__mod')..'/init.lua')
|
||||
|
||||
local mapGenRequire = Mod.getInfo('smc__core__map_gen').require
|
||||
|
||||
---@type MapGen
|
||||
local MapGen = mapGenRequire('MapGen')
|
||||
|
||||
---@type MapGen
|
||||
local mapGenerator = MapGen:new({
|
||||
-- Special nodes
|
||||
air = id("air"),
|
||||
|
||||
-- Rocks
|
||||
sylite = id("rocks:sylite"),
|
||||
tauitite = id("rocks:tauitite"),
|
||||
iyellite = id("rocks:iyellite"),
|
||||
falmyte = id("rocks:falmyte"),
|
||||
hapcoryte = id("rocks:hapcoryte"),
|
||||
burcite = id("rocks:burcite"),
|
||||
felhor = id("rocks:felhor"),
|
||||
malachite = id("rocks:malachite"),
|
||||
|
||||
-- Liquids
|
||||
water = id("liquids:water_source"),
|
||||
})
|
||||
|
||||
mapGenerator:RegisterLayer("world", -1000, 500)
|
||||
|
||||
local land1 = {
|
||||
offset = -20,
|
||||
scale = 5,
|
||||
spread = {x = 10, y = 10, z = 10},
|
||||
seed = 47,
|
||||
octaves = 3,
|
||||
persistence = 0.4,
|
||||
lacunarity = 2,
|
||||
}
|
||||
|
||||
local land2 = {
|
||||
offset = 20,
|
||||
scale = 5,
|
||||
spread = {x = 10, y = 10, z = 10},
|
||||
seed = 47,
|
||||
octaves = 3,
|
||||
persistence = 0.4,
|
||||
lacunarity = 2,
|
||||
}
|
||||
|
||||
local climat1 = {
|
||||
offset = 80,
|
||||
scale = 10,
|
||||
spread = {x = 10, y = 10, z = 10},
|
||||
seed = 47,
|
||||
octaves = 8,
|
||||
persistence = 0.6,
|
||||
lacunarity = 2,
|
||||
}
|
||||
|
||||
local climat2 = {
|
||||
offset = 30,
|
||||
scale = 10,
|
||||
spread = {x = 10, y = 10, z = 10},
|
||||
seed = 47,
|
||||
octaves = 8,
|
||||
persistence = 0.6,
|
||||
lacunarity = 2,
|
||||
}
|
||||
|
||||
local climat0 = {
|
||||
offset = 50,
|
||||
scale = 0,
|
||||
spread = {x = 10, y = 10, z = 10},
|
||||
seed = 47,
|
||||
octaves = 8,
|
||||
persistence = 0.4,
|
||||
lacunarity = 2,
|
||||
}
|
||||
|
||||
local v = vector.new
|
||||
|
||||
mapGenerator:register2DPeaks("world",
|
||||
{
|
||||
landscapeNoise = land1,
|
||||
tempNoise = climat2,
|
||||
humidityNoise = climat2,
|
||||
},{
|
||||
v(500, 0, 500),
|
||||
v(-500, 0, -500),
|
||||
v(-500, 0, 500),
|
||||
v(500, 0, -500),
|
||||
})
|
||||
|
||||
mapGenerator:register2DPeaks("world",
|
||||
{
|
||||
landscapeNoise = land2,
|
||||
tempNoise = climat1,
|
||||
humidityNoise = climat1,
|
||||
},{
|
||||
v(-300, 0, 300),
|
||||
v(200, 0, -400),
|
||||
})
|
||||
|
||||
mapGenerator:register2DPeaks("world",
|
||||
{
|
||||
landscapeNoise = land2,
|
||||
tempNoise = climat2,
|
||||
humidityNoise = climat2,
|
||||
},{
|
||||
v(200, 0, 100),
|
||||
v(-300, 0, -200),
|
||||
})
|
||||
|
||||
mapGenerator:registerCavern('world', 'cavern1', {
|
||||
minY = -100,
|
||||
maxY = -10,
|
||||
smoothDistance = 20,
|
||||
noiseParams ={
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x = 25, y = 25, z = 25},
|
||||
seed = 5934,
|
||||
octaves = 3,
|
||||
persistence = 0.5,
|
||||
lacunarity = 2.0
|
||||
},
|
||||
})
|
||||
|
||||
mapGenerator:registerBiome('world', "biome1", 0, 0, {
|
||||
soil = "soils:clay_soil_baren",
|
||||
turf = "soils:clay_soil_baren",
|
||||
}, 1)
|
||||
|
||||
mapGenerator:registerBiome('world', "biome2", 100, 100, {
|
||||
soil = "soils:rocky_soil_baren",
|
||||
turf = "soils:rocky_soil_baren",
|
||||
}, 1)
|
||||
|
||||
mapGenerator:run()
|
||||
@@ -1,147 +1 @@
|
||||
local id = core.get_content_id
|
||||
|
||||
---@type MapGen
|
||||
local mapGenerator = Core.MapGen.Class:new({
|
||||
-- Special nodes
|
||||
air = id("air"),
|
||||
|
||||
-- Rocks
|
||||
sylite = id("rocks:sylite"),
|
||||
tauitite = id("rocks:tauitite"),
|
||||
iyellite = id("rocks:iyellite"),
|
||||
falmyte = id("rocks:falmyte"),
|
||||
hapcoryte = id("rocks:hapcoryte"),
|
||||
burcite = id("rocks:burcite"),
|
||||
felhor = id("rocks:felhor"),
|
||||
malachite = id("rocks:malachite"),
|
||||
|
||||
-- Liquids
|
||||
water = id("liquids:water_source"),
|
||||
})
|
||||
|
||||
mapGenerator:RegisterLayer("world", -1000, 500)
|
||||
|
||||
local land1 = {
|
||||
offset = -20,
|
||||
scale = 5,
|
||||
spread = {x = 10, y = 10, z = 10},
|
||||
seed = 47,
|
||||
octaves = 3,
|
||||
persistence = 0.4,
|
||||
lacunarity = 2,
|
||||
}
|
||||
|
||||
local land2 = {
|
||||
offset = 20,
|
||||
scale = 5,
|
||||
spread = {x = 10, y = 10, z = 10},
|
||||
seed = 47,
|
||||
octaves = 3,
|
||||
persistence = 0.4,
|
||||
lacunarity = 2,
|
||||
}
|
||||
|
||||
local climat1 = {
|
||||
offset = 80,
|
||||
scale = 10,
|
||||
spread = {x = 10, y = 10, z = 10},
|
||||
seed = 47,
|
||||
octaves = 8,
|
||||
persistence = 0.6,
|
||||
lacunarity = 2,
|
||||
}
|
||||
|
||||
local climat2 = {
|
||||
offset = 30,
|
||||
scale = 10,
|
||||
spread = {x = 10, y = 10, z = 10},
|
||||
seed = 47,
|
||||
octaves = 8,
|
||||
persistence = 0.6,
|
||||
lacunarity = 2,
|
||||
}
|
||||
|
||||
local climat0 = {
|
||||
offset = 50,
|
||||
scale = 0,
|
||||
spread = {x = 10, y = 10, z = 10},
|
||||
seed = 47,
|
||||
octaves = 8,
|
||||
persistence = 0.4,
|
||||
lacunarity = 2,
|
||||
}
|
||||
|
||||
local v = vector.new
|
||||
|
||||
mapGenerator:register2DPeaks("world",
|
||||
{
|
||||
landscapeNoise = land1,
|
||||
tempNoise = climat2,
|
||||
humidityNoise = climat2,
|
||||
},{
|
||||
v(500, 0, 500),
|
||||
v(-500, 0, -500),
|
||||
v(-500, 0, 500),
|
||||
v(500, 0, -500),
|
||||
})
|
||||
|
||||
mapGenerator:register2DPeaks("world",
|
||||
{
|
||||
landscapeNoise = land2,
|
||||
tempNoise = climat1,
|
||||
humidityNoise = climat1,
|
||||
},{
|
||||
v(-300, 0, 300),
|
||||
v(200, 0, -400),
|
||||
})
|
||||
|
||||
mapGenerator:register2DPeaks("world",
|
||||
{
|
||||
landscapeNoise = land2,
|
||||
tempNoise = climat2,
|
||||
humidityNoise = climat2,
|
||||
},{
|
||||
v(200, 0, 100),
|
||||
v(-300, 0, -200),
|
||||
})
|
||||
|
||||
mapGenerator:registerCavern('world', 'cavern1', -100, -10, 20, {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x = 25, y = 25, z = 25},
|
||||
seed = 5934,
|
||||
octaves = 3,
|
||||
persistence = 0.5,
|
||||
lacunarity = 2.0
|
||||
})
|
||||
|
||||
mapGenerator:registerBiome('world', "biome1", 0, 0, {
|
||||
soil = "soils:clay_soil_baren",
|
||||
turf = "soils:clay_soil_baren",
|
||||
}, 1)
|
||||
|
||||
mapGenerator:registerBiome('world', "biome2", 100, 100, {
|
||||
soil = "soils:rocky_soil_baren",
|
||||
turf = "soils:rocky_soil_baren",
|
||||
}, 1)
|
||||
|
||||
mapGenerator:run()
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "blob",
|
||||
ore = "soils:clay_soil_baren",
|
||||
wherein = {"rocks:iyellite", "rocks:falmyte"},
|
||||
clust_scarcity = 16 * 16 * 16,
|
||||
clust_size = 5,
|
||||
y_max = 0,
|
||||
y_min = -3100,
|
||||
noise_threshold = 0.0,
|
||||
noise_params = {
|
||||
offset = 1,
|
||||
scale = 0.5,
|
||||
spread = {x = 5, y = 5, z = 5},
|
||||
seed = 2316,
|
||||
octaves = 1,
|
||||
persist = 0.0
|
||||
},
|
||||
})
|
||||
core.register_mapgen_script(core.get_modpath(core.get_current_modname())..'/MapGenerator.lua')
|
||||
Reference in New Issue
Block a user