Submodules: update ide-helper and fix mapgen annotations
This commit is contained in:
@@ -133,7 +133,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 category MapGen.Layer.Category The category in which the peak is located.
|
||||
---@param pos Position Coordinate of the desired peak.
|
||||
---@param pos MapPosition Coordinate of the desired peak.
|
||||
---@return MapGen.Peak?
|
||||
function MapGen:getPeakByPos(layer, category, pos)
|
||||
if type(layer) == 'string' then
|
||||
@@ -177,7 +177,7 @@ end
|
||||
---**Important:** works only in the XZ plane.
|
||||
---@param layer string|MapGen.Layer The layer or name of the layer the triangle is in.
|
||||
---@param category MapGen.Layer.Category The category in which the triangle is in.
|
||||
---@param pos Position Coordinate of the desired peak.
|
||||
---@param pos MapPosition Coordinate of the desired peak.
|
||||
---@return MapGen.Triangle?
|
||||
function MapGen:getTriangleByPos2D(layer, category, pos)
|
||||
if type(layer) == 'string' then
|
||||
@@ -196,7 +196,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 Position Point position.
|
||||
---@param point MapPosition Point position.
|
||||
---@return boolean, number?
|
||||
function MapGen:pointInRegion2D(layer, regionName, point)
|
||||
local region = layer.regionsByName[regionName]
|
||||
@@ -315,7 +315,7 @@ function MapGen:getTriangulateBoundaryVertices(triangles)
|
||||
end
|
||||
|
||||
-- Walk along boundary edges to create ordered vertex list
|
||||
---@type Position[]
|
||||
---@type MapPosition[]
|
||||
local boundary = {}
|
||||
---@type table<string, boolean>
|
||||
local visited = {}
|
||||
@@ -473,7 +473,7 @@ end
|
||||
---@param layerName string The name of the layer in which the new peaks will be included.
|
||||
---@param map string The name of the image from which the peaks will be extracted. It should be located in the `<mod_name>/textures/maps` folder and have the following format `<image_name>.ff`
|
||||
---@param scale number Multiplier of how many blocks (nodes) will be between image pixels. It is not recommended to set the value below 50 for performance reasons.
|
||||
---@param zeroPos Position2d The position in pixels where the zero world coordinate will be in the image.
|
||||
---@param zeroPos IntegerPosition2d The position in pixels where the zero world coordinate will be in the image.
|
||||
---@param category MapGen.Layer.Category Category indicating what will be generated by peaks.
|
||||
---@param groups? table<string, number> Groups that will be added to all peaks.
|
||||
function MapGen:register2DPeaksFromFile(layerName, map, scale,zeroPos, category, groups)
|
||||
@@ -495,16 +495,17 @@ function MapGen:register2DPeaksFromFile(layerName, map, scale,zeroPos, category,
|
||||
|
||||
for color, peaksPos in pairs(peaks) do
|
||||
for _, peakPos in ipairs(peaksPos) do
|
||||
---@type integer, integer
|
||||
x, z = (peakPos.x - zeroPos.x - 1) * scale, (peakPos.y - zeroPos.y - 1) * -scale
|
||||
|
||||
-- Converting a rectangular grid into an isometric-like one.
|
||||
if peakPos.y % 2 == 1 then
|
||||
x = x + (scale/2)
|
||||
x = mathRound(x + (scale/2))
|
||||
end
|
||||
|
||||
---@type MapGen.PeakDef
|
||||
local def = {
|
||||
pos = vector.new(x, 0, z),
|
||||
pos = {x=x, y=0, z=z},
|
||||
color = color,
|
||||
groups = groups,
|
||||
}
|
||||
@@ -518,7 +519,7 @@ end
|
||||
---If the peak does not exist, an error will be raised.
|
||||
---@param layerName string The name of the layer in which the new peak will be included.
|
||||
---@param category MapGen.Layer.Category Category indicating what will be generated by peak.
|
||||
---@param pos Position The position of the peak to which the group should be added.
|
||||
---@param pos MapPosition The position of the peak to which the group should be added.
|
||||
---@param groups table<string, number> Groups to be added.
|
||||
function MapGen:addGroupsToPeakByPos(layerName, category, pos, groups)
|
||||
local layer = self:getLayerByName(layerName)
|
||||
@@ -546,7 +547,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 Position[]? The region to which the cave generation will be limited.
|
||||
---@param regionVertices MapPosition[]? The region to which the cave generation will be limited.
|
||||
function MapGen:registerCavern(layerName, cavernName, def, regionVertices)
|
||||
local layer = self:getLayerByName(layerName)
|
||||
|
||||
@@ -1023,8 +1024,8 @@ end
|
||||
|
||||
---Chunk generation handler.
|
||||
---@param voxelManip VoxelManip
|
||||
---@param minPos Position
|
||||
---@param maxPos Position
|
||||
---@param minPos MapPosition
|
||||
---@param maxPos MapPosition
|
||||
---@param blockseed number
|
||||
function MapGen:onMapGenerated(voxelManip, minPos, maxPos, blockseed)
|
||||
-- We obtain a generation area for further manipulations
|
||||
|
||||
@@ -16,14 +16,14 @@ local Peak = {
|
||||
---
|
||||
---**Only for EmmyLua.**
|
||||
---@class MapGen.PeakDef
|
||||
---@field pos vector
|
||||
---@field pos MapPosition
|
||||
---@field color ColorString
|
||||
---@field groups? table<string, number>
|
||||
|
||||
---@param def MapGen.PeakDef
|
||||
---@return MapGen.Peak
|
||||
function Peak:new(def)
|
||||
local _pos = def.pos
|
||||
local _pos = vector.new(def.pos)
|
||||
local _color = def.color
|
||||
local _groups
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@ local getInstance = Class.getInstance
|
||||
|
||||
---@class MapGen.Region
|
||||
---@field name string
|
||||
---@field vertices Position[]
|
||||
---@field vertices MapPosition[]
|
||||
local Region = {}
|
||||
|
||||
---@class MapGen.RegionDef
|
||||
---@field vertices Position[]
|
||||
---@field vertices MapPosition[]
|
||||
|
||||
---@param def MapGen.RegionDef
|
||||
---@return MapGen.Region
|
||||
@@ -50,7 +50,7 @@ local function calcDistanceSq(px, pz, x1, z1, x2, z2)
|
||||
end
|
||||
|
||||
---Checks if a point is inside a `MapGen.Region` (2D check using x and z coordinates).
|
||||
---@param point Position
|
||||
---@param point MapPosition
|
||||
---@return boolean, number?
|
||||
function Region:pointInRegion(point)
|
||||
local vertices = self.vertices
|
||||
|
||||
Submodule util/ide-helper updated: e5a12d31ba...5d3804168b
Reference in New Issue
Block a user