Fix my bruh

This commit is contained in:
Van
2025-08-30 14:54:59 +00:00
parent 1067e3ceb8
commit f22a85fc4a
6 changed files with 22 additions and 20 deletions

View File

@@ -33,17 +33,30 @@ end
---@return table ---@return table
-- TODO: возможно стоит создать какой-то абстрактный класс, -- TODO: возможно стоит создать какой-то абстрактный класс,
-- который будет является алеасом на table и будет обозначать наш класс -- который будет является алеасом на table и будет обозначать наш класс
function Mod:getClassInstance() function Mod:getModClassInstance()
local instance = self.Class:new() local instance = self.Class:new()
return instance return instance
end end
--- Inherit from a class provided by the mod --- Inherits a child class from a parent class
---@static
---@param ParentClass table
---@param ChildClass table? ---@param ChildClass table?
---@return table ---@return table
function Mod:getClassExtended(ChildClass) function Mod:getClassExtended(ParentClass, ChildClass)
ChildClass = Api.getClassExtended(self.Class, ChildClass or {}) local ChildClass = setmetatable(ChildClass or {}, { __index = ParentClass })
return ChildClass return ChildClass
end end
--- Inherits a child class from a parent public class provided by the mod.
---@static
---@param ChildClass table?
---@return table
function Mod:getModClassExtended(ChildClass)
local ChildClass = Mod:getClassExtended(self.Class, ChildClass or {})
return ChildClass
end

View File

@@ -30,17 +30,6 @@ local allowedDomains = {
Ui = true Ui = true
} }
--- Inherits a child class from a parent class
---@param ParentClass table
---@param ChildClass table?
---@return table
Api.getClassExtended = function(ParentClass, ChildClass)
local ChildClass = setmetatable(ChildClass or {}, { __index = ParentClass })
return ChildClass
end
--- Adds a mod to the global space under specified domain structure --- Adds a mod to the global space under specified domain structure
---@param mod Mod The mod table containing functionality to expose ---@param mod Mod The mod table containing functionality to expose
---@param location string Dot-separated path within domain structure (e.g. "Items.Log") ---@param location string Dot-separated path within domain structure (e.g. "Items.Log")

View File

@@ -6,7 +6,7 @@ local modInfo = Mod.getInfo()
local Region = modInfo.require("Region") local Region = modInfo.require("Region")
---@class MapGen.Region.Region2D : MapGen.Region ---@class MapGen.Region.Region2D : MapGen.Region
local Region2D = Api.getClassExtended(Region, {}) local Region2D = Mod:getClassExtended(Region, {})
---@param params table ---@param params table
---@return MapGen.Region.Region2D ---@return MapGen.Region.Region2D

View File

@@ -6,7 +6,7 @@ local modInfo = Mod.getInfo()
local Region = modInfo.require("Region") local Region = modInfo.require("Region")
---@class MapGen.Region.Region3D : MapGen.Region ---@class MapGen.Region.Region3D : MapGen.Region
local Region3D = Api.getClassExtended(Region, {}) local Region3D = Mod:getClassExtended(Region, {})
---@param params table ---@param params table
---@return MapGen.Region.Region3D ---@return MapGen.Region.Region3D

View File

@@ -1,5 +1,5 @@
---@class Node : Item ---@class Node : Item
local Node = Core.Item:getClassExtended({ local Node = Core.Item:getModClassExtended({
--TODO: Че тут писать? --TODO: Че тут писать?
}) })