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
25
lib/index.d.ts
vendored
25
lib/index.d.ts
vendored
|
@ -21,26 +21,25 @@ type ArchetypeMap = {
|
||||||
size: number,
|
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: {
|
dense: {
|
||||||
[key: number]: number
|
[key: number]: number
|
||||||
};
|
};
|
||||||
sparse: {
|
sparse: {
|
||||||
[key: number]: Record
|
[key: number]: {
|
||||||
|
archetype: Archetype,
|
||||||
|
row: number,
|
||||||
|
dense: number,
|
||||||
|
componentRecord: ArchetypeMap,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type Record = {
|
|
||||||
archetype: Archetype,
|
|
||||||
row: number,
|
|
||||||
dense: number,
|
|
||||||
componentRecord: ArchetypeMap,
|
|
||||||
}
|
|
||||||
|
|
||||||
type Query<T extends unknown[]> = {
|
|
||||||
without: (...components: Entity[]) => Query<T>;
|
|
||||||
} & IterableFunction<LuaTuple<[Entity, ...T]>>
|
|
||||||
|
|
||||||
// Utility Types
|
// Utility Types
|
||||||
export type Entity<T = unknown> = number & { __nominal_type_dont_use: T }
|
export type Entity<T = unknown> = number & { __nominal_type_dont_use: T }
|
||||||
export type EntityType<T> = T extends Entity<infer A> ? A : never;
|
export type EntityType<T> = T extends Entity<infer A> ? A : never;
|
||||||
|
|
Loading…
Reference in a new issue