Version out of sync with DOC.md
The DOC.md is mentioning some nice and useful features, that the version I got from NPM (0.0.2) does not seem to have, like
Property 'onEntityAdded' does not exist on type 'Query<Entity>'.ts(2339)
seems not to be defined. Also there are some other changes to the NPM version, like different names of decorators.
When is it coming out?
I just switched from ecsy to ecstra. And I like it so far :-) Need some help? I plan to build my next game with ecstra, if that works out. :-)
Hi! Thanks for the interest in the library. I haven't had much time those last few months to work on it because I am also teaching in addition to my day job. Those features are ready and tested but simply not published yet. I will try to find sometimes to publish a new version :)
Any help to drive this library further is appreciated!
Sure. If I can help, I will :-)
But a thought on the onEntityAdded. Why is that a property on the Query? Seems dangerous, since different systems could set it, and they would override it?
And from an API point of view: Why not make it work the same as .execute(entity =>{})? That would make it read nicer.
Shall I try doing that?
Yeah it's indeed an issue. It should at least be an array of callbacks or something. It's not a callback n the system because you might need to know what query triggered the callback right?
Not quite sure what you mean with the last part.
What I like about ecsy, for example is the way you define query additions and removals. It looks like this:
this.queries.dudesOnTheMap.added(entity => …)
the same way, that execute looks. Internally, the query managers are (or have) event dispatcher, that triggers events for query-relevant items. It also makes for a nicer and more congruent API.
Yes I see what you mean. I actually double checked my code, I wrote it a long back: https://github.com/DavidPeicho/ecstra/blob/7d380fb5b531a59d90a21b452961b8190cb149c8/src/internals/query-manager.ts#L56
So basically it's pretty close to what Ecsy does. What I need is to have an array of listeners instead of overriding the callback, and then we can just rename onEntityAdded to added or anything meaningfull.