ecspresso
Version:
A minimal Entity-Component-System library for typescript and javascript.
15 lines (14 loc) • 914 B
TypeScript
import type { Entity } from "./types";
/** Minimal lookup surface needed to evaluate `parentHas`. */
export interface MatchHost<ComponentTypes> {
getEntity(entityId: number): Entity<ComponentTypes> | undefined;
getParent(entityId: number): number | null;
}
/**
* Returns true when `entity` matches the static portion of a query shape:
* has every `with` component, no `without` component, and (if `parentHas`)
* a direct parent that has every `parentHas` component. Shared between
* QueryCache (membership maintenance) and ReactiveQueryManager (enter/exit
* dispatch) so both use the same predicate.
*/
export declare function entityMatchesShape<ComponentTypes>(entity: Entity<ComponentTypes>, withC: ReadonlyArray<keyof ComponentTypes>, withoutC: ReadonlyArray<keyof ComponentTypes> | undefined, parentHas: ReadonlyArray<keyof ComponentTypes> | undefined, host: MatchHost<ComponentTypes>): boolean;