diff --git a/.github/workflows/analysis.yaml b/.github/workflows/analysis.yaml index 18da7bc..9535921 100644 --- a/.github/workflows/analysis.yaml +++ b/.github/workflows/analysis.yaml @@ -12,7 +12,7 @@ jobs: uses: actions/checkout@v4 - name: Install Luau - uses: encodedvenom/install-luau@v2.1 + uses: encodedvenom/install-luau@v4.3 - name: Analyze run: | diff --git a/docs/learn/concepts/addons.md b/docs/learn/concepts/addons.md index 8207f70..4a667fc 100644 --- a/docs/learn/concepts/addons.md +++ b/docs/learn/concepts/addons.md @@ -21,3 +21,8 @@ An ergonomic, runtime agnostic scheduler for Jecs ## [jam](https://github.com/revvy02/Jam) Provides hooks and a scheduler that implements jabby and a topographical runtime + +## [planck](https://github.com/YetAnotherClown/planck) + +An agnostic scheduler inspired by Bevy and Flecs, with core features including phases, pipelines, run conditions, and startup systems. +Planck also provides plugins for Jabby, Matter Hooks, and more. \ No newline at end of file diff --git a/docs/learn/concepts/relationships.md b/docs/learn/concepts/relationships.md index 10faf2d..f9aff16 100644 --- a/docs/learn/concepts/relationships.md +++ b/docs/learn/concepts/relationships.md @@ -47,22 +47,10 @@ Get parent for entity world:parent(bob) ``` ```typescript [typescript] -world.parent(bob, pair(Eats, jecs.Wildcard) +world.parent(bob) ``` ::: -Find first target of a relationship for entity - -:::code-group -```luau [luau] -world:target(bob, Eats) -``` -```typescript [typescript] -world.target(bob, Eats) -``` -::: - - Find first target of a relationship for entity :::code-group diff --git a/jecs.d.ts b/jecs.d.ts index 136dcb9..c5288de 100644 --- a/jecs.d.ts +++ b/jecs.d.ts @@ -40,6 +40,23 @@ type FlattenTuple = T extends [infer U] ? U : LuaTuple; type Nullable = { [K in keyof T]: T[K] | undefined }; type InferComponents = { [K in keyof A]: InferComponent }; +type ArchetypeId = number +type Column = unknown[]; + +type ArchetypeRecord = { + count: number; + column: number; +} + +export type Archetype = { + id: number; + types: number[]; + type: string; + entities: number[]; + columns: Column[]; + records: ArchetypeRecord[]; +} + type Iter = IterableFunction>; export type CachedQuery = { @@ -47,6 +64,12 @@ export type CachedQuery = { * Returns an iterator that produces a tuple of [Entity, ...queriedComponents]. */ iter(): Iter; + + /** + * Returns the matched archetypes of the query + * @returns An array of archetypes of the query + */ + archetypes(): Archetype[]; } & Iter; export type Query = { @@ -75,6 +98,12 @@ export type Query = { * @returns A new Query with the exclusion applied. */ without(...components: Id[]): Query; + + /** + * Returns the matched archetypes of the query + * @returns An array of archetypes of the query + */ + archetypes(): Archetype[]; } & Iter; export class World { diff --git a/jecs.luau b/jecs.luau index 6ad5fb0..8874c50 100644 --- a/jecs.luau +++ b/jecs.luau @@ -2188,7 +2188,7 @@ function World.new() return self end -export type Entity = number & { __T: T } +export type Entity = {__T: T} export type Id = | Entity