From 9389b02cdaf237b6d6d3f3162d90914fa827f2a3 Mon Sep 17 00:00:00 2001 From: Vanic Date: Sat, 23 May 2026 21:20:05 +0300 Subject: [PATCH] Fix annotation `MapPosition` -> `MapVector` --- .../src/CraftSystem/ImmersiveCraft.lua | 8 +++---- .../src/CraftSystem/ImmersiveCraftCounter.lua | 4 ++-- .../ImmersiveCraftNode/tappingNode.lua | 2 +- .../ImmersiveCraftStage/TappingStage.lua | 6 +++--- mods/CORE/Formspec/src/Formspec.lua | 2 +- .../src/ImmersiveWorkStation.lua | 4 ++-- mods/CORE/MapGen/src/MapGen.lua | 16 +++++++------- mods/CORE/MapGen/src/MapGen/FakePeak.lua | 2 +- mods/CORE/MapGen/src/MapGen/Peak.lua | 2 +- mods/CORE/MapGen/src/MapGen/Region.lua | 6 +++--- .../mapGenerator/src/mapGenerator.lua | 21 ------------------- .../src/PlayerInventoryUI.lua | 6 +++--- 12 files changed, 29 insertions(+), 50 deletions(-) diff --git a/mods/CORE/CraftSystem/src/CraftSystem/ImmersiveCraft.lua b/mods/CORE/CraftSystem/src/CraftSystem/ImmersiveCraft.lua index 3723399..82ff15a 100644 --- a/mods/CORE/CraftSystem/src/CraftSystem/ImmersiveCraft.lua +++ b/mods/CORE/CraftSystem/src/CraftSystem/ImmersiveCraft.lua @@ -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) diff --git a/mods/CORE/CraftSystem/src/CraftSystem/ImmersiveCraftCounter.lua b/mods/CORE/CraftSystem/src/CraftSystem/ImmersiveCraftCounter.lua index 40f49ec..21106fd 100644 --- a/mods/CORE/CraftSystem/src/CraftSystem/ImmersiveCraftCounter.lua +++ b/mods/CORE/CraftSystem/src/CraftSystem/ImmersiveCraftCounter.lua @@ -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] diff --git a/mods/CORE/CraftSystem/src/CraftSystem/ImmersiveCraftNode/tappingNode.lua b/mods/CORE/CraftSystem/src/CraftSystem/ImmersiveCraftNode/tappingNode.lua index 0566878..f96ddd9 100644 --- a/mods/CORE/CraftSystem/src/CraftSystem/ImmersiveCraftNode/tappingNode.lua +++ b/mods/CORE/CraftSystem/src/CraftSystem/ImmersiveCraftNode/tappingNode.lua @@ -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({ diff --git a/mods/CORE/CraftSystem/src/CraftSystem/ImmersiveCraftStage/TappingStage.lua b/mods/CORE/CraftSystem/src/CraftSystem/ImmersiveCraftStage/TappingStage.lua index 5374864..1c0ebff 100644 --- a/mods/CORE/CraftSystem/src/CraftSystem/ImmersiveCraftStage/TappingStage.lua +++ b/mods/CORE/CraftSystem/src/CraftSystem/ImmersiveCraftStage/TappingStage.lua @@ -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, {}) diff --git a/mods/CORE/Formspec/src/Formspec.lua b/mods/CORE/Formspec/src/Formspec.lua index bdd1e82..12c7287 100644 --- a/mods/CORE/Formspec/src/Formspec.lua +++ b/mods/CORE/Formspec/src/Formspec.lua @@ -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 diff --git a/mods/CORE/ImmersiveWorkStation/src/ImmersiveWorkStation.lua b/mods/CORE/ImmersiveWorkStation/src/ImmersiveWorkStation.lua index 7962a52..bbe1cbe 100644 --- a/mods/CORE/ImmersiveWorkStation/src/ImmersiveWorkStation.lua +++ b/mods/CORE/ImmersiveWorkStation/src/ImmersiveWorkStation.lua @@ -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) diff --git a/mods/CORE/MapGen/src/MapGen.lua b/mods/CORE/MapGen/src/MapGen.lua index 2c3adb0..1ee8c52 100644 --- a/mods/CORE/MapGen/src/MapGen.lua +++ b/mods/CORE/MapGen/src/MapGen.lua @@ -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 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) diff --git a/mods/CORE/MapGen/src/MapGen/FakePeak.lua b/mods/CORE/MapGen/src/MapGen/FakePeak.lua index 59e9821..e44a459 100644 --- a/mods/CORE/MapGen/src/MapGen/FakePeak.lua +++ b/mods/CORE/MapGen/src/MapGen/FakePeak.lua @@ -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'}) diff --git a/mods/CORE/MapGen/src/MapGen/Peak.lua b/mods/CORE/MapGen/src/MapGen/Peak.lua index 0f632b0..0332370 100644 --- a/mods/CORE/MapGen/src/MapGen/Peak.lua +++ b/mods/CORE/MapGen/src/MapGen/Peak.lua @@ -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 diff --git a/mods/CORE/MapGen/src/MapGen/Region.lua b/mods/CORE/MapGen/src/MapGen/Region.lua index fd9063b..936de35 100644 --- a/mods/CORE/MapGen/src/MapGen/Region.lua +++ b/mods/CORE/MapGen/src/MapGen/Region.lua @@ -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 diff --git a/mods/ENVIRONMENT/mapGenerator/src/mapGenerator.lua b/mods/ENVIRONMENT/mapGenerator/src/mapGenerator.lua index af642d6..a7b2454 100644 --- a/mods/ENVIRONMENT/mapGenerator/src/mapGenerator.lua +++ b/mods/ENVIRONMENT/mapGenerator/src/mapGenerator.lua @@ -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 --- diff --git a/mods/UI/PlayerInventoryUI/src/PlayerInventoryUI.lua b/mods/UI/PlayerInventoryUI/src/PlayerInventoryUI.lua index 35e14b4..be7cb2c 100644 --- a/mods/UI/PlayerInventoryUI/src/PlayerInventoryUI.lua +++ b/mods/UI/PlayerInventoryUI/src/PlayerInventoryUI.lua @@ -284,7 +284,7 @@ end ---@type table 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]