diff --git a/src/init.luau b/src/init.luau index 3b6523a..2e9ea47 100644 --- a/src/init.luau +++ b/src/init.luau @@ -455,7 +455,10 @@ local function add(world: World, entityId: i53, componentId: i53) local record = entityIndex.sparse[entityId] local from = record.archetype 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) else if #to.types > 0 then @@ -793,6 +796,10 @@ local function preparedQuery(compatibleArchetypes: { Archetype }, end end + if #compatibleArchetypes == 0 then + return EmptyQuery + end + return self end