@idleflowgames/anotherecs 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/index.js +96 -54
- package/dist/index.js.map +1 -1
- package/dist/spatial-hash.d.ts +12 -2
- package/package.json +13 -11
package/dist/spatial-hash.d.ts
CHANGED
|
@@ -4,6 +4,13 @@ export declare class SpatialHash {
|
|
|
4
4
|
private cells;
|
|
5
5
|
private generation;
|
|
6
6
|
private readonly seen;
|
|
7
|
+
private occMinCX;
|
|
8
|
+
private occMaxCX;
|
|
9
|
+
private occMinCY;
|
|
10
|
+
private occMaxCY;
|
|
11
|
+
private readonly col;
|
|
12
|
+
private frameGen;
|
|
13
|
+
private sweepIn;
|
|
7
14
|
/**
|
|
8
15
|
* @param cellSize grid cell size in world units. Must be > 0.
|
|
9
16
|
* @param maxEntities upper bound on entity ids inserted (sizes the dedup
|
|
@@ -12,13 +19,16 @@ export declare class SpatialHash {
|
|
|
12
19
|
constructor(cellSize?: number, maxEntities?: number);
|
|
13
20
|
private nextGen;
|
|
14
21
|
clear(): void;
|
|
22
|
+
/** `Map.forEach` callback for the periodic sweep, invoked with the hash as
|
|
23
|
+
* `thisArg` so it allocates no per-sweep closure. */
|
|
24
|
+
private pruneStale;
|
|
15
25
|
insert(entity: Entity, x: number, y: number, radius: number): void;
|
|
16
26
|
/** Query all entities within a circle. Deduplicates via generation counter. */
|
|
17
27
|
query(x: number, y: number, radius: number, results: Entity[]): void;
|
|
18
|
-
/** Query + circle-circle narrow phase in one pass.
|
|
28
|
+
/** Query + circle-circle narrow phase in one pass. `getPos` and `getRadius` are
|
|
29
|
+
* called once per candidate and must not mutate the hash. */
|
|
19
30
|
queryRadius(x: number, y: number, radius: number, getPos: (e: Entity) => {
|
|
20
31
|
x: number;
|
|
21
32
|
y: number;
|
|
22
33
|
} | undefined, getRadius: (e: Entity) => number, results: Entity[]): void;
|
|
23
|
-
private hashKey;
|
|
24
34
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idleflowgames/anotherecs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "A small, fast, deterministic, dependency-free Entity Component System for TypeScript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ecs",
|
|
@@ -44,21 +44,15 @@
|
|
|
44
44
|
"access": "public",
|
|
45
45
|
"registry": "https://registry.npmjs.org/"
|
|
46
46
|
},
|
|
47
|
+
"packageManager": "pnpm@11.17.0",
|
|
47
48
|
"engines": {
|
|
48
49
|
"node": ">=24.18.0",
|
|
49
|
-
"pnpm": ">=11.
|
|
50
|
-
},
|
|
51
|
-
"devDependencies": {
|
|
52
|
-
"@biomejs/biome": "2.5.1",
|
|
53
|
-
"pixi.js": "^8.19.0",
|
|
54
|
-
"playwright": "^1.61.1",
|
|
55
|
-
"typescript": "^6.0.3",
|
|
56
|
-
"vite": "^8.1.0",
|
|
57
|
-
"vitest": "^4.1.9"
|
|
50
|
+
"pnpm": ">=11.17.0"
|
|
58
51
|
},
|
|
59
52
|
"scripts": {
|
|
60
53
|
"build": "vite build && tsc -p tsconfig.build.json",
|
|
61
54
|
"pack:check": "pnpm build && pnpm pack --dry-run",
|
|
55
|
+
"prepublishOnly": "pnpm verify:release",
|
|
62
56
|
"typecheck": "tsc --noEmit",
|
|
63
57
|
"test": "vitest run --dir test",
|
|
64
58
|
"test:package": "vitest run --dir test",
|
|
@@ -73,5 +67,13 @@
|
|
|
73
67
|
"check:package": "biome check src test bench package.json tsconfig.json tsconfig.build.json vite.config.ts README.md CHANGELOG.md",
|
|
74
68
|
"verify": "pnpm check && pnpm typecheck && pnpm test && pnpm pack:check",
|
|
75
69
|
"verify:release": "pnpm check:package && pnpm typecheck && pnpm test:package && pnpm pack:check"
|
|
70
|
+
},
|
|
71
|
+
"devDependencies": {
|
|
72
|
+
"@biomejs/biome": "2.5.1",
|
|
73
|
+
"pixi.js": "^8.19.0",
|
|
74
|
+
"playwright": "^1.61.1",
|
|
75
|
+
"typescript": "^7.0.2",
|
|
76
|
+
"vite": "^8.1.0",
|
|
77
|
+
"vitest": "^4.1.9"
|
|
76
78
|
}
|
|
77
|
-
}
|
|
79
|
+
}
|