Fixes QueryChanged for Multiple Worlds
Proposed changes
Has queryChanged create a proxy for each component, allowing each world to get its own unique hookState from useHookState
Related issues
Primarily intended to solve: https://github.com/matter-ecs/matter/issues/155 Has a side-effect of solving: https://github.com/matter-ecs/matter/issues/147 since clearing the proxies will clear the queryChanged storage.
Additional comments
I had an alternate solution initially where I created the local world storage based on the hookState, but I think that resulted in a far messier solution. https://github.com/TheyCallMeRyan/matter/commit/cb39966f0bba9dee1ffa893ad79e2662c916413b Both solutions fix both issues though.
Might be worth noting for issue 147 - the warning in the docs that removing entities with world:clear() won't be reported by queryChanged is still valid; this just makes it so the world can still be used afterwards and perform as expected.