mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-24 17:10:03 +00:00
Set compatibleAchetype after without
This commit is contained in:
parent
f79e757eea
commit
d11fa2f4a3
3 changed files with 24 additions and 8 deletions
11
lib/init.lua
11
lib/init.lua
|
@ -408,10 +408,7 @@ function World.query(world: World, ...: i53): any
|
|||
|
||||
function preparedQuery:without(...)
|
||||
local components = { ... }
|
||||
for i, component in components do
|
||||
components[i] = component
|
||||
end
|
||||
for i = #compatibleArchetypes, 1, - 1 do
|
||||
for i = #compatibleArchetypes, 1, -1 do
|
||||
local archetype = compatibleArchetypes[i].archetype
|
||||
local shouldRemove = false
|
||||
for _, componentId in components do
|
||||
|
@ -424,6 +421,12 @@ function World.query(world: World, ...: i53): any
|
|||
table.remove(compatibleArchetypes, i)
|
||||
end
|
||||
end
|
||||
|
||||
lastArchetype, compatibleArchetype = next(compatibleArchetypes)
|
||||
if not lastArchetype then
|
||||
return noop()
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
|
|
@ -117,7 +117,23 @@ return function()
|
|||
added += 1
|
||||
end
|
||||
expect(added).to.equal(hm)
|
||||
print(added, hm)
|
||||
end)
|
||||
|
||||
it("should skip iteration", function()
|
||||
local Position, Velocity = world:entity(), world:entity()
|
||||
print(Position, Velocity)
|
||||
local e = world:entity()
|
||||
print(e)
|
||||
world:set(e, Position, Vector3.zero)
|
||||
world:set(e, Velocity, Vector3.one)
|
||||
local added = 0
|
||||
for i in world:query(Position):without(Velocity) do
|
||||
print(i)
|
||||
added += 1
|
||||
end
|
||||
expect(added).to.equal(0)
|
||||
|
||||
|
||||
end)
|
||||
|
||||
it("track changes", function()
|
||||
|
|
|
@ -23,9 +23,6 @@
|
|||
"benches": {
|
||||
"$path": "benches"
|
||||
},
|
||||
"rewrite": {
|
||||
"$path": "matterRewrite"
|
||||
},
|
||||
"mirror": {
|
||||
"$path": "mirror"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue