mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-24 17:10:03 +00:00
invoke OnRemove hooks before moving
This commit is contained in:
parent
b3da0745bc
commit
1de93f9185
1 changed files with 2 additions and 1 deletions
|
@ -822,13 +822,14 @@ local function world_remove(world: World, entity: i53, id: i53)
|
|||
local to = archetype_traverse_remove(world, id, from)
|
||||
|
||||
if from and not (from == to) then
|
||||
entity_move(entity_index, entity, record, to)
|
||||
local idr = world.componentIndex[id]
|
||||
local flags = idr.flags
|
||||
local has_on_remove = bit32.band(flags, ECS_ID_HAS_ON_REMOVE) ~= 0
|
||||
if has_on_remove then
|
||||
invoke_hook(world, EcsOnRemove, id, entity)
|
||||
end
|
||||
|
||||
entity_move(entity_index, entity, record, to)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue