@woosh/meep-engine 2.119.4 → 2.119.5

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/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "description": "Fully featured ECS game engine written in JavaScript",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.119.4",
8
+ "version": "2.119.5",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -1,4 +1,11 @@
1
1
  export class EntityReference {
2
+ /**
3
+ *
4
+ * @param {number} id
5
+ * @param {number} generation
6
+ * @return {EntityReference}
7
+ */
8
+ static from(id: number, generation: number): EntityReference;
2
9
  /**
3
10
  * Entity ID
4
11
  * @type {number}
@@ -9,5 +16,16 @@ export class EntityReference {
9
16
  * @type {number}
10
17
  */
11
18
  generation: number;
19
+ /**
20
+ *
21
+ * @return {number}
22
+ */
23
+ hash(): number;
24
+ /**
25
+ *
26
+ * @param {EntityReference} other
27
+ * @return {boolean}
28
+ */
29
+ equals(other: EntityReference): boolean;
12
30
  }
13
31
  //# sourceMappingURL=EntityReference.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EntityReference.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/EntityReference.js"],"names":[],"mappings":"AAAA;IACI;;;OAGG;IACH,IAFU,MAAM,CAET;IACP;;;OAGG;IACH,YAFU,MAAM,CAED;CAClB"}
1
+ {"version":3,"file":"EntityReference.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/EntityReference.js"],"names":[],"mappings":"AAEA;IAgCI;;;;;OAKG;IACH,gBAJW,MAAM,cACN,MAAM,GACL,eAAe,CAa1B;IAhDD;;;OAGG;IACH,IAFU,MAAM,CAET;IACP;;;OAGG;IACH,YAFU,MAAM,CAED;IAGf;;;OAGG;IACH,QAFY,MAAM,CAIjB;IAED;;;;OAIG;IACH,cAHW,eAAe,GACd,OAAO,CAMlB;CAoBJ"}
@@ -1,3 +1,5 @@
1
+ import { assert } from "../../core/assert.js";
2
+
1
3
  export class EntityReference {
2
4
  /**
3
5
  * Entity ID
@@ -9,4 +11,43 @@ export class EntityReference {
9
11
  * @type {number}
10
12
  */
11
13
  generation = -1
14
+
15
+
16
+ /**
17
+ *
18
+ * @return {number}
19
+ */
20
+ hash() {
21
+ return this.id ^ this.generation;
22
+ }
23
+
24
+ /**
25
+ *
26
+ * @param {EntityReference} other
27
+ * @return {boolean}
28
+ */
29
+ equals(other) {
30
+ return this.id === other.id
31
+ && this.generation === other.generation
32
+ ;
33
+ }
34
+
35
+ /**
36
+ *
37
+ * @param {number} id
38
+ * @param {number} generation
39
+ * @return {EntityReference}
40
+ */
41
+ static from(id, generation) {
42
+
43
+ assert.isNonNegativeInteger(id, 'id');
44
+ assert.isNonNegativeInteger(generation, 'generation');
45
+
46
+ const r = new EntityReference();
47
+
48
+ r.id = id;
49
+ r.generation = generation;
50
+
51
+ return r;
52
+ }
12
53
  }