@woosh/meep-engine 2.123.6 → 2.123.8
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 +1 -1
- package/src/core/binary/clz32.d.ts +2 -3
- package/src/core/binary/clz32.d.ts.map +1 -1
- package/src/core/binary/clz32.js +2 -34
- package/src/core/binary/msb_32.d.ts +0 -1
- package/src/core/binary/msb_32.d.ts.map +1 -1
- package/src/core/binary/msb_32.js +1 -4
- package/src/core/bvh2/bvh3/ebvh_build_hierarchy_radix.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/ebvh_build_hierarchy_radix.js +9 -10
- package/src/core/collection/queue/Deque.d.ts.map +1 -1
- package/src/core/collection/queue/Deque.js +10 -2
- package/src/core/collection/queue/Queue.d.ts +7 -0
- package/src/core/collection/queue/Queue.d.ts.map +1 -0
- package/src/core/collection/queue/Queue.js +7 -0
- package/src/engine/ecs/Entity.d.ts.map +1 -1
- package/src/engine/ecs/Entity.js +14 -33
- package/src/engine/ecs/EntityComponentDataset.d.ts.map +1 -1
- package/src/engine/ecs/EntityComponentDataset.js +192 -156
- package/src/engine/graphics/ecs/mesh-v2/render/optimization/RuntimeDrawMethodOptimizer.js +2 -2
- package/src/engine/intelligence/behavior/behavior_to_dot.js +1 -1
- package/src/engine/intelligence/behavior/composite/CompositeBehavior.d.ts +9 -4
- package/src/engine/intelligence/behavior/composite/CompositeBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/composite/CompositeBehavior.js +21 -15
- package/src/engine/intelligence/behavior/composite/ParallelBehavior.d.ts +4 -4
- package/src/engine/intelligence/behavior/composite/ParallelBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/composite/ParallelBehavior.js +12 -10
- package/src/engine/intelligence/behavior/composite/ParallelBehaviorSerializationAdapter.js +1 -1
- package/src/engine/intelligence/behavior/composite/SequenceBehavior.d.ts +2 -2
- package/src/engine/intelligence/behavior/composite/SequenceBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/composite/SequenceBehavior.js +3 -3
- package/src/engine/intelligence/behavior/composite/SequenceBehaviorSerializationAdapter.js +1 -1
- package/src/engine/intelligence/behavior/decorator/RepeatBehavior.d.ts +13 -18
- package/src/engine/intelligence/behavior/decorator/RepeatBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/decorator/RepeatBehavior.js +13 -22
- package/src/engine/intelligence/behavior/primitive/ActionBehavior.d.ts +8 -0
- package/src/engine/intelligence/behavior/primitive/ActionBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/primitive/ActionBehavior.js +12 -0
- package/src/engine/intelligence/behavior/util/behavior_traverse_tree.js +1 -1
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clz32.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/clz32.js"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"clz32.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/clz32.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH,0CAAgC"}
|
package/src/core/binary/clz32.js
CHANGED
|
@@ -1,37 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Count leading zeroes in a 32bit integer
|
|
3
|
-
* @
|
|
4
|
-
* @returns {number}
|
|
3
|
+
* @deprecated use Math.clz32 directly
|
|
5
4
|
*/
|
|
6
|
-
export
|
|
7
|
-
if (x === 0) {
|
|
8
|
-
return 32;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
let v = x >>> 0;
|
|
12
|
-
let result = 0;
|
|
13
|
-
|
|
14
|
-
// Binary search.
|
|
15
|
-
if ((v & 0xFFFF0000) === 0) {
|
|
16
|
-
v <<= 16;
|
|
17
|
-
result += 16;
|
|
18
|
-
}
|
|
19
|
-
if ((v & 0xFF000000) === 0) {
|
|
20
|
-
v <<= 8;
|
|
21
|
-
result += 8;
|
|
22
|
-
}
|
|
23
|
-
if ((v & 0xF0000000) === 0) {
|
|
24
|
-
v <<= 4;
|
|
25
|
-
result += 4;
|
|
26
|
-
}
|
|
27
|
-
if ((v & 0xC0000000) === 0) {
|
|
28
|
-
v <<= 2;
|
|
29
|
-
result += 2;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if ((v & 0x80000000) === 0) {
|
|
33
|
-
result += 1;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return result;
|
|
37
|
-
}
|
|
5
|
+
export const clz32 = Math.clz32;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"msb_32.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/msb_32.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"msb_32.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/msb_32.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,0BAHW,MAAM,GACJ,MAAM,CAIlB"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { clz32 } from "./clz32.js";
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* get most significant set bit
|
|
5
|
-
* @see https://graphics.stanford.edu/~seander/bithacks.html
|
|
6
3
|
* @param {number} x 32 bit integer
|
|
7
4
|
* @returns {number} integer position of most significant bit
|
|
8
5
|
*/
|
|
9
6
|
export function msb_32(x) {
|
|
10
|
-
return 31 - clz32(x);
|
|
7
|
+
return 31 - Math.clz32(x);
|
|
11
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ebvh_build_hierarchy_radix.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/bvh3/ebvh_build_hierarchy_radix.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ebvh_build_hierarchy_radix.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/bvh3/ebvh_build_hierarchy_radix.js"],"names":[],"mappings":"AA2MA;;;;;;;;GAQG;AACH,gDAPW,GAAG,cACH,MAAM,EAAE,GAAC,WAAW,uBACpB,MAAM,EAAE,cACR,MAAM,kBACN,MAAM,EAAE,GACN,MAAM,CAqElB"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { assert } from "../../assert.js";
|
|
2
|
-
import { clz32 } from "../../binary/clz32.js";
|
|
3
2
|
import { clamp } from "../../math/clamp.js";
|
|
4
3
|
import { NULL_NODE } from "./BVH.js";
|
|
5
4
|
import { ebvh_update_hierarchy_bounds } from "./ebvh_update_hierarchy_bounds.js";
|
|
@@ -30,7 +29,7 @@ function find_split(
|
|
|
30
29
|
// Calculate the number of highest bits that are the same
|
|
31
30
|
// for all objects, using the count-leading-zeros intrinsic.
|
|
32
31
|
|
|
33
|
-
const commonPrefix = clz32(firstCode ^ lastCode);
|
|
32
|
+
const commonPrefix = Math.clz32(firstCode ^ lastCode);
|
|
34
33
|
|
|
35
34
|
// Use binary search to find where the next bit differs.
|
|
36
35
|
// Specifically, we are looking for the highest object that
|
|
@@ -45,7 +44,7 @@ function find_split(
|
|
|
45
44
|
|
|
46
45
|
if (newSplit < last) {
|
|
47
46
|
const splitCode = sortedMortonCodes[newSplit];
|
|
48
|
-
const splitPrefix = clz32(firstCode ^ splitCode);
|
|
47
|
+
const splitPrefix = Math.clz32(firstCode ^ splitCode);
|
|
49
48
|
if (splitPrefix > commonPrefix) {
|
|
50
49
|
split = newSplit; // accept proposal
|
|
51
50
|
}
|
|
@@ -75,10 +74,10 @@ function GetLongestCommonPrefix(indexA, indexB, elementCount, mortonCodes) {
|
|
|
75
74
|
const mortonCodeA = mortonCodes[indexA];
|
|
76
75
|
const mortonCodeB = mortonCodes[indexB];
|
|
77
76
|
if (mortonCodeA !== mortonCodeB) {
|
|
78
|
-
return clz32(mortonCodeA ^ mortonCodeB);
|
|
77
|
+
return Math.clz32(mortonCodeA ^ mortonCodeB);
|
|
79
78
|
} else {
|
|
80
79
|
// TODO: Technically this should be primitive ID
|
|
81
|
-
return clz32(indexA ^ indexB) + 31;
|
|
80
|
+
return Math.clz32(indexA ^ indexB) + 31;
|
|
82
81
|
}
|
|
83
82
|
}
|
|
84
83
|
}
|
|
@@ -140,12 +139,12 @@ function determineRange(output, sortedMortonCodes, numTriangles, idx) {
|
|
|
140
139
|
let common_prefix_with_left = 0;
|
|
141
140
|
let common_prefix_with_right = 0;
|
|
142
141
|
|
|
143
|
-
common_prefix_with_right = clz32(sortedMortonCodes[idx] ^ sortedMortonCodes[idx + 1]);
|
|
142
|
+
common_prefix_with_right = Math.clz32(sortedMortonCodes[idx] ^ sortedMortonCodes[idx + 1]);
|
|
144
143
|
|
|
145
144
|
if (idx === 0) {
|
|
146
145
|
common_prefix_with_left = -1;
|
|
147
146
|
} else {
|
|
148
|
-
common_prefix_with_left = clz32(sortedMortonCodes[idx] ^ sortedMortonCodes[idx - 1]);
|
|
147
|
+
common_prefix_with_left = Math.clz32(sortedMortonCodes[idx] ^ sortedMortonCodes[idx - 1]);
|
|
149
148
|
|
|
150
149
|
}
|
|
151
150
|
|
|
@@ -157,13 +156,13 @@ function determineRange(output, sortedMortonCodes, numTriangles, idx) {
|
|
|
157
156
|
min_prefix_range = -1;
|
|
158
157
|
|
|
159
158
|
} else {
|
|
160
|
-
min_prefix_range = clz32(sortedMortonCodes[idx] ^ sortedMortonCodes[idx - direction]);
|
|
159
|
+
min_prefix_range = Math.clz32(sortedMortonCodes[idx] ^ sortedMortonCodes[idx - direction]);
|
|
161
160
|
}
|
|
162
161
|
|
|
163
162
|
let lmax = 2;
|
|
164
163
|
let next_key = idx + lmax * direction;
|
|
165
164
|
|
|
166
|
-
while ((next_key >= 0) && (next_key < numTriangles) && (clz32(sortedMortonCodes[idx] ^ sortedMortonCodes[next_key]) > min_prefix_range)) {
|
|
165
|
+
while ((next_key >= 0) && (next_key < numTriangles) && (Math.clz32(sortedMortonCodes[idx] ^ sortedMortonCodes[next_key]) > min_prefix_range)) {
|
|
167
166
|
lmax *= 2;
|
|
168
167
|
next_key = idx + lmax * direction;
|
|
169
168
|
}
|
|
@@ -176,7 +175,7 @@ function determineRange(output, sortedMortonCodes, numTriangles, idx) {
|
|
|
176
175
|
|
|
177
176
|
if (new_val >= 0 && new_val < numTriangles) {
|
|
178
177
|
const Code = sortedMortonCodes[new_val];
|
|
179
|
-
const Prefix = clz32(sortedMortonCodes[idx] ^ Code);
|
|
178
|
+
const Prefix = Math.clz32(sortedMortonCodes[idx] ^ Code);
|
|
180
179
|
if (Prefix > min_prefix_range) {
|
|
181
180
|
l = l + lmax;
|
|
182
181
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Deque.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/queue/Deque.js"],"names":[],"mappings":"AAqBA
|
|
1
|
+
{"version":3,"file":"Deque.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/queue/Deque.js"],"names":[],"mappings":"AAqBA;;;;;GAKG;AACH,mBAFa,CAAC;IAkCV;;;OAGG;IACH,uBAFW,MAAM,EAUhB;IAuFD;;;OAGG;IACH,WAFY,OAAO,CAIlB;IAED;;;;OAIG;IACH,SAFa,IAAI,CAiBhB;IAED;;;OAGG;IACH,QAFa,MAAM,CAalB;IA6BD;;;;OAIG;IACH,UAHW,CAAC,GACC,OAAO,CAYnB;IA4BD;;;;OAIG;IACH,OAHW,CAAC,GACC,OAAO,CAInB;IAED;;;OAGG;IACH,YAFW,CAAC,QAOX;IAED;;;OAGG;IACH,eAFa,CAAC,GAAC,SAAS,CAQvB;IAED;;;OAGG;IACH,YAFa,CAAC,GAAC,SAAS,CAIvB;IAED;;;;OAIG;IACH,WAHW,CAAC,GACC,IAAI,CAOhB;IAED;;;OAGG;IACH,cAFa,CAAC,CASb;IAGD;;;OAGG;IACH,WAFa,CAAC,GAAC,SAAS,CAKvB;IAED;;;;OAIG;IACH,yBAHW,MAAM,GACJ,CAAC,GAAC,SAAS,CAmBvB;IAED;;;;;OAKG;IACH,iBAJW,CAAC,EAAE,kBACH,MAAM,GACJ,CAAC,EAAE,CAUf;IAoBL;;OAEG;IACH,gBAAoB;IACpB;;OAEG;IACH,uBAAoB;IACpB;;OAEG;IACH,eAAmB;IAEnB;;OAEG;IACH,iBA1GiB,IAAI,CA0GF;IAlCf;;;OAGG;IACH,qBAFa,SAAS,CAAC,CAAC,EAAC,IAAI,CAAC,CAS7B;;CACJ"}
|
|
@@ -20,7 +20,9 @@ const GROWTH_FACTOR = 2;
|
|
|
20
20
|
const EMPTY_ARRAY = new Array(0);
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* Queue data structure, first-in-first-out (FIFO).
|
|
24
|
+
* Double-ended queue backed by an array.
|
|
25
|
+
* The fact that it's double-ended means you can add and remove from both ends.
|
|
24
26
|
* @template T
|
|
25
27
|
*/
|
|
26
28
|
export class Deque {
|
|
@@ -162,6 +164,11 @@ export class Deque {
|
|
|
162
164
|
return this.#status === STATUS_EMPTY;
|
|
163
165
|
}
|
|
164
166
|
|
|
167
|
+
/**
|
|
168
|
+
* Clear data from the queue.
|
|
169
|
+
* Makes the queue empty.
|
|
170
|
+
* @returns {void}
|
|
171
|
+
*/
|
|
165
172
|
clear() {
|
|
166
173
|
if (this.#status !== STATUS_EMPTY) {
|
|
167
174
|
let cursor = this.#head;
|
|
@@ -309,6 +316,7 @@ export class Deque {
|
|
|
309
316
|
/**
|
|
310
317
|
* Add element at the end of the queue
|
|
311
318
|
* @param {T} e
|
|
319
|
+
* @returns {void}
|
|
312
320
|
*/
|
|
313
321
|
addLast(e) {
|
|
314
322
|
this.#check_and_expand();
|
|
@@ -374,7 +382,7 @@ export class Deque {
|
|
|
374
382
|
const size = this.size();
|
|
375
383
|
|
|
376
384
|
for (let i = 0; i < size; i++) {
|
|
377
|
-
result[i] = this.getElementByIndex(i);
|
|
385
|
+
result[result_offset + i] = this.getElementByIndex(i);
|
|
378
386
|
}
|
|
379
387
|
|
|
380
388
|
return result;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Queue.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/queue/Queue.js"],"names":[],"mappings":"AAEA;;;GAGG;AACH,+BAA2B;sBANL,YAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Entity.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/Entity.js"],"names":[],"mappings":"AAgBA
|
|
1
|
+
{"version":3,"file":"Entity.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/Entity.js"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH;IA0aI;;;;;OAKG;IACH,+BAJW,MAAM,WACN,sBAAsB,GACpB,MAAM,CAgBlB;IA5bD;;;OAGG;IACH,oBAFU,eAAe,CAES;IAWlC;;;OAGG;IACH,UAFW,MAAM,EAIhB;IAdD;;;OAGG;IACH,UAFa,MAAM,CAIlB;IAmBD;;;OAGG;IACH,kBAFW,MAAM,EAIhB;IAfD;;;OAGG;IACH,kBAFa,MAAM,CAIlB;IAWD;;;;OAIG;IACH,2BAAgB;IAQhB;;;;OAIG;IACH,SAFU,sBAAsB,CAEjB;IAEf;;;OAGG;IACH,OAFU,WAAW,GAAC,MAAM,CAEN;IAEtB;;;;OAIG;IACH,yBAAgB;IAEhB;;OAEG;IACH;QACI;;WAEG;;MAEL;IAUF;;;OAGG;IACH,eAFW,MAAM,GAAC,WAAW,QAI5B;IAED;;;;OAIG;IACH,cAHW,MAAM,GAAC,WAAW,GAChB,OAAO,CAMnB;IAED;;;OAGG;IACH,gBAFW,MAAM,GAAC,WAAW,QAI5B;IAED;;;OAGG;IACH,eAFa,OAAO,CAInB;IAED;;OAEG;IACH,4BAQC;IAED;;;OAGG;IACH,aAFY,MAAM,CAIjB;IAED;;;;OAIG;IACH,IAJa,CAAC,qBACH,CAAC,GACC,MAAM,CAsBlB;IAED;;;;OAIG;IACH,aAJa,CAAC,SACH,CAAC,GACC,OAAO,CAInB;IAED;;;;OAIG;IACH,aAJa,CAAC,SACH,KAAK,CAAC,CAAC,CAAC,GACN,CAAC,GAAC,IAAI,CAclB;IAED;;;;;OAKG;IACH,iBAJa,CAAC,SACH,KAAK,CAAC,CAAC,CAAC,GACN,CAAC,CAUb;IAED;;;;OAIG;IACH,kCAFa,GAAC,GAAC,IAAI,CA0BlB;IAED;;;;OAIG;IACH,qBAHW,MAAM,UACN,GAAC,QAQX;IAED;;;OAGG;IACH,wBAFW,MAAM,gBAiBhB;IAED;;;;;;OAMG;IACH,4BALW,MAAM,gCAEN,GAAC,GACC,MAAM,CAalB;IAED;;;;;;OAMG;IACH,+BALW,MAAM,gCAEN,GAAC,GACC,MAAM,CAyBlB;IAED;;;OAGG;IACH,WAFa,OAAO,CAwBnB;IAED;;;;OAIG;IACH,eAFW,sBAAsB,GADpB,MAAM,CAyDlB;IAyBL;;;;OAIG;IACH,mBAFU,OAAO,CAEQ;;CAPxB;;gCAve+B,sBAAsB;4BAD1B,kBAAkB;mBAF3B,oCAAoC"}
|
package/src/engine/ecs/Entity.js
CHANGED
|
@@ -19,42 +19,24 @@ const DEFAULT_FLAGS =
|
|
|
19
19
|
*
|
|
20
20
|
*
|
|
21
21
|
* @example
|
|
22
|
-
* // Create a new entity (initially has no components).
|
|
23
22
|
* const entity = new Entity();
|
|
24
23
|
*
|
|
25
|
-
* // Define some components (simple data containers).
|
|
26
|
-
* class PositionComponent {
|
|
27
|
-
* constructor(x, y) {
|
|
28
|
-
* this.x = x;
|
|
29
|
-
* this.y = y;
|
|
30
|
-
* }
|
|
31
|
-
* }
|
|
32
|
-
*
|
|
33
|
-
* class VelocityComponent {
|
|
34
|
-
* constructor(x, y) {
|
|
35
|
-
* this.x = x;
|
|
36
|
-
* this.y = y;
|
|
37
|
-
* }
|
|
38
|
-
* }
|
|
39
|
-
*
|
|
40
24
|
* // Add components to the entity.
|
|
41
|
-
* entity.add(new
|
|
42
|
-
* entity.add(new
|
|
43
|
-
|
|
25
|
+
* entity.add(new Position(10, 20));
|
|
26
|
+
* entity.add(new Velocity(1, 2));
|
|
44
27
|
*
|
|
45
28
|
* // Get a component (would return null if the entity doesn't have it).
|
|
46
|
-
* const position = entity.getComponent(
|
|
29
|
+
* const position = entity.getComponent(Position); // { x:10, y:20 }
|
|
47
30
|
*
|
|
48
31
|
* // Remove a component.
|
|
49
|
-
* entity.removeComponent(
|
|
32
|
+
* entity.removeComponent(Velocity);
|
|
50
33
|
*
|
|
51
34
|
* // To actually use the entity in a game, you need to build it using an EntityComponentDataset.
|
|
52
35
|
* const dataset = new EntityComponentDataset(); // You would typically have one already
|
|
53
36
|
*
|
|
54
|
-
* entity.build(dataset);
|
|
55
|
-
* // Now the entity and its components are managed by the ECS.
|
|
37
|
+
* entity.build(dataset); // add entity with the components to the scene
|
|
56
38
|
*
|
|
57
|
-
* //
|
|
39
|
+
* // ... Once entity is no longer needed, we destroy it
|
|
58
40
|
* entity.destroy();
|
|
59
41
|
*
|
|
60
42
|
* @author Alex Goldring
|
|
@@ -70,7 +52,7 @@ export class Entity {
|
|
|
70
52
|
|
|
71
53
|
|
|
72
54
|
/**
|
|
73
|
-
*
|
|
55
|
+
* ID of the entity. Shortcut to {@link reference.id}
|
|
74
56
|
* @returns {number}
|
|
75
57
|
*/
|
|
76
58
|
get id() {
|
|
@@ -86,7 +68,7 @@ export class Entity {
|
|
|
86
68
|
}
|
|
87
69
|
|
|
88
70
|
/**
|
|
89
|
-
*
|
|
71
|
+
* Entity's generation tag. Shortcut to {@link reference.generation}
|
|
90
72
|
* @returns {number}
|
|
91
73
|
*/
|
|
92
74
|
get generation() {
|
|
@@ -215,9 +197,8 @@ export class Entity {
|
|
|
215
197
|
* @returns {Entity}
|
|
216
198
|
*/
|
|
217
199
|
add(componentInstance) {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
}
|
|
200
|
+
assert.defined(componentInstance, 'componentInstance');
|
|
201
|
+
assert.notNull(componentInstance, 'componentInstance');
|
|
221
202
|
|
|
222
203
|
assert.notOk(this.hasComponent(Object.getPrototypeOf(componentInstance).constructor), 'Component of this type already exists');
|
|
223
204
|
|
|
@@ -231,7 +212,7 @@ export class Entity {
|
|
|
231
212
|
this.dataset.registerComponentType(componentInstance.constructor)
|
|
232
213
|
}
|
|
233
214
|
|
|
234
|
-
this.dataset.addComponentToEntity(this.id, componentInstance);
|
|
215
|
+
this.dataset.addComponentToEntity(this.reference.id, componentInstance);
|
|
235
216
|
}
|
|
236
217
|
|
|
237
218
|
return this;
|
|
@@ -319,7 +300,7 @@ export class Entity {
|
|
|
319
300
|
*/
|
|
320
301
|
sendEvent(eventName, event) {
|
|
321
302
|
if (this.getFlag(EntityFlags.Built)) {
|
|
322
|
-
this.dataset.sendEvent(this.id, eventName, event);
|
|
303
|
+
this.dataset.sendEvent(this.reference.id, eventName, event);
|
|
323
304
|
} else {
|
|
324
305
|
console.warn("Entity doesn't exist. Event " + eventName + ":" + event + " was not sent.")
|
|
325
306
|
}
|
|
@@ -355,7 +336,7 @@ export class Entity {
|
|
|
355
336
|
*/
|
|
356
337
|
addEventListener(eventName, listener, context) {
|
|
357
338
|
if (this.getFlag(EntityFlags.Built)) {
|
|
358
|
-
this.dataset.addEntityEventListener(this.id, eventName, listener, context);
|
|
339
|
+
this.dataset.addEntityEventListener(this.reference.id, eventName, listener, context);
|
|
359
340
|
} else {
|
|
360
341
|
this.#deferredListeners.push({
|
|
361
342
|
name: eventName,
|
|
@@ -375,7 +356,7 @@ export class Entity {
|
|
|
375
356
|
*/
|
|
376
357
|
removeEventListener(eventName, listener, context) {
|
|
377
358
|
if (this.getFlag(EntityFlags.Built)) {
|
|
378
|
-
this.dataset.removeEntityEventListener(this.id, eventName, listener, context);
|
|
359
|
+
this.dataset.removeEntityEventListener(this.reference.id, eventName, listener, context);
|
|
379
360
|
} else {
|
|
380
361
|
const listeners = this.#deferredListeners;
|
|
381
362
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityComponentDataset.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/EntityComponentDataset.js"],"names":[],"mappings":"AAyHA
|
|
1
|
+
{"version":3,"file":"EntityComponentDataset.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/EntityComponentDataset.js"],"names":[],"mappings":"AAyHA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,+CAfgB,QAAQ,CAAC,MAAM;IAiB3B;;;;OAIG;IACH,wBAA+B;IAE/B;;;;;OAKG;IACH,yBAAsC;IAEtC;;;;;;;;;OASG;IACH,2BAAkC;IAElC;;;;;OAKG;IACH,yBAAsB;IAEtB;;;;OAIG;IACH,4BAAgC;IAEhC;;;;OAIG;IACH,2BAAuB;IAEvB;;;OAGG;IACH,mBAAgB;IAEhB;;;;OAIG;IACH,oBAAgB;IAEhB;;;;;;;OAOG;IACH,mBAAe;IAEf;;;OAGG;IACH,0BAFU,MAAM,CAAC,MAAM,CAAC,CAEO;IAE/B;;;OAGG;IACH,0BAFU,MAAM,CAEe;IAG/B;;;;OAIG;IACH,+BAA4B;IAE5B;;;;OAIG;IACH,kCAA+B;IAE/B;;;OAGG;IACH,kBAAe;IAGf;;;;;;OAMG;IACH,iBALa,CAAC,EAAE,CAAC,UACN,GAAG,kBACH,CAAC,GACC,OAAO,CAAC,CAAC,CAAC,CAoCtB;IAED;;;;;OAKG;IACH,sBAJW,cAAc,cACd,OAAO,GACL,OAAO,CAqDnB;IAED;;;;;OAKG;IACH,yBAJW,cAAc,cACd,OAAO,GACL,OAAO,CAuDnB;IAED;;;OAGG;IACH,kBAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,yBAFa,MAAM,CAIlB;IAED;;;;;OAKG;IACH,sBAJW,MAAM,qBACN,EAAE,SAmCZ;IAED;;;;OAIG;IACH,4BAHW,MAAM,GACJ,EAAE,CAyBd;IAED;;;;;OAKG;IACH,yBAJW,KAAK,EAAE,GACL,IAAI,CA0LhB;IAED;;;;OAIG;IACH,mCAHW,KAAK,EAAE,GACL,OAAO,CAenB;IAED;;;;;OAKG;IACH,gCAHW,KAAK,WAAS,GACb,OAAO,CASlB;IAED;;;OAGG;IACH,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