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

System constructor is not checking if component exist #3

Open
sedyh opened this issue May 13, 2022 · 0 comments
Open

System constructor is not checking if component exist #3

sedyh opened this issue May 13, 2022 · 0 comments
Labels
bug Something isn't working needs-investigation

Comments

@sedyh
Copy link
Owner

sedyh commented May 13, 2022

Problem

When adding systems, there is no check for unregistered components.

func makeSystem(world *world, s interface{}) *system {
    ...
    componentId, found := world.componentIds[componentType.Elem()]
    if !found {
        continue // system pointer field is not component bound
    }
    ...
}

Solution

Setting a panic at this point will solve the problem, but may affect the ability to correctly compare entities by mask, as well as the ability to get optional components.
It's also worth noting that fixing issue #1 might fix this issue as well, as before initialization of systems, there will be an initialization of entities in which this check is already present.

@sedyh sedyh added needs-investigation bug Something isn't working good first issue Good for newcomers and removed good first issue Good for newcomers labels May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-investigation
Projects
None yet
Development

No branches or pull requests

1 participant