Skip to content

Commit

Permalink
Dedup observers
Browse files Browse the repository at this point in the history
  • Loading branch information
Ukendio committed Dec 24, 2024
1 parent a0aac72 commit 670a277
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions jecs.luau
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,10 @@ local function archetype_create(world: World, id_types: { i24 }, ty, prev: i53?)
columns[i] = NULL_ARRAY
end

emit(world, { id = EcsTableCreate, component = componentId, archetype = archetype})
end

for _, id in id_types do
emit(world, { id = EcsTableCreate, component = id, archetype = archetype})
end

world.archetypeIndex[ty] = archetype
Expand Down Expand Up @@ -1536,11 +1539,8 @@ local function query_archetypes(query)
end

local function query_cached(query)
for _, component in query.ids do
local observer = create_observer_uni(query.world, component, EcsTableCreate)
observer.query = query
end

local observer = create_observer_uni(query.world, query.ids[1], EcsTableCreate)
observer.query = query
return query
end

Expand Down

0 comments on commit 670a277

Please sign in to comment.