@antha/entity-2d 0.20.0 → 0.21.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 CHANGED
@@ -187,6 +187,12 @@ export declare class EntityStore2d<State extends AnyObject = any> {
187
187
  * Entities that are marked destroyed but not yet removed are skipped.
188
188
  */
189
189
  createSnapshot(): SerializedEntity2d[];
190
+ /**
191
+ * Hashes {@link EntityStore2d.createSnapshot} with `hashObject` from `@antha/util`, so it covers
192
+ * exactly what {@link BaseEntity2d.serialize} covers. Compare this across lock-step peers to
193
+ * detect desyncs.
194
+ */
195
+ hashEntities(): number;
190
196
  /**
191
197
  * Immediately destroys every current entity and recreates the entities from a snapshot made by
192
198
  * {@link EntityStore2d.createSnapshot}, in the same order. Only entity params are restored: any
package/dist/entity.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { hashObject } from '@antha/util';
1
2
  import { assert, check } from '@augment-vir/assert';
2
3
  import { awaitedBlockingMap, ConstructorInstanceMap, getObjectTypedEntries, getOrSet, makeWritable, mapObjectValues, } from '@augment-vir/common';
3
4
  import { System as HitboxSystem, Response, } from 'detect-collisions';
@@ -289,6 +290,14 @@ export class EntityStore2d {
289
290
  };
290
291
  });
291
292
  }
293
+ /**
294
+ * Hashes {@link EntityStore2d.createSnapshot} with `hashObject` from `@antha/util`, so it covers
295
+ * exactly what {@link BaseEntity2d.serialize} covers. Compare this across lock-step peers to
296
+ * detect desyncs.
297
+ */
298
+ hashEntities() {
299
+ return hashObject(this.createSnapshot());
300
+ }
292
301
  /**
293
302
  * Immediately destroys every current entity and recreates the entities from a snapshot made by
294
303
  * {@link EntityStore2d.createSnapshot}, in the same order. Only entity params are restored: any
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antha/entity-2d",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "description": "An Antha mod for handling 2D entities.",
5
5
  "keywords": [
6
6
  "vir",
@@ -39,11 +39,12 @@
39
39
  "@augment-vir/common": "^32.3.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@antha/asset": "^0.20.0",
43
- "@antha/audio": "^0.20.0",
44
- "@antha/engine": "^0.20.0",
45
- "@antha/graphics-2d": "^0.20.0",
46
- "@antha/web-test-runner-plugin-pixi": "^0.20.0",
42
+ "@antha/asset": "^0.21.0",
43
+ "@antha/audio": "^0.21.0",
44
+ "@antha/engine": "^0.21.0",
45
+ "@antha/graphics-2d": "^0.21.0",
46
+ "@antha/util": "^0.21.0",
47
+ "@antha/web-test-runner-plugin-pixi": "^0.21.0",
47
48
  "@augment-vir/test": "^32.3.0",
48
49
  "@web/dev-server-esbuild": "^2.0.0",
49
50
  "@web/test-runner": "^1.0.0",
@@ -55,10 +56,11 @@
55
56
  "typed-event-target": "^4.3.3"
56
57
  },
57
58
  "peerDependencies": {
58
- "@antha/asset": "^0.20.0",
59
- "@antha/audio": "^0.20.0",
60
- "@antha/engine": "^0.20.0",
61
- "@antha/graphics-2d": "^0.20.0",
59
+ "@antha/asset": "^0.21.0",
60
+ "@antha/audio": "^0.21.0",
61
+ "@antha/engine": "^0.21.0",
62
+ "@antha/graphics-2d": "^0.21.0",
63
+ "@antha/util": "^0.21.0",
62
64
  "detect-collisions": "^10",
63
65
  "element-vir": "^27",
64
66
  "object-shape-tester": "^6",