mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-25 01:20:04 +00:00
Add todo
This commit is contained in:
parent
5533cd1c64
commit
6c2f47bf70
2 changed files with 8 additions and 3 deletions
|
@ -420,7 +420,7 @@ local function archetypeDelete(world: World, id: i53)
|
||||||
world:remove(entity, id)
|
world:remove(entity, id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
componentIndex[id] = nil
|
componentIndex[id] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -436,9 +436,10 @@ function World.delete(world: World, entityId: i53)
|
||||||
local row = record.row
|
local row = record.row
|
||||||
|
|
||||||
archetypeDelete(world, entityId)
|
archetypeDelete(world, entityId)
|
||||||
|
-- TODO: should traverse linked )component records to pairs including entityId
|
||||||
archetypeDelete(world, ECS_PAIR(entityId, WILDCARD))
|
archetypeDelete(world, ECS_PAIR(entityId, WILDCARD))
|
||||||
archetypeDelete(world, ECS_PAIR(WILDCARD, entityId))
|
archetypeDelete(world, ECS_PAIR(WILDCARD, entityId))
|
||||||
|
|
||||||
if archetype then
|
if archetype then
|
||||||
local entities = archetype.entities
|
local entities = archetype.entities
|
||||||
local last = #entities
|
local last = #entities
|
||||||
|
|
|
@ -276,6 +276,7 @@ TEST("world", function()
|
||||||
local bob = world:entity()
|
local bob = world:entity()
|
||||||
local alice = world:entity()
|
local alice = world:entity()
|
||||||
|
|
||||||
|
world:set(bob, Apples, "apples")
|
||||||
world:set(bob, ECS_PAIR(Eats, Apples), "bob eats apples")
|
world:set(bob, ECS_PAIR(Eats, Apples), "bob eats apples")
|
||||||
world:set(alice, ECS_PAIR(Eats, Oranges), "alice eats oranges")
|
world:set(alice, ECS_PAIR(Eats, Oranges), "alice eats oranges")
|
||||||
|
|
||||||
|
@ -283,11 +284,14 @@ TEST("world", function()
|
||||||
local Wildcard = jecs.Wildcard
|
local Wildcard = jecs.Wildcard
|
||||||
|
|
||||||
local count = 0
|
local count = 0
|
||||||
for _, data in world:query(ECS_PAIR(Wildcard, Apples)) do
|
for _, data in world:query(ECS_PAIR(Wildcard, Apples)) do
|
||||||
count += 1
|
count += 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
world:delete(ECS_PAIR(Eats, Apples))
|
||||||
|
|
||||||
CHECK(count == 0)
|
CHECK(count == 0)
|
||||||
|
CHECK(world:get(bob, ECS_PAIR(Eats, Apples)) == nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
do CASE "should error when setting invalid pair"
|
do CASE "should error when setting invalid pair"
|
||||||
|
|
Loading…
Reference in a new issue