mirror of
https://github.com/Ukendio/jecs.git
synced 2025-08-04 11:19:17 +00:00
Compare commits
3 commits
e770b82c9d
...
0f08d3c254
Author | SHA1 | Date | |
---|---|---|---|
|
0f08d3c254 | ||
|
69911093a3 | ||
|
96bed9bd7e |
2 changed files with 16 additions and 19 deletions
31
jecs.luau
31
jecs.luau
|
@ -2191,11 +2191,6 @@ local function world_new()
|
||||||
|
|
||||||
local function inner_entity_index_try_get_any(entity: number): Record?
|
local function inner_entity_index_try_get_any(entity: number): Record?
|
||||||
local r = eindex_sparse_array[ECS_ENTITY_T_LO(entity)]
|
local r = eindex_sparse_array[ECS_ENTITY_T_LO(entity)]
|
||||||
|
|
||||||
if not r or r.dense == 0 then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
return r
|
return r
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -2284,7 +2279,7 @@ local function world_new()
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
local function inner_entity_index_try_get_unsafe(entity: number): Record?
|
local function inner_entity_index_try_get_unsafe(entity: number): Record?
|
||||||
local r = inner_entity_index_try_get_any(entity)
|
local r = eindex_sparse_array[ECS_ENTITY_T_LO(entity)]
|
||||||
if r then
|
if r then
|
||||||
local r_dense = r.dense
|
local r_dense = r.dense
|
||||||
-- if r_dense > entity_index.alive_count then
|
-- if r_dense > entity_index.alive_count then
|
||||||
|
@ -3146,17 +3141,6 @@ return {
|
||||||
pair_second = (ecs_pair_second :: any) :: <P, O>(world: World, pair: Pair<P, O>) -> Id<O>,
|
pair_second = (ecs_pair_second :: any) :: <P, O>(world: World, pair: Pair<P, O>) -> Id<O>,
|
||||||
entity_index_get_alive = entity_index_get_alive,
|
entity_index_get_alive = entity_index_get_alive,
|
||||||
|
|
||||||
-- Inwards facing API for testing
|
|
||||||
ECS_ID = ECS_ENTITY_T_LO,
|
|
||||||
ECS_GENERATION_INC = ECS_GENERATION_INC,
|
|
||||||
ECS_GENERATION = ECS_GENERATION,
|
|
||||||
ECS_ID_IS_WILDCARD = ECS_ID_IS_WILDCARD,
|
|
||||||
ECS_ID_IS_EXCLUSIVE = ECS_ID_IS_EXCLUSIVE,
|
|
||||||
ECS_ID_DELETE = ECS_ID_DELETE,
|
|
||||||
ECS_META_RESET = ECS_META_RESET,
|
|
||||||
ECS_COMBINE = ECS_COMBINE,
|
|
||||||
ECS_ENTITY_MASK = ECS_ENTITY_MASK,
|
|
||||||
|
|
||||||
archetype_append_to_records = archetype_append_to_records,
|
archetype_append_to_records = archetype_append_to_records,
|
||||||
id_record_ensure = id_record_ensure,
|
id_record_ensure = id_record_ensure,
|
||||||
component_record = id_record_get,
|
component_record = id_record_get,
|
||||||
|
@ -3181,6 +3165,8 @@ return {
|
||||||
entity_index_is_alive = entity_index_is_alive,
|
entity_index_is_alive = entity_index_is_alive,
|
||||||
entity_index_new_id = entity_index_new_id,
|
entity_index_new_id = entity_index_new_id,
|
||||||
|
|
||||||
|
Query = Query,
|
||||||
|
|
||||||
query_iter = query_iter,
|
query_iter = query_iter,
|
||||||
query_iter_init = query_iter_init,
|
query_iter_init = query_iter_init,
|
||||||
query_with = query_with,
|
query_with = query_with,
|
||||||
|
@ -3189,4 +3175,15 @@ return {
|
||||||
query_match = query_match,
|
query_match = query_match,
|
||||||
|
|
||||||
find_observers = find_observers,
|
find_observers = find_observers,
|
||||||
|
|
||||||
|
-- Inwards facing API for testing
|
||||||
|
ECS_ID = ECS_ENTITY_T_LO,
|
||||||
|
ECS_GENERATION_INC = ECS_GENERATION_INC,
|
||||||
|
ECS_GENERATION = ECS_GENERATION,
|
||||||
|
ECS_ID_IS_WILDCARD = ECS_ID_IS_WILDCARD,
|
||||||
|
ECS_ID_IS_EXCLUSIVE = ECS_ID_IS_EXCLUSIVE,
|
||||||
|
ECS_ID_DELETE = ECS_ID_DELETE,
|
||||||
|
ECS_META_RESET = ECS_META_RESET,
|
||||||
|
ECS_COMBINE = ECS_COMBINE,
|
||||||
|
ECS_ENTITY_MASK = ECS_ENTITY_MASK,
|
||||||
}
|
}
|
||||||
|
|
|
@ -2220,14 +2220,14 @@ TEST("change tracking", function()
|
||||||
world:set(e2, Foo, 2)
|
world:set(e2, Foo, 2)
|
||||||
|
|
||||||
local i = 0
|
local i = 0
|
||||||
for e, new in q1 :: any do
|
for e, new in q1 do
|
||||||
i += 1
|
i += 1
|
||||||
world:set(e, pair(Previous, Foo), new)
|
world:set(e, pair(Previous, Foo), new)
|
||||||
end
|
end
|
||||||
|
|
||||||
CHECK(i == 2)
|
CHECK(i == 2)
|
||||||
local j = 0
|
local j = 0
|
||||||
for e, new in q1 :: any do
|
for e, new in q1 do
|
||||||
j += 1
|
j += 1
|
||||||
world:set(e, pair(Previous, Foo), new)
|
world:set(e, pair(Previous, Foo), new)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue