mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-25 01:20:04 +00:00
Return empty query when Without removes all archetypes
This commit is contained in:
parent
e486c11dc2
commit
570b72c778
1 changed files with 8 additions and 1 deletions
|
@ -455,7 +455,10 @@ local function add(world: World, entityId: i53, componentId: i53)
|
||||||
local record = entityIndex.sparse[entityId]
|
local record = entityIndex.sparse[entityId]
|
||||||
local from = record.archetype
|
local from = record.archetype
|
||||||
local to = archetypeTraverseAdd(world, componentId, from)
|
local to = archetypeTraverseAdd(world, componentId, from)
|
||||||
if from and not (from == world.ROOT_ARCHETYPE) then
|
if from == to then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if from then
|
||||||
moveEntity(entityIndex, entityId, record, to)
|
moveEntity(entityIndex, entityId, record, to)
|
||||||
else
|
else
|
||||||
if #to.types > 0 then
|
if #to.types > 0 then
|
||||||
|
@ -793,6 +796,10 @@ local function preparedQuery(compatibleArchetypes: { Archetype },
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if #compatibleArchetypes == 0 then
|
||||||
|
return EmptyQuery
|
||||||
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue