Mapgen: write SuperUltraSigmaMapgen part 7.3
This commit is contained in:
@@ -190,16 +190,13 @@ end
|
|||||||
---TODO: описание
|
---TODO: описание
|
||||||
---@param layerName string
|
---@param layerName string
|
||||||
---@param biomeName string
|
---@param biomeName string
|
||||||
---@param tempPoint number
|
---@param def MapGen.Layer.BiomeDef
|
||||||
---@param humidityPoint number
|
function MapGen:registerBiome(layerName, biomeName, def)
|
||||||
---@param groundNodes MapGen.Biome.GroundNodes
|
|
||||||
---@param soilHeight number
|
|
||||||
function MapGen:registerBiome(layerName, biomeName, tempPoint, humidityPoint, groundNodes, soilHeight)
|
|
||||||
local layer = self.layersByName[layerName]
|
local layer = self.layersByName[layerName]
|
||||||
assert(layer ~= nil, ('There is no layer named `%s` registered.'):format(layerName))
|
assert(layer ~= nil, ('There is no layer named `%s` registered.'):format(layerName))
|
||||||
assert(layer.biomesByName[biomeName] == nil, ('A biome named `%s` already exists in the `%s` layer.'):format(biomeName, layerName))
|
assert(layer.biomesByName[biomeName] == nil, ('A biome named `%s` already exists in the `%s` layer.'):format(biomeName, layerName))
|
||||||
|
|
||||||
local biome = Biome:new(biomeName, tempPoint, humidityPoint, groundNodes, soilHeight)
|
local biome = Biome:new(biomeName, def)
|
||||||
|
|
||||||
layer.biomesByName[biomeName] = biome
|
layer.biomesByName[biomeName] = biome
|
||||||
table.insert(layer.biomesList, biome)
|
table.insert(layer.biomesList, biome)
|
||||||
|
|||||||
@@ -6,20 +6,23 @@
|
|||||||
---@field soilHeight number
|
---@field soilHeight number
|
||||||
local Biome = {}
|
local Biome = {}
|
||||||
|
|
||||||
|
---@class MapGen.Layer.BiomeDef
|
||||||
|
---@field tempPoint number
|
||||||
|
---@field humidityPoint number
|
||||||
|
---@field groundNodes MapGen.Biome.GroundNodes
|
||||||
|
---@field soilHeight number
|
||||||
|
|
||||||
---@param name string
|
---@param name string
|
||||||
---@param tempPoint number
|
---@param def MapGen.Layer.BiomeDef
|
||||||
---@param humidityPoint number
|
|
||||||
---@param groundNodes MapGen.Biome.GroundNodes
|
|
||||||
---@param soilHeight number
|
|
||||||
---@return MapGen.Layer.Biome
|
---@return MapGen.Layer.Biome
|
||||||
function Biome:new(name, tempPoint, humidityPoint, groundNodes, soilHeight)
|
function Biome:new(name, def)
|
||||||
---@type MapGen.Layer.Biome
|
---@type MapGen.Layer.Biome
|
||||||
local instance = setmetatable({
|
local instance = setmetatable({
|
||||||
name = name,
|
name = name,
|
||||||
tempPoint = tempPoint,
|
tempPoint = def.tempPoint,
|
||||||
humidityPoint = humidityPoint,
|
humidityPoint = def.humidityPoint,
|
||||||
groundNodes = groundNodes,
|
groundNodes = def.groundNodes,
|
||||||
soilHeight = soilHeight,
|
soilHeight = def.soilHeight,
|
||||||
}, {__index = self})
|
}, {__index = self})
|
||||||
|
|
||||||
return instance
|
return instance
|
||||||
|
|||||||
@@ -159,14 +159,24 @@ mapGenerator:registerCavern('world', 'cavern1', {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
mapGenerator:registerBiome('world', "biome1", 0, 0, {
|
mapGenerator:registerBiome('world', "biome1", {
|
||||||
|
tempPoint = 0,
|
||||||
|
humidityPoint = 0,
|
||||||
|
groundNodes = {
|
||||||
soil = "soils:clay_soil_baren",
|
soil = "soils:clay_soil_baren",
|
||||||
turf = "soils:clay_soil_baren",
|
turf = "soils:clay_soil_baren",
|
||||||
}, 1)
|
},
|
||||||
|
soilHeight = 1
|
||||||
|
})
|
||||||
|
|
||||||
mapGenerator:registerBiome('world', "biome2", 100, 100, {
|
mapGenerator:registerBiome('world', "biome2", {
|
||||||
|
tempPoint = 100,
|
||||||
|
humidityPoint = 100,
|
||||||
|
groundNodes = {
|
||||||
soil = "soils:rocky_soil_baren",
|
soil = "soils:rocky_soil_baren",
|
||||||
turf = "soils:rocky_soil_baren",
|
turf = "soils:rocky_soil_baren",
|
||||||
}, 1)
|
},
|
||||||
|
soilHeight = 1
|
||||||
|
})
|
||||||
|
|
||||||
mapGenerator:run()
|
mapGenerator:run()
|
||||||
Reference in New Issue
Block a user