Fix annotation MapPosition -> MapVector

This commit is contained in:
Van
2026-05-23 21:20:05 +03:00
parent 3eb8b375ec
commit 9389b02cda
12 changed files with 29 additions and 50 deletions

View File

@@ -136,7 +136,7 @@ end
---Returns the `MapGen.Peak` at the coordinates. If there is no peak at these coordinates, it returns `nil`.
---@param layer string|MapGen.Layer The layer or name of the layer in which the peak is located.
---@param pos MapPosition Coordinate of the desired peak.
---@param pos MapVector Coordinate of the desired peak.
---@return MapGen.Peak?
function MapGen:getPeakByPos(layer, pos)
if type(layer) == 'string' then
@@ -217,7 +217,7 @@ end
---If the point is inside the region, it will also return the distance to the nearest border.
---@param layer MapGen.Layer The name of the layer in which the region is located.
---@param regionName string The name of the region in which the location of the point is checked.
---@param point MapPosition Point position.
---@param point MapVector Point position.
---@return boolean, number?
function MapGen:pointInRegion2D(layer, regionName, point)
local region = layer.regionsByName[regionName]
@@ -236,7 +236,7 @@ end
function MapGen:isCavern(layer, x, y, z)
for _, cavern in ipairs(layer.cavernsList) do
if cavern.isRegional then
local inRegion, distance = self:pointInRegion2D(layer, cavern.name, {x=x,y=y,z=z})
local inRegion, distance = self:pointInRegion2D(layer, cavern.name, vector.new(x, y, z))
if inRegion and distance ~= nil then
if cavern:isCavern(x, y, z, distance) then
@@ -336,7 +336,7 @@ function MapGen:getTriangulateBoundaryVertices(triangles)
end
-- Walk along boundary edges to create ordered vertex list
---@type MapPosition[]
---@type MapVector[]
local boundary = {}
---@type table<string, boolean>
local visited = {}
@@ -455,7 +455,7 @@ end
---@param layerName string The name of the layer in which the new cavern will be included.
---@param cavernName string The name to be assigned to the cavern. The name must be unique for each cavern.
---@param def MapGen.CavernDef Cavern description table, see details `MapGen.CavernDef`
---@param regionVertices MapPosition[]? The region to which the cave generation will be limited.
---@param regionVertices MapVector[]? The region to which the cave generation will be limited.
function MapGen:registerCavern(layerName, cavernName, def, regionVertices)
local layer = self:getLayerByName(layerName)
@@ -774,7 +774,7 @@ function MapGen:getFactors(layer, x, y, z)
end
-- TODO: это сильно тормозит обычные чанки, но ускоряет те, что находятся за границей
if not self:pointInRegion2D(layer, 'triangles_boundary', {x=x, y=y, z=z}) then
if not self:pointInRegion2D(layer, 'triangles_boundary', vector.new(x, y, z)) then
return
end
@@ -875,8 +875,8 @@ end
---Chunk generation handler.
---@param voxelManip VoxelManip
---@param minPos MapPosition
---@param maxPos MapPosition
---@param minPos MapVector
---@param maxPos MapVector
---@param blockseed number
function MapGen:onMapGenerated(voxelManip, minPos, maxPos, blockseed)
local minPosStr, maxPosStr = posToString(minPos), posToString(maxPos)