Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iterating over entities with disabled components #364

Open
jtferson opened this issue Mar 29, 2021 · 0 comments
Open

Iterating over entities with disabled components #364

jtferson opened this issue Mar 29, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@jtferson
Copy link
Sponsor Contributor

Describe the problem you are trying to solve.
Currently entities with disabled components are prevented from being matched. It might be useful in some scenarios to iterate over entities with such components.

Describe the solution you'd like
The query signature can accept DISABLED modifier (or something like this) and allow to match with entities that have disabled components:

auto entity = ecs.entity()
    .add<Movable>()
    .add<Velocity>();
entity.disable<Velocity>();

ecs.system<>().signature("DISABLED | Velocity, Movable").iter([](flecs::iter& it)
{
    for(auto i : it)
    {
        //here could be some conditional logic, for example
        if(canEnable)
        {
            it.entity(i).enable<Velocity>();
        }
    } 
});
@jtferson jtferson added the enhancement New feature or request label Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant