MapGen: fix annotations warnings
This commit is contained in:
@@ -5,9 +5,9 @@ local mathAbs, mathRound, mathMin, mathMax, id
|
||||
local pastCalcNoiseValue = {
|
||||
---@type MapGen.Triangle?
|
||||
triangle = nil,
|
||||
---@type number?
|
||||
---@type integer?
|
||||
x = nil,
|
||||
---@type number?
|
||||
---@type integer?
|
||||
z = nil,
|
||||
---@type number?
|
||||
noiseValue = nil,
|
||||
@@ -353,9 +353,9 @@ end
|
||||
|
||||
---Returns `true` if there is a cavern at the specified coordinates.
|
||||
---@param layer MapGen.Layer
|
||||
---@param x number
|
||||
---@param y number
|
||||
---@param z number
|
||||
---@param x integer
|
||||
---@param y integer
|
||||
---@param z integer
|
||||
---@return boolean
|
||||
local function isCavern(layer, x, y, z)
|
||||
for _, cavern in ipairs(layer.cavernsList) do
|
||||
@@ -376,9 +376,9 @@ end
|
||||
---@param humidity number
|
||||
---@param data number[]
|
||||
---@param index number
|
||||
---@param x number
|
||||
---@param y number
|
||||
---@param z number
|
||||
---@param x integer
|
||||
---@param y integer
|
||||
---@param z integer
|
||||
local function generateNode(mapGenerator, layer, height, temp, humidity, data, index, x, y, z)
|
||||
local ids = mapGenerator.nodeIDs
|
||||
local waterLevel = layer.waterLevel
|
||||
@@ -388,6 +388,7 @@ local function generateNode(mapGenerator, layer, height, temp, humidity, data, i
|
||||
local scatteringVertical = layer.biomesVerticalScattering or 0
|
||||
local scattTemp = temp
|
||||
local scattHumidity = humidity
|
||||
---@type number
|
||||
local scattHeight = y
|
||||
|
||||
if scatteringGorizontal ~= 0 then
|
||||
@@ -467,9 +468,9 @@ end
|
||||
---the triangle's height and specifying the distance to the peak
|
||||
---for which the weight is calculated.
|
||||
---@param height MapGen.Triangulation.Edge
|
||||
---@param x number
|
||||
---@param y number
|
||||
---@param z number
|
||||
---@param x integer
|
||||
---@param y integer
|
||||
---@param z integer
|
||||
---@return number
|
||||
local function calcWeight(height, x, y, z)
|
||||
local pos1 = vector.new(x, y, z)
|
||||
@@ -491,8 +492,8 @@ end
|
||||
|
||||
---Returns `true` if the point is within the triangle's region.
|
||||
---The barycentric coordinate method is used.
|
||||
---@param px number
|
||||
---@param pz number
|
||||
---@param px integer
|
||||
---@param pz integer
|
||||
---@param triangle MapGen.Triangle
|
||||
local function pointInTriangle(px, pz, triangle)
|
||||
local posP = vector.new(px, 0, pz)
|
||||
@@ -521,9 +522,9 @@ end
|
||||
---@param category MapGen.Layer.Category
|
||||
---@param layer MapGen.Layer
|
||||
---@param triangle MapGen.Triangle
|
||||
---@param x number
|
||||
---@param y number
|
||||
---@param z number
|
||||
---@param x integer
|
||||
---@param y integer
|
||||
---@param z integer
|
||||
---@return number
|
||||
local function calcNoise2dValue(category, layer, triangle, x, y, z)
|
||||
local peak1 = triangle.p1
|
||||
@@ -561,9 +562,9 @@ end
|
||||
---Returns `nil` if the point is not included in any triangle.
|
||||
---@param category MapGen.Layer.Category
|
||||
---@param layer MapGen.Layer
|
||||
---@param x number
|
||||
---@param y number
|
||||
---@param z number
|
||||
---@param x integer
|
||||
---@param y integer
|
||||
---@param z integer
|
||||
---@return number?
|
||||
function MapGen:getNoises2dValue(category, layer, x, y, z)
|
||||
---@type MapGen.PastCalcNoiseValue
|
||||
@@ -696,9 +697,9 @@ end
|
||||
---@param mapGenerator MapGen
|
||||
---@param data number[]
|
||||
---@param index number
|
||||
---@param x number
|
||||
---@param y number
|
||||
---@param z number
|
||||
---@param x integer
|
||||
---@param y integer
|
||||
---@param z integer
|
||||
local function generatorHandler(mapGenerator, data, index, x, y, z)
|
||||
-- If the node belongs to a static layer, then a static node is generated.
|
||||
local static = mapGenerator:getStaticByHeight(y)
|
||||
@@ -732,8 +733,8 @@ end
|
||||
|
||||
---Chunk generation handler.
|
||||
---@param voxelManip VoxelManip
|
||||
---@param minPos table
|
||||
---@param maxPos table
|
||||
---@param minPos Position
|
||||
---@param maxPos Position
|
||||
---@param blockseed number
|
||||
function MapGen:onMapGenerated(voxelManip, minPos, maxPos, blockseed)
|
||||
-- We obtain a generation area for further manipulations
|
||||
@@ -795,6 +796,7 @@ function MapGen:run()
|
||||
error('Only one instance of a `MapGen` class can be running.')
|
||||
end
|
||||
|
||||
---@param ... VoxelManip
|
||||
core.register_on_generated(function(...)
|
||||
self:onMapGenerated(...)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user