mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-25 01:20:04 +00:00
Compare commits
2 commits
3a560393f1
...
870823f9fc
Author | SHA1 | Date | |
---|---|---|---|
|
870823f9fc | ||
|
fa4df24ada |
1 changed files with 10 additions and 20 deletions
30
jecs.luau
30
jecs.luau
|
@ -1113,11 +1113,11 @@ do
|
||||||
end
|
end
|
||||||
|
|
||||||
local delete = entity
|
local delete = entity
|
||||||
local archetypes: Archetypes = world.archetypes
|
|
||||||
local component_index = world.component_index
|
local component_index = world.component_index
|
||||||
|
local archetypes: Archetypes = world.archetypes
|
||||||
local idr = component_index[entity]
|
local tgt = ECS_PAIR(EcsWildcard, delete)
|
||||||
local idr_t = component_index[ECS_PAIR(EcsWildcard, entity)]
|
local idr_t = component_index[tgt]
|
||||||
|
local idr = component_index[delete]
|
||||||
|
|
||||||
if idr then
|
if idr then
|
||||||
local flags = idr.flags
|
local flags = idr.flags
|
||||||
|
@ -1176,24 +1176,14 @@ do
|
||||||
local on_remove = id_record.hooks.on_remove
|
local on_remove = id_record.hooks.on_remove
|
||||||
local to = archetype_traverse_remove(world, id, idr_t_archetype)
|
local to = archetype_traverse_remove(world, id, idr_t_archetype)
|
||||||
local empty = #to.types == 0
|
local empty = #to.types == 0
|
||||||
|
for i = n, 1, -1 do
|
||||||
if on_remove then
|
local child = children[i]
|
||||||
for i = n, 1, -1 do
|
if on_remove then
|
||||||
local child = children[i]
|
|
||||||
on_remove(child)
|
on_remove(child)
|
||||||
|
|
||||||
if not empty then
|
|
||||||
local r = sparse_array[ECS_ENTITY_T_LO(child)]
|
|
||||||
entity_move(entity_index, child, r, to)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
else
|
if not empty then
|
||||||
if not empty then -- no on_remove hook set; fast path
|
local r = sparse_array[ECS_ENTITY_T_LO(child)]
|
||||||
for i = n, 1, -1 do
|
entity_move(entity_index, child, r, to)
|
||||||
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
|
end
|
||||||
|
|
Loading…
Reference in a new issue