From 440eea9ab354e33d9fad8921d2ab49798e3f42d8 Mon Sep 17 00:00:00 2001 From: Ukendio Date: Sat, 4 May 2024 15:10:29 +0200 Subject: [PATCH] Check only destination archetype first --- lib/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/init.lua b/lib/init.lua index 5aaeeac..d827c46 100644 --- a/lib/init.lua +++ b/lib/init.lua @@ -343,11 +343,11 @@ function World.remove(world: World, entityId: i53, componentId: i53) local record = ensureRecord(world.entityIndex, entityId) local sourceArchetype = record.archetype local destinationArchetype = archetypeTraverseRemove(world, componentId, sourceArchetype) - if not sourceArchetype or not destinationArchetype then + if not destinationArchetype then return end - if not (sourceArchetype == destinationArchetype) then + if sourceArchetype and not (sourceArchetype == destinationArchetype) then moveEntity(world.entityIndex, entityId, record, destinationArchetype) end end