Compare commits

...

2 commits

Author SHA1 Message Date
lolmanurfunny
870823f9fc shorten loop 2025-03-07 23:17:43 -05:00
lolmanurfunny
fa4df24ada undo variable changes 2025-03-07 19:56:40 -05:00

View file

@ -1113,11 +1113,11 @@ do
end
local delete = entity
local archetypes: Archetypes = world.archetypes
local component_index = world.component_index
local idr = component_index[entity]
local idr_t = component_index[ECS_PAIR(EcsWildcard, entity)]
local archetypes: Archetypes = world.archetypes
local tgt = ECS_PAIR(EcsWildcard, delete)
local idr_t = component_index[tgt]
local idr = component_index[delete]
if idr then
local flags = idr.flags
@ -1176,26 +1176,16 @@ do
local on_remove = id_record.hooks.on_remove
local to = archetype_traverse_remove(world, id, idr_t_archetype)
local empty = #to.types == 0
if on_remove then
for i = n, 1, -1 do
local child = children[i]
if on_remove then
on_remove(child)
end
if not empty then
local r = sparse_array[ECS_ENTITY_T_LO(child)]
entity_move(entity_index, child, r, to)
end
end
else
if not empty then -- no on_remove hook set; fast path
for i = n, 1, -1 do
local child = children[i]
local r = sparse_array[ECS_ENTITY_T_LO(child)]
entity_move(entity_index, child, r, to)
end
end
end
end
end
end