evaera / matter

A modern ECS library for Roblox.
https://eryn.io/matter/
MIT License
143 stars 34 forks source link

More flexible dependencies #35

Closed claylittlehorse closed 2 years ago

claylittlehorse commented 2 years ago

When scheduling systems with chains of dependencies, you need to keep a references to the system structs:

local systemBStruct = {
    system = systemB,
    after = { systemA }
}

local systemCStruct = {
    system = systemC,
    after = { systemBStruct }
}

loop:scheduleSystems({
    systemA,
    systemBStruct,
    systemCStruct,
    {
        system = systemD,
        after = { systemCStruct }
    }
})

That's kind of inconvenient (and also isn't documented anywhere, and also wasn't how I would expect this API to work!), so this change makes it such that you can just use the function, instead of the struct:

loop:scheduleSystems({
    systemA,
    {
        system = systemB,
        after = { systemA },
    },
    {
        system = systemC,
        after = { systemB },
    },
    {
        system = systemD,
        after = { systemC },
    },
})
claylittlehorse commented 2 years ago

image