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

Allow systems to check if an entity has a given component #683

Open
RiscadoA opened this issue Oct 7, 2023 · 2 comments
Open

Allow systems to check if an entity has a given component #683

RiscadoA opened this issue Oct 7, 2023 · 2 comments
Labels
A-Core B-ECS S-Needs-Design Demands some time designing an implementation

Comments

@RiscadoA
Copy link
Member

RiscadoA commented Oct 7, 2023

Problem

Right now we need to OptRead and take it boolean value to know if a component is present.
That's disgusting.

Solution

We would add a system argument used to check whether a given entity has a component. Could also support other stuff such as testing whether a component was just added. E.g.:

void mySystem(ComponentChecker checker)
{
    if (checker.has<Position>(myEntity)) /* ... */
}
@RiscadoA RiscadoA added S-Triage Issues whose priority still has to be figured out S-Needs-Design Demands some time designing an implementation A-Core B-ECS and removed S-Triage Issues whose priority still has to be figured out labels Oct 7, 2023
@RiscadoA RiscadoA added this to the 0.1 Jammable Engine milestone Oct 7, 2023
@RiscadoA RiscadoA added S-Triage Issues whose priority still has to be figured out and removed S-Needs-Design Demands some time designing an implementation labels Oct 7, 2023
@RiscadoA RiscadoA removed the S-Triage Issues whose priority still has to be figured out label Oct 15, 2023
@RiscadoA
Copy link
Member Author

RiscadoA commented Nov 5, 2023

This came upon while discussing #389. We need to expose a method somewhere to convert entities from index to full Entity handles. Maybe both of these could be solved in one sweep? Both checking if components exist and getting the generation of an entity from its indices are operations which can safely be executed concurrently.

@RiscadoA
Copy link
Member Author

With the new queries this doesn't seem as important. I will remove this from the current milestone, but keep it here, as we might still find this useful.

@RiscadoA RiscadoA removed this from the 0.2 Coffee Jammable milestone Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Core B-ECS S-Needs-Design Demands some time designing an implementation
Projects
None yet
Development

No branches or pull requests

1 participant