mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-25 09:30:03 +00:00
Some changes to how EntityIndex is handled
This commit is contained in:
parent
1be305072a
commit
eeb48035eb
1 changed files with 12 additions and 13 deletions
19
lib/index.d.ts
vendored
19
lib/index.d.ts
vendored
|
@ -21,26 +21,25 @@ type ArchetypeMap = {
|
|||
size: number,
|
||||
}
|
||||
|
||||
type EntityIndex = {
|
||||
type Query<T extends unknown[]> = {
|
||||
without: (...components: Entity[]) => Query<T>;
|
||||
} & IterableFunction<LuaTuple<[Entity, ...T]>>
|
||||
|
||||
// Exported due to functions below requiring this type.
|
||||
export type EntityIndex = {
|
||||
dense: {
|
||||
[key: number]: number
|
||||
};
|
||||
sparse: {
|
||||
[key: number]: Record
|
||||
}
|
||||
}
|
||||
|
||||
type Record = {
|
||||
[key: number]: {
|
||||
archetype: Archetype,
|
||||
row: number,
|
||||
dense: number,
|
||||
componentRecord: ArchetypeMap,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type Query<T extends unknown[]> = {
|
||||
without: (...components: Entity[]) => Query<T>;
|
||||
} & IterableFunction<LuaTuple<[Entity, ...T]>>
|
||||
|
||||
// Utility Types
|
||||
export type Entity<T = unknown> = number & { __nominal_type_dont_use: T }
|
||||
export type EntityType<T> = T extends Entity<infer A> ? A : never;
|
||||
|
|
Loading…
Reference in a new issue