forked from Apancore.Studio/simple-makes-complex
Mapgen: write SuperUltraSigmaMapgen part 7.3
This commit is contained in:
@@ -188,18 +188,15 @@ function MapGen:register2DPeaks(layerName, multinoise, peakPoses, groups)
|
||||
end
|
||||
|
||||
---TODO: описание
|
||||
---@param layerName string
|
||||
---@param biomeName string
|
||||
---@param tempPoint number
|
||||
---@param humidityPoint number
|
||||
---@param groundNodes MapGen.Biome.GroundNodes
|
||||
---@param soilHeight number
|
||||
function MapGen:registerBiome(layerName, biomeName, tempPoint, humidityPoint, groundNodes, soilHeight)
|
||||
---@param layerName string
|
||||
---@param biomeName string
|
||||
---@param def MapGen.Layer.BiomeDef
|
||||
function MapGen:registerBiome(layerName, biomeName, def)
|
||||
local layer = self.layersByName[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))
|
||||
|
||||
local biome = Biome:new(biomeName, tempPoint, humidityPoint, groundNodes, soilHeight)
|
||||
local biome = Biome:new(biomeName, def)
|
||||
|
||||
layer.biomesByName[biomeName] = biome
|
||||
table.insert(layer.biomesList, biome)
|
||||
|
||||
@@ -6,20 +6,23 @@
|
||||
---@field soilHeight number
|
||||
local Biome = {}
|
||||
|
||||
---@param name string
|
||||
---@param tempPoint number
|
||||
---@param humidityPoint number
|
||||
---@param groundNodes MapGen.Biome.GroundNodes
|
||||
---@param soilHeight number
|
||||
---@return MapGen.Layer.Biome
|
||||
function Biome:new(name, tempPoint, humidityPoint, groundNodes, soilHeight)
|
||||
---@class MapGen.Layer.BiomeDef
|
||||
---@field tempPoint number
|
||||
---@field humidityPoint number
|
||||
---@field groundNodes MapGen.Biome.GroundNodes
|
||||
---@field soilHeight number
|
||||
|
||||
---@param name string
|
||||
---@param def MapGen.Layer.BiomeDef
|
||||
---@return MapGen.Layer.Biome
|
||||
function Biome:new(name, def)
|
||||
---@type MapGen.Layer.Biome
|
||||
local instance = setmetatable({
|
||||
name = name,
|
||||
tempPoint = tempPoint,
|
||||
humidityPoint = humidityPoint,
|
||||
groundNodes = groundNodes,
|
||||
soilHeight = soilHeight,
|
||||
tempPoint = def.tempPoint,
|
||||
humidityPoint = def.humidityPoint,
|
||||
groundNodes = def.groundNodes,
|
||||
soilHeight = def.soilHeight,
|
||||
}, {__index = self})
|
||||
|
||||
return instance
|
||||
|
||||
Reference in New Issue
Block a user