When world_delete is called, the given entity must have an archetype for archetype_delete to be called, which handles cleanup policies that might be related to the entity. Therefore, when an entity is empty, the cleanup policies are not respected.
local parent = world:entity()
local tag = world:entity()
local child = world:entity()
world:add(child, jecs.pair(jecs.ChildOf, parent))
world:delete(parent)
print(world:contains(child)) -- => true
local entity = world:entity()
world:add(entity, tag)
world:delete(tag)
print(world:has(entity, tag)) -- => true
Adding the following to the top will result in the expected behavior where both statements print false:
When
world_delete
is called, the given entity must have an archetype forarchetype_delete
to be called, which handles cleanup policies that might be related to the entity. Therefore, when an entity is empty, the cleanup policies are not respected.Adding the following to the top will result in the expected behavior where both statements print false: