This commit is contained in:
Ukendio 2024-05-17 01:05:40 +02:00
parent 5533cd1c64
commit 6c2f47bf70
2 changed files with 8 additions and 3 deletions

View file

@ -436,6 +436,7 @@ function World.delete(world: World, entityId: i53)
local row = record.row
archetypeDelete(world, entityId)
-- TODO: should traverse linked )component records to pairs including entityId
archetypeDelete(world, ECS_PAIR(entityId, WILDCARD))
archetypeDelete(world, ECS_PAIR(WILDCARD, entityId))

View file

@ -276,6 +276,7 @@ TEST("world", function()
local bob = world:entity()
local alice = world:entity()
world:set(bob, Apples, "apples")
world:set(bob, ECS_PAIR(Eats, Apples), "bob eats apples")
world:set(alice, ECS_PAIR(Eats, Oranges), "alice eats oranges")
@ -287,7 +288,10 @@ TEST("world", function()
count += 1
end
world:delete(ECS_PAIR(Eats, Apples))
CHECK(count == 0)
CHECK(world:get(bob, ECS_PAIR(Eats, Apples)) == nil)
end
do CASE "should error when setting invalid pair"