NodeFactory: add base logic

This commit is contained in:
Van
2025-09-15 18:10:22 +00:00
parent 5b0e3f7b20
commit cf1cc57634
2 changed files with 25 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
---@class NodeFactory
local NodeFactory = {}
---@param defaultNodeDef Node.NodeDefinition Parameters that all nodes registered with this factory must have.
---@param nodeDefs Node.NodeDefinition[] List of nodes with parameters unique to them.
---@return NodeFactory
function NodeFactory:new(defaultNodeDef, nodeDefs)
---@type NodeFactory
local instance = setmetatable({}, {__index = self})
for _, nodeDef in ipairs(nodeDefs) do
Core.Node:getModClassInstance(table.merge(nodeDef, defaultNodeDef))
end
return instance
end
return NodeFactory