Fix my bruh
This commit is contained in:
@@ -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
|
||||||
---@param ChildClass table?
|
---@static
|
||||||
|
---@param ParentClass 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
|
||||||
|
|
||||||
|
|||||||
@@ -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")
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---@class Node : Item
|
---@class Node : Item
|
||||||
local Node = Core.Item:getClassExtended({
|
local Node = Core.Item:getModClassExtended({
|
||||||
--TODO: Че тут писать?
|
--TODO: Че тут писать?
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user