add fix for #207

This commit is contained in:
lolmanurfunny 2025-03-11 15:39:04 -04:00
parent 870823f9fc
commit e2ea71a7fe

View file

@ -1154,6 +1154,8 @@ do
for archetype_id in idr_t.columns do
local idr_t_archetype = archetypes[archetype_id]
local idr_t_types = idr_t_archetype.types
local to = idr_t_archetype
local children = table.clone(idr_t_archetype.entities)
local n = #children
@ -1163,7 +1165,10 @@ do
end
local object = ecs_pair_second(world, id)
if object == delete then
if object ~= delete then
continue
end
local id_record = component_index[id]
local flags = id_record.flags
local flags_delete_mask: number = bit32.band(flags, ECS_ID_DELETE)
@ -1174,7 +1179,7 @@ do
break
else
local on_remove = id_record.hooks.on_remove
local to = archetype_traverse_remove(world, id, idr_t_archetype)
to = archetype_traverse_remove(world, id, to)
local empty = #to.types == 0
for i = n, 1, -1 do
local child = children[i]
@ -1188,7 +1193,6 @@ do
end
end
end
end
archetype_destroy(world, idr_t_archetype)
end