mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-25 01:20:04 +00:00
Dedup observers
This commit is contained in:
parent
a0aac721a9
commit
670a27711f
1 changed files with 6 additions and 6 deletions
12
jecs.luau
12
jecs.luau
|
@ -634,7 +634,10 @@ local function archetype_create(world: World, id_types: { i24 }, ty, prev: i53?)
|
||||||
columns[i] = NULL_ARRAY
|
columns[i] = NULL_ARRAY
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
world.archetypeIndex[ty] = archetype
|
world.archetypeIndex[ty] = archetype
|
||||||
|
@ -1536,11 +1539,8 @@ local function query_archetypes(query)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function query_cached(query)
|
local function query_cached(query)
|
||||||
for _, component in query.ids do
|
local observer = create_observer_uni(query.world, query.ids[1], EcsTableCreate)
|
||||||
local observer = create_observer_uni(query.world, component, EcsTableCreate)
|
observer.query = query
|
||||||
observer.query = query
|
|
||||||
end
|
|
||||||
|
|
||||||
return query
|
return query
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue