Skip to content

Commit

Permalink
Optimize remove
Browse files Browse the repository at this point in the history
  • Loading branch information
Ukendio committed Jul 26, 2024
1 parent f9e0aa0 commit 2f0f817
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/init.luau
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,6 @@ end


local function archetype_traverse_remove(world: World, componentId: i53, from: Archetype): Archetype
from = from or world.ROOT_ARCHETYPE
local edge = edge_ensure(from, componentId)

local remove = edge.remove
Expand All @@ -534,6 +533,9 @@ local function world_remove(world: World, entityId: i53, componentId: i53)
local entityIndex = world.entityIndex
local record = entityIndex.sparse[entityId]
local sourceArchetype = record.archetype
if not sourceArchetype then
return
end
local destinationArchetype = archetype_traverse_remove(world, componentId, sourceArchetype)

if sourceArchetype and not (sourceArchetype == destinationArchetype) then
Expand Down

0 comments on commit 2f0f817

Please sign in to comment.