Closed briancw closed 3 years ago
Not queries will correctly identify entities without components the first time they are run, but on subsequent runs will not accurately return components without entities.
import {createWorld, addEntity, addComponent, removeComponent, defineComponent, defineQuery, Not} from 'bitecs' const Foo = defineComponent() const notFooQuery = defineQuery([Not(Foo)]) const fooQuery = defineQuery([Foo]) const world = createWorld() const eid1 = addEntity(world) console.log('Foo:', fooQuery(world)) console.log('Not Foo:', notFooQuery(world)) addComponent(world, Foo, eid1) console.log('Foo:', fooQuery(world)) console.log('Not Foo:', notFooQuery(world)) removeComponent(world, Foo, eid1) console.log('Foo:', fooQuery(world)) console.log('Not Foo:', notFooQuery(world))
The fooQuery accurately returns components with or without the Foo component each time. The notFooQuery returns the same output all three times.
good catch! i know what's wrong. will have a patch out for that later this evening
@briancw 0.3.15 has been published to npm with a fix for this issue 👍
0.3.15
Not queries will correctly identify entities without components the first time they are run, but on subsequent runs will not accurately return components without entities.
The fooQuery accurately returns components with or without the Foo component each time. The notFooQuery returns the same output all three times.