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

Entity listeners are not called when adding a component inside a listener #184

Closed
chartinger opened this issue Sep 21, 2015 · 1 comment · Fixed by #185
Closed

Entity listeners are not called when adding a component inside a listener #184

chartinger opened this issue Sep 21, 2015 · 1 comment · Fixed by #185
Labels

Comments

@chartinger
Copy link
Contributor

Scenario:

Given i want to decouple logic and render components/systems, i may end up with something like this:

A "Star Render System" listens if an entity with a "StarComponent" was added to the engine. If so, it adds a "DrawableComponent" with the render details to this entity.
The expectation would be that the component is added and the listeners on entities with "DrawableComponent" are called (and therefore all getEntitiesFor arrays will be updated).

Currently, the component is added as expected (e.g. can be accessed via entity.getComponent) but no listeners are called.

@dsaltares dsaltares added the bug label Sep 22, 2015
@dsaltares
Copy link
Member

I think this is similar to #161.

However, you may want to have some sort of EntityFactory that can add entities with all its components, such as "star". You won't need to add components via listeners that way.

That is a potential workaround, will try to get around to fix this issue as soon as I can. It will probably require making some slight API changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants