mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-25 09:30:03 +00:00
Check only destination archetype first
This commit is contained in:
parent
6fe05d29c1
commit
440eea9ab3
1 changed files with 2 additions and 2 deletions
|
@ -343,11 +343,11 @@ function World.remove(world: World, entityId: i53, componentId: i53)
|
||||||
local record = ensureRecord(world.entityIndex, entityId)
|
local record = ensureRecord(world.entityIndex, entityId)
|
||||||
local sourceArchetype = record.archetype
|
local sourceArchetype = record.archetype
|
||||||
local destinationArchetype = archetypeTraverseRemove(world, componentId, sourceArchetype)
|
local destinationArchetype = archetypeTraverseRemove(world, componentId, sourceArchetype)
|
||||||
if not sourceArchetype or not destinationArchetype then
|
if not destinationArchetype then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if not (sourceArchetype == destinationArchetype) then
|
if sourceArchetype and not (sourceArchetype == destinationArchetype) then
|
||||||
moveEntity(world.entityIndex, entityId, record, destinationArchetype)
|
moveEntity(world.entityIndex, entityId, record, destinationArchetype)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue