Skip to content

Expand SystemSets #15

Description

@YetAnotherClown

SystemSets, which are simply an array of systems, are currently only able to be added with Scheduler:addSystems(). This method should be expanded to allow nested SystemSets.

The idea is to allow a structure like this, where SystemSets can be used within Modules

systems/
├─ systemSet/
│  ├─ systemA.luau
│  ├─ systemB.luau
│  ├─ systemC.luau
│  ├─ init.luau

systemSet/init.luau

return {
  require("./systemA.luau"),
  require("./systemB.luau"),
  require("./systemC.luau")
}

This would be used in addition to a setup where we do not manually add our systems, but instead do:

local systems = {}

local function addSystems(instance)
    for _, child in instance:GetChildren() do
        if typeof(child) == "ModuleScript" then
            table.insert(systems, require(child))
        elseif typeof(child) == "Folder" then
            addSystems(child)
        end
    end
end

addSystems(systemsFolder)
scheduler:addSystems(systems)

By allowing us to use SystemSets like this, we can allow for users of Planck to implicitly order their systems in a SystemSet to avoid the not guaranteed order of GetChildren()

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions