Sync to released Jecs 0.5.5-nightly.20250413T001101Z (#32)
Reviewed-on: #32
This commit is contained in:
parent
f41558cadc
commit
024bb62b3b
10 changed files with 121 additions and 179 deletions
|
@ -466,7 +466,9 @@ local function world_has_one_inline(world: ecs_world_t, entity: i53, id: i53): b
|
|||
return records[id] ~= nil
|
||||
end
|
||||
|
||||
local function world_has(world: ecs_world_t, entity: i53, ...: i53): boolean
|
||||
local function world_has(world: ecs_world_t, entity: i53,
|
||||
a: i53, b: i53?, c: i53?, d: i53?, e: i53?): boolean
|
||||
|
||||
local record = entity_index_try_get_fast(world.entity_index, entity)
|
||||
if not record then
|
||||
return false
|
||||
|
@ -479,13 +481,11 @@ local function world_has(world: ecs_world_t, entity: i53, ...: i53): boolean
|
|||
|
||||
local records = archetype.records
|
||||
|
||||
for i = 1, select("#", ...) do
|
||||
if not records[select(i, ...)] then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
return records[a] ~= nil and
|
||||
(b == nil or records[b] ~= nil) and
|
||||
(c == nil or records[c] ~= nil) and
|
||||
(d == nil or records[d] ~= nil) and
|
||||
(e == nil or error("args exceeded"))
|
||||
end
|
||||
|
||||
local function world_target(world: ecs_world_t, entity: i53, relation: i24, index: number?): i24?
|
||||
|
@ -2420,7 +2420,10 @@ export type World = {
|
|||
& <A, B, C, D>(self: World, id: Entity, Id<A>, Id<B>, Id<C>, Id<D>) -> (A?, B?, C?, D?),
|
||||
|
||||
--- Returns whether the entity has the ID.
|
||||
has: (self: World, entity: Entity, ...Id) -> boolean,
|
||||
has: (<A>(World, Entity, A) -> boolean)
|
||||
& (<A, B>(World, Entity, A, B) -> boolean)
|
||||
& (<A, B, C>(World, Entity, A, B, C) -> boolean)
|
||||
& <A, B, C, D>(World, Entity, A, B, C, D) -> boolean,
|
||||
|
||||
--- Get parent (target of ChildOf relationship) for entity. If there is no ChildOf relationship pair, it will return nil.
|
||||
parent:(self: World, entity: Entity) -> Entity,
|
||||
|
@ -2487,9 +2490,9 @@ return {
|
|||
|
||||
ECS_ID_DELETE = ECS_ID_DELETE,
|
||||
|
||||
IS_PAIR = ECS_IS_PAIR,
|
||||
pair_first = ecs_pair_first,
|
||||
pair_second = ecs_pair_second,
|
||||
IS_PAIR = (ECS_IS_PAIR :: any) :: <P, O>(pair: Pair<P, O>) -> boolean,
|
||||
pair_first = (ecs_pair_first :: any) :: <P, O>(world: World, pair: Pair<P, O>) -> Id<P>,
|
||||
pair_second = (ecs_pair_second :: any) :: <P, O>(world: World, pair: Pair<P, O>) -> Id<O>,
|
||||
entity_index_get_alive = entity_index_get_alive,
|
||||
|
||||
archetype_append_to_records = archetype_append_to_records,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue