Fix annotation MapPosition -> MapVector
This commit is contained in:
@@ -51,7 +51,7 @@ function ImmersiveCraft:new(name, def)
|
||||
Events.subscribe('craft_system:next_immersive_stage:'..name,
|
||||
---@param eventName string
|
||||
---@param stage CraftSystem.ImmersiveCraftStage
|
||||
---@param pos MapPosition
|
||||
---@param pos MapVector
|
||||
---@param Player Player
|
||||
function(eventName, stage, pos, Player)
|
||||
local nextStageName = stage.nextStage
|
||||
@@ -75,7 +75,7 @@ end
|
||||
---Initialize the start of the immersive crafting process.
|
||||
---
|
||||
---Returns `true` if the crafting process was running.
|
||||
---@param pos MapPosition
|
||||
---@param pos MapVector
|
||||
---@param player Player
|
||||
---@param amount integer
|
||||
---@return boolean
|
||||
@@ -109,7 +109,7 @@ function ImmersiveCraft:startCraft(pos, player, amount)
|
||||
end
|
||||
|
||||
---Complete the immersive crafting process.
|
||||
---@param pos MapPosition
|
||||
---@param pos MapVector
|
||||
---@param player Player
|
||||
function ImmersiveCraft:endCraft(pos, player)
|
||||
---@type ImmersiveWorkStation.MetaData
|
||||
@@ -136,7 +136,7 @@ function ImmersiveCraft:endCraft(pos, player)
|
||||
end
|
||||
|
||||
---Stop the crafting process and free up the workbench.
|
||||
---@param pos MapPosition
|
||||
---@param pos MapVector
|
||||
function ImmersiveCraft:abortCraft(pos)
|
||||
---@type ImmersiveWorkStation.MetaData
|
||||
local meta = core.get_meta(pos)
|
||||
|
||||
@@ -33,7 +33,7 @@ local ImmersiveCraftCounter = {
|
||||
---Add craft to the counter.
|
||||
---
|
||||
---Returns `false` if the counter is already full.
|
||||
---@param pos MapPosition
|
||||
---@param pos MapVector
|
||||
---@param playerName string
|
||||
---@return boolean
|
||||
function ImmersiveCraftCounter:addCraft(pos, playerName)
|
||||
@@ -57,7 +57,7 @@ function ImmersiveCraftCounter:addCraft(pos, playerName)
|
||||
end
|
||||
|
||||
---Remove craft from the counter.
|
||||
---@param pos MapPosition
|
||||
---@param pos MapVector
|
||||
---@param playerName string
|
||||
function ImmersiveCraftCounter:removeCraft(pos, playerName)
|
||||
local playerCrafts = self.craftsCountForPlayers[playerName]
|
||||
|
||||
@@ -14,7 +14,7 @@ local ImmersiveCraftNode = require('CraftSystem.ImmersiveCraftNode')
|
||||
---@field _set_item fun(self:CraftSystem.ImmersiveCraftNode.LuaTappingNode, itemName:ItemStackString?)
|
||||
---@field _craft_name string
|
||||
---@field _stage_name string
|
||||
---@field _work_station_pos MapPosition
|
||||
---@field _work_station_pos MapVector
|
||||
|
||||
-- A crafting node (entity) that is used in the tapping crafting stage.
|
||||
local tappingNode = ImmersiveCraftNode:new({
|
||||
|
||||
@@ -10,9 +10,9 @@ local ImmersiveCraftStage = require('CraftSystem.ImmersiveCraftStage')
|
||||
---@field targetItem string
|
||||
---@field clicksNeed string
|
||||
---@field toolGroup string?
|
||||
---@field startHandler fun(self:CraftSystem.ImmersiveCraftStage.TappingStage, pos:MapPosition, Player:Player)
|
||||
---@field processHandler fun(self:CraftSystem.ImmersiveCraftStage.TappingStage, pos:MapPosition, Player:Player)
|
||||
---@field endHandler fun(self:CraftSystem.ImmersiveCraftStage.TappingStage, pos:MapPosition, Player:Player)
|
||||
---@field startHandler fun(self:CraftSystem.ImmersiveCraftStage.TappingStage, pos:MapVector, Player:Player)
|
||||
---@field processHandler fun(self:CraftSystem.ImmersiveCraftStage.TappingStage, pos:MapVector, Player:Player)
|
||||
---@field endHandler fun(self:CraftSystem.ImmersiveCraftStage.TappingStage, pos:MapVector, Player:Player)
|
||||
---@field toString fun(self:CraftSystem.ImmersiveCraftStage.TappingStage):string
|
||||
local TappingStage = extend(ImmersiveCraftStage, {})
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@ end
|
||||
|
||||
---A wrapper around `Formspec:list` that allows access to the inventory of a node,
|
||||
---specified by the coordinates of its position in the world.
|
||||
---@param nodePos MapPosition
|
||||
---@param nodePos MapVector
|
||||
---@param listName string
|
||||
---@param x number
|
||||
---@param y number
|
||||
|
||||
@@ -104,13 +104,13 @@ function ImmersiveWorkStation:showForm(pos, player)
|
||||
PlayerInventoryUI:showForm(playerName)
|
||||
end
|
||||
|
||||
---@param pos MapPosition
|
||||
---@param pos MapVector
|
||||
function ImmersiveWorkStation:init(pos)
|
||||
---@type ImmersiveWorkStation.MetaData
|
||||
local meta = core.get_meta(pos)
|
||||
end
|
||||
|
||||
---@param pos MapPosition
|
||||
---@param pos MapVector
|
||||
function ImmersiveWorkStation:abortCraft(pos)
|
||||
---@type ImmersiveWorkStation.MetaData
|
||||
local meta = core.get_meta(pos)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -14,7 +14,7 @@ local FakePeak = Class.extend(Peak, {})
|
||||
|
||||
---Returns a fake `MapGen.Peak` that has no noise parameters.
|
||||
---Note that the initialized peak should not be used in generation.
|
||||
---@param peakPos MapPosition|vector
|
||||
---@param peakPos MapVector
|
||||
---@return MapGen.Peak
|
||||
function FakePeak:new(peakPos)
|
||||
local instance = Peak:new({pos = peakPos, color = '#000000'})
|
||||
|
||||
@@ -16,7 +16,7 @@ local Peak = {
|
||||
---
|
||||
---**Only for EmmyLua.**
|
||||
---@class MapGen.PeakDef
|
||||
---@field pos MapPosition|vector
|
||||
---@field pos MapVector
|
||||
---@field color ColorString
|
||||
---@field groups? table<string, number>
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@ local getInstance = Class.getInstance
|
||||
|
||||
---@class MapGen.Region
|
||||
---@field name string
|
||||
---@field vertices MapPosition[]
|
||||
---@field vertices MapVector[]
|
||||
local Region = {}
|
||||
|
||||
---@class MapGen.RegionDef
|
||||
---@field vertices MapPosition[]
|
||||
---@field vertices MapVector[]
|
||||
|
||||
---@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 MapPosition
|
||||
---@param point MapVector
|
||||
---@return boolean, number?
|
||||
function Region:pointInRegion(point)
|
||||
local vertices = self.vertices
|
||||
|
||||
@@ -559,27 +559,6 @@ for _, c in ipairs({'landscape', 'temp', 'humidity'}) do
|
||||
end
|
||||
--]]
|
||||
-- [[
|
||||
mapGenerator:registerCavern('midgard', 'cavern1', {
|
||||
minY = -48,
|
||||
maxY = 100,
|
||||
smoothDistance = 20,
|
||||
threshold = 0.1,
|
||||
noiseParams ={
|
||||
offset = 0.2,
|
||||
scale = 1,
|
||||
spread = {x = 10, y = 250, z = 30},
|
||||
seed = 5934,
|
||||
octaves = 3,
|
||||
persistence = 0.4,
|
||||
lacunarity = 2.0
|
||||
},
|
||||
},
|
||||
{
|
||||
{x=100, y=0, z=100},
|
||||
{x=100, y=0, z=200},
|
||||
{x=200, y=0, z=200},
|
||||
{x=200, y=0, z=100},
|
||||
})--]]
|
||||
|
||||
-- --- Biomes ---
|
||||
|
||||
|
||||
@@ -284,7 +284,7 @@ end
|
||||
---@type table<string, string[]>
|
||||
PlayerInventoryUI.ActiveNodeForms = {}
|
||||
|
||||
---@param nodePos MapPosition
|
||||
---@param nodePos MapVector
|
||||
function PlayerInventoryUI:addActiveNodeForm(nodePos, playerName)
|
||||
local stringPos = core.pos_to_string(nodePos)
|
||||
local playerNames = self.ActiveNodeForms[stringPos]
|
||||
@@ -295,7 +295,7 @@ function PlayerInventoryUI:addActiveNodeForm(nodePos, playerName)
|
||||
end
|
||||
end
|
||||
|
||||
---@param nodePos MapPosition
|
||||
---@param nodePos MapVector
|
||||
function PlayerInventoryUI:updateNodeForm(nodePos)
|
||||
local stringPos = core.pos_to_string(nodePos)
|
||||
local playerNames = self.ActiveNodeForms[stringPos]
|
||||
@@ -311,7 +311,7 @@ function PlayerInventoryUI:updateNodeForm(nodePos)
|
||||
end
|
||||
end
|
||||
|
||||
---@param nodePos MapPosition
|
||||
---@param nodePos MapVector
|
||||
function PlayerInventoryUI:removeActiveNodeForm(nodePos, playerName)
|
||||
local stringPos = core.pos_to_string(nodePos)
|
||||
local playerNames = self.ActiveNodeForms[stringPos]
|
||||
|
||||
Reference in New Issue
Block a user