Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/ecs-lib/lib/libecs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface ClassHandle {
[Symbol.dispose](): void;
clone(): this;
}
export interface container extends ClassHandle {
export interface container extends ClassHandle, Iterable<any | undefined> {
size(): number;
get(_0: number): any | undefined | undefined;
push_back(_0?: any): void;
Expand Down
2 changes: 1 addition & 1 deletion packages/ecs-lib/src/editor-manifest.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type ECSStringElement = {
/**
* Values allowed for the element
*/
enum?: string[];
enum?: string[] | Record<string, any>;
} & ECSElementDefaults<"string", string>;

/**
Expand Down
1 change: 1 addition & 0 deletions packages/ecs-lib/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { AbstractECSLibrary } from "./ecs-library.abstract";
// @ts-ignore
Comment thread
Exeloo marked this conversation as resolved.
Outdated
export type { Component, System, Registry, SparseArray, Entity } from "../lib/libecs";
export type * from "./editor-manifest.type";
10 changes: 3 additions & 7 deletions packages/ecs-lib/test/Registry.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ class Position {
) {}
}

const getRunSystemsParams = (registry: any) => ({
libs: { getComponentSystem: () => ({ registry }) },
});

Comment thread
Exeloo marked this conversation as resolved.
describe("Registry", () => {
describe("entity management", () => {
it("should spawn an entity with id 0", async () => {
Expand Down Expand Up @@ -116,7 +112,7 @@ describe("Registry", () => {

for (let i = 0; i <= 15; i++) {
expect(counter).toBe(i);
r.runSystems(getRunSystemsParams(r));
r.runSystems({});
}
expect(counter).toBe(16);
});
Expand Down Expand Up @@ -148,12 +144,12 @@ describe("Registry", () => {

expect(r.getComponents(Position).size()).toEqual(3);

r.runSystems(getRunSystemsParams(r));
r.runSystems({});
expect(r.getComponents(Position).get(e.getId())).toStrictEqual(new Position(-1, -1));
expect(r.getComponents(Position).get(e2.getId())).toStrictEqual(new Position(1, 1));
expect(r.getComponents(Position).get(e3.getId())).toStrictEqual(new Position(0, 0));

r.runSystems(getRunSystemsParams(r));
r.runSystems({});
expect(r.getComponents(Position).get(e.getId())).toStrictEqual(new Position(0, 0));
expect(r.getComponents(Position).get(e2.getId())).toStrictEqual(new Position(0, 0));
expect(r.getComponents(Position).get(e3.getId())).toStrictEqual(new Position(0, 0));
Expand Down
4 changes: 4 additions & 0 deletions packages/ecs-server/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// @ts-ignore
Comment thread
Tchips46 marked this conversation as resolved.
Outdated
import ECSModule from "../lib/libecs";
// @ts-ignore
import "../lib/libecs.wasm";

export type {
Expand All @@ -12,3 +14,5 @@ export type {
} from "@nanoforge-dev/ecs-lib";

export { ECSServerLibrary } from "./ecs-server-library";

export const Module = ECSModule;
Loading