@antha/entity-2d 0.11.1 → 0.13.0
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/dist/entity.d.ts +9 -1
- package/dist/entity.js +12 -1
- package/dist/load-antha-assets.d.ts +10 -2
- package/package.json +8 -8
package/dist/entity.d.ts
CHANGED
|
@@ -84,7 +84,11 @@ export type EntityCollisionDefinition = PartialWithUndefined<{
|
|
|
84
84
|
/** Other entity classes this entity observes collisions with. */
|
|
85
85
|
collidesWithOtherEntities: ReadonlyArray<Entity2dConstructor>;
|
|
86
86
|
}>;
|
|
87
|
-
/**
|
|
87
|
+
/**
|
|
88
|
+
* A collision system that skips pairs no entity observes before running SAT collision checks.
|
|
89
|
+
*
|
|
90
|
+
* @category Internal
|
|
91
|
+
*/
|
|
88
92
|
export declare class EntityHitboxSystem extends HitboxSystem {
|
|
89
93
|
protected checkedHitboxPairs: WeakMap<Hitbox, WeakSet<Hitbox>> | undefined;
|
|
90
94
|
checkAll(...[callback, response,]: Parameters<HitboxSystem['checkAll']>): any;
|
|
@@ -149,6 +153,8 @@ export declare class EntityStore2d<State extends AnyObject = any> {
|
|
|
149
153
|
deserializeEntity(entityKey: string, serializedParams: string | undefined): Promise<BaseEntity2d>;
|
|
150
154
|
/** Create a new instance of the given entity class and add it to this entity store. */
|
|
151
155
|
addEntity<const NewEntityConstructor extends Entity2dConstructor>(entityClass: NewEntityConstructor, ...params: AddEntity2dParams<NoInfer<NewEntityConstructor>>): Promise<InstanceType<NewEntityConstructor>>;
|
|
156
|
+
/** Immediately destroys every current entity while leaving the entity store usable. */
|
|
157
|
+
destroyAllEntities(): void;
|
|
152
158
|
/** Destroys the entity store and all entities contained inside it. */
|
|
153
159
|
destroy(): void;
|
|
154
160
|
}
|
|
@@ -196,6 +202,8 @@ export type MatchingKeys<Key extends PropertyKey, Params extends Record<string,
|
|
|
196
202
|
* - `true`: indicates that the property is mapped directly from params to that view or hitbox object.
|
|
197
203
|
* - Omitted: the property is not mapped at all.
|
|
198
204
|
* - A string: specifies the params key that this view or hitbox property is mapped to.
|
|
205
|
+
*
|
|
206
|
+
* @category Internal
|
|
199
207
|
*/
|
|
200
208
|
export type ParamsMap<Params extends Record<string, any> | undefined = AnyObject> = IsEqual<Params, undefined> extends true ? undefined : PartialWithUndefined<{
|
|
201
209
|
view: Partial<{
|
package/dist/entity.js
CHANGED
|
@@ -59,7 +59,11 @@ function markHitboxPairAsChecked({ checkedHitboxPairs, firstHitbox, secondHitbox
|
|
|
59
59
|
checkedHitboxPairs.set(firstHitbox, new WeakSet([secondHitbox]));
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* A collision system that skips pairs no entity observes before running SAT collision checks.
|
|
64
|
+
*
|
|
65
|
+
* @category Internal
|
|
66
|
+
*/
|
|
63
67
|
export class EntityHitboxSystem extends HitboxSystem {
|
|
64
68
|
checkedHitboxPairs;
|
|
65
69
|
checkAll(...[callback, response,]) {
|
|
@@ -278,6 +282,13 @@ export class EntityStore2d {
|
|
|
278
282
|
this.entityInstanceMap.add(child);
|
|
279
283
|
return child;
|
|
280
284
|
}
|
|
285
|
+
/** Immediately destroys every current entity while leaving the entity store usable. */
|
|
286
|
+
destroyAllEntities() {
|
|
287
|
+
if (this.isDestroyed) {
|
|
288
|
+
throw new Error('Cannot operate on a destroyed entity store.');
|
|
289
|
+
}
|
|
290
|
+
this.currentEntityInstances.forEach((entity) => entity.immediatelyDestroy());
|
|
291
|
+
}
|
|
281
292
|
/** Destroys the entity store and all entities contained inside it. */
|
|
282
293
|
destroy() {
|
|
283
294
|
if (this.isDestroyed) {
|
|
@@ -2,7 +2,11 @@ import { type Asset, type AssetBulkLoaderLoadOptions, type AssetLoader } from '@
|
|
|
2
2
|
import { type AudioPlayer, type AudioSetupParams } from '@antha/audio';
|
|
3
3
|
import { type PartialWithUndefined } from '@augment-vir/common';
|
|
4
4
|
import { type Entity2dConstructor } from './entity.js';
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Audio files and their player to include in {@link loadAnthaAssets}.
|
|
7
|
+
*
|
|
8
|
+
* @category Internal
|
|
9
|
+
*/
|
|
6
10
|
export type AnthaAudioFilesToLoad = {
|
|
7
11
|
audioPlayer: Pick<AudioPlayer, 'loadFiles'>;
|
|
8
12
|
files: ReadonlyArray<Readonly<AudioSetupParams>>;
|
|
@@ -12,7 +16,11 @@ export type AnthaAudioFilesToLoad = {
|
|
|
12
16
|
/** Whether audio files should load sequentially. */
|
|
13
17
|
serial: boolean;
|
|
14
18
|
}>;
|
|
15
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Inputs for {@link loadAnthaAssets}.
|
|
21
|
+
*
|
|
22
|
+
* @category Internal
|
|
23
|
+
*/
|
|
16
24
|
export type LoadAnthaAssetsParams = {
|
|
17
25
|
assetLoader: AssetLoader;
|
|
18
26
|
} & PartialWithUndefined<{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antha/entity-2d",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "An Antha mod for handling 2D entities.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vir",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"@augment-vir/common": "^32.2.3"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@antha/engine": "^0.
|
|
43
|
-
"@antha/web-test-runner-plugin-pixi": "^0.
|
|
42
|
+
"@antha/engine": "^0.13.0",
|
|
43
|
+
"@antha/web-test-runner-plugin-pixi": "^0.13.0",
|
|
44
44
|
"@augment-vir/test": "^32.2.3",
|
|
45
45
|
"@web/dev-server-esbuild": "^2.0.0",
|
|
46
46
|
"@web/test-runner": "^1.0.0",
|
|
@@ -48,14 +48,14 @@
|
|
|
48
48
|
"detect-collisions": "^10.10.2025",
|
|
49
49
|
"istanbul-smart-text-reporter": "^1.1.5",
|
|
50
50
|
"object-shape-tester": "^6.15.0",
|
|
51
|
-
"pixi.js": "^8.20.
|
|
51
|
+
"pixi.js": "^8.20.1",
|
|
52
52
|
"typed-event-target": "^4.3.3"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@antha/asset": "^0.
|
|
56
|
-
"@antha/audio": "^0.
|
|
57
|
-
"@antha/engine": "^0.
|
|
58
|
-
"@antha/graphics-2d": "^0.
|
|
55
|
+
"@antha/asset": "^0.13.0",
|
|
56
|
+
"@antha/audio": "^0.13.0",
|
|
57
|
+
"@antha/engine": "^0.13.0",
|
|
58
|
+
"@antha/graphics-2d": "^0.13.0",
|
|
59
59
|
"detect-collisions": ">=10",
|
|
60
60
|
"element-vir": ">=26",
|
|
61
61
|
"object-shape-tester": ">=6",
|