mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-28 19:00:03 +00:00
Compare commits
1 commit
495f95d35e
...
870bd1375c
Author | SHA1 | Date | |
---|---|---|---|
|
870bd1375c |
2 changed files with 5 additions and 25 deletions
|
@ -1995,7 +1995,6 @@ local function world_each(world: World, id): () -> ()
|
||||||
archetype = archetypes[archetype_id]
|
archetype = archetypes[archetype_id]
|
||||||
entities = archetype.entities
|
entities = archetype.entities
|
||||||
row = #entities
|
row = #entities
|
||||||
entity = entities[row]
|
|
||||||
end
|
end
|
||||||
row -= 1
|
row -= 1
|
||||||
return entity
|
return entity
|
||||||
|
|
|
@ -900,39 +900,20 @@ end)
|
||||||
|
|
||||||
TEST("world:children", function()
|
TEST("world:children", function()
|
||||||
local world = world_new()
|
local world = world_new()
|
||||||
local C = world:component()
|
|
||||||
local T = world:entity()
|
|
||||||
|
|
||||||
local e1 = world:entity()
|
local e1 = world:entity()
|
||||||
world:set(e1, C, true)
|
|
||||||
|
|
||||||
local e2 = world:entity()
|
local e2 = world:entity()
|
||||||
|
|
||||||
world:add(e2, T)
|
|
||||||
world:add(e2, pair(ChildOf, e1))
|
|
||||||
|
|
||||||
local e3 = world:entity()
|
local e3 = world:entity()
|
||||||
|
|
||||||
|
world:add(e2, pair(ChildOf, e1))
|
||||||
world:add(e3, pair(ChildOf, e1))
|
world:add(e3, pair(ChildOf, e1))
|
||||||
|
|
||||||
local count = 0
|
for entity in world:children(pair(ChildOf, e1)) do
|
||||||
for entity in world:children(e1) do
|
|
||||||
count += 1
|
|
||||||
if entity == e2 or entity == e3 then
|
if entity == e2 or entity == e3 then
|
||||||
CHECK(true)
|
CHECK(true)
|
||||||
continue
|
continue
|
||||||
end
|
end
|
||||||
CHECK(false)
|
CHECK(false)
|
||||||
end
|
end
|
||||||
CHECK(count == 2)
|
|
||||||
|
|
||||||
world:remove(e2, pair(ChildOf, e1))
|
|
||||||
|
|
||||||
count = 0
|
|
||||||
for entity in world:children(e1) do
|
|
||||||
count += 1
|
|
||||||
end
|
|
||||||
|
|
||||||
CHECK(count == 1)
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
TEST("world:clear()", function()
|
TEST("world:clear()", function()
|
||||||
|
|
Loading…
Reference in a new issue