@woosh/meep-engine 2.128.0 → 2.128.1
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/engine/ecs/Entity.d.ts.map +1 -1
- package/src/engine/ecs/Entity.js +14 -5
- package/src/engine/ecs/EntityComponentDataset.d.ts.map +1 -1
- package/src/engine/ecs/EntityComponentDataset.js +48 -2
- package/src/engine/ecs/EntityManager.js +3 -3
- package/src/engine/ecs/EntityReference.d.ts.map +1 -1
- package/src/engine/ecs/EntityReference.js +2 -0
- package/src/engine/ecs/System.d.ts.map +1 -1
- package/src/engine/ecs/System.js +3 -28
- package/src/engine/ecs/{validateSystem.d.ts → system_validate_class.d.ts} +2 -2
- package/src/engine/ecs/system_validate_class.d.ts.map +1 -0
- package/src/engine/ecs/{validateSystem.js → system_validate_class.js} +1 -1
- package/src/engine/scene/SceneManager.js +3 -3
- package/src/engine/ecs/validateSystem.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"description": "Pure JavaScript game engine. Fully featured and production ready.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": "Alexander Goldring",
|
|
8
|
-
"version": "2.128.
|
|
8
|
+
"version": "2.128.1",
|
|
9
9
|
"main": "build/meep.module.js",
|
|
10
10
|
"module": "build/meep.module.js",
|
|
11
11
|
"exports": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Entity.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/Entity.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Entity.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/Entity.js"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH;IAkcI;;;;;;;;;;;;OAYG;IACH,+BAJW,MAAM,oCAEJ,MAAM,CAmBlB;IA9dD;;;;;OAKG;IACH,oBAFU,eAAe,CAES;IAGlC;;;OAGG;IACH,iBAEC;IAED;;;OAGG;IACH,yBAEC;IAED;;;;OAIG;IACH,2BAAgB;IAShB;;;;;;OAMG;IACH,gCAAe;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;;;;;;;OAOG;IACH,gCAEC;IAED;;OAEG;IACH,4BAUC;IAED;;;OAGG;IACH,oBAEC;IAED;;;;;;OAMG;IACH,+BAFa,MAAM,CAsBlB;IAED;;;;;OAKG;IACH,+BAFa,OAAO,CAInB;IAED;;;;OAIG;IACH,0CAYC;IAED;;;;;OAKG;IACH,8CAQC;IAED;;;;OAIG;IACH,kCAFa,MAAE,IAAI,CA0BlB;IAED;;;;OAIG;IACH,qBAHW,MAAM,qBAWhB;IAED;;;OAGG;IACH,wBAFW,MAAM,gBAmBhB;IAED;;;;;;OAMG;IACH,4BALW,MAAM,sCAGJ,MAAM,CAgBlB;IAED;;;;;;OAMG;IACH,+BALW,MAAM,sCAGJ,MAAM,CA4BlB;IAED;;;;;;OAMG;IACH,WAJa,OAAO,CA0BnB;IAED;;;;;;;;;;;;;;;OAeG;IACH,wCANa,MAAM,CA+DlB;IAmCL;;;;OAIG;IACH,mBAFU,OAAO,CAEQ;;CAPxB;;gCA1gB+B,sBAAsB;4BAD1B,kBAAkB;mBAD3B,oCAAoC"}
|
package/src/engine/ecs/Entity.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { assert } from "../../core/assert.js";
|
|
2
2
|
import Signal from "../../core/events/signal/Signal.js";
|
|
3
|
-
import { isDefined } from "../../core/process/matcher/isDefined.js";
|
|
4
3
|
import { EntityFlags } from "./EntityFlags.js";
|
|
5
4
|
import { EntityReference } from "./EntityReference.js";
|
|
6
5
|
import { EventType } from "./EventType.js";
|
|
@@ -172,7 +171,9 @@ export class Entity {
|
|
|
172
171
|
for (let i = n - 1; i >= 0; i--) {
|
|
173
172
|
const component = elements[i];
|
|
174
173
|
|
|
175
|
-
|
|
174
|
+
const ComponentClass = Object.getPrototypeOf(component).constructor;
|
|
175
|
+
|
|
176
|
+
this.removeComponent(ComponentClass);
|
|
176
177
|
}
|
|
177
178
|
}
|
|
178
179
|
|
|
@@ -295,6 +296,8 @@ export class Entity {
|
|
|
295
296
|
* @param {*} [event]
|
|
296
297
|
*/
|
|
297
298
|
sendEvent(eventName, event) {
|
|
299
|
+
assert.isString(eventName, "eventName");
|
|
300
|
+
|
|
298
301
|
if (this.getFlag(EntityFlags.Built)) {
|
|
299
302
|
this.dataset.sendEvent(this.reference.id, eventName, event);
|
|
300
303
|
} else {
|
|
@@ -307,6 +310,8 @@ export class Entity {
|
|
|
307
310
|
* @param {string} eventName
|
|
308
311
|
*/
|
|
309
312
|
promiseEvent(eventName) {
|
|
313
|
+
assert.isString(eventName, "eventName");
|
|
314
|
+
|
|
310
315
|
return new Promise((resolve, reject) => {
|
|
311
316
|
|
|
312
317
|
const handle_event = () => {
|
|
@@ -331,6 +336,9 @@ export class Entity {
|
|
|
331
336
|
* @returns {Entity}
|
|
332
337
|
*/
|
|
333
338
|
addEventListener(eventName, listener, context) {
|
|
339
|
+
assert.isString(eventName, "eventName");
|
|
340
|
+
assert.isFunction(listener, "listener");
|
|
341
|
+
|
|
334
342
|
if (this.getFlag(EntityFlags.Built)) {
|
|
335
343
|
this.dataset.addEntityEventListener(this.reference.id, eventName, listener, context);
|
|
336
344
|
} else {
|
|
@@ -351,6 +359,9 @@ export class Entity {
|
|
|
351
359
|
* @returns {Entity}
|
|
352
360
|
*/
|
|
353
361
|
removeEventListener(eventName, listener, context) {
|
|
362
|
+
assert.isString(eventName, "eventName");
|
|
363
|
+
assert.isFunction(listener, "listener");
|
|
364
|
+
|
|
354
365
|
if (this.getFlag(EntityFlags.Built)) {
|
|
355
366
|
this.dataset.removeEntityEventListener(this.reference.id, eventName, listener, context);
|
|
356
367
|
} else {
|
|
@@ -502,9 +513,7 @@ export class Entity {
|
|
|
502
513
|
|
|
503
514
|
const r = new Entity();
|
|
504
515
|
|
|
505
|
-
dataset.
|
|
506
|
-
.filter(isDefined)
|
|
507
|
-
.forEach(r.add, r);
|
|
516
|
+
dataset.readEntityComponents(r.components, 0, entity);
|
|
508
517
|
|
|
509
518
|
r.setFlag(EntityFlags.Built);
|
|
510
519
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityComponentDataset.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/EntityComponentDataset.js"],"names":[],"mappings":"AAyHA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wDAfyB,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;;;;OAIG;IACH,mBAAgB;IAEhB;;;;OAIG;IACH,oBAAgB;IAEhB;;;;;;;OAOG;IACH,mBAAe;IAEf;;;OAGG;IACH,0BAFU,OAAO,MAAM,CAAC,CAEO;IAE/B;;;OAGG;IACH,0BAFU,OAAO,MAAM,CAAC,CAEO;IAG/B;;;;OAIG;IACH,+BAA4B;IAE5B;;;;OAIG;IACH,kCAA+B;IAE/B;;;OAGG;IACH,kBAAe;IAGf;;;;;;OAMG;IACH,mEAkCC;IAED;;;;;OAKG;IACH,kDAHW,OAAO,GACL,OAAO,CAqDnB;IAED;;;;;OAKG;IACH,qDAHW,OAAO,GACL,OAAO,CA6DnB;IAED;;;OAGG;IACH,kBAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,yBAFa,MAAM,CAIlB;IAED;;;;;OAKG;IACH,sBAJW,MAAM,qBACN,EAAE,SAmCZ;IAED
|
|
1
|
+
{"version":3,"file":"EntityComponentDataset.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/EntityComponentDataset.js"],"names":[],"mappings":"AAyHA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wDAfyB,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;;;;OAIG;IACH,mBAAgB;IAEhB;;;;OAIG;IACH,oBAAgB;IAEhB;;;;;;;OAOG;IACH,mBAAe;IAEf;;;OAGG;IACH,0BAFU,OAAO,MAAM,CAAC,CAEO;IAE/B;;;OAGG;IACH,0BAFU,OAAO,MAAM,CAAC,CAEO;IAG/B;;;;OAIG;IACH,+BAA4B;IAE5B;;;;OAIG;IACH,kCAA+B;IAE/B;;;OAGG;IACH,kBAAe;IAGf;;;;;;OAMG;IACH,mEAkCC;IAED;;;;;OAKG;IACH,kDAHW,OAAO,GACL,OAAO,CAqDnB;IAED;;;;;OAKG;IACH,qDAHW,OAAO,GACL,OAAO,CA6DnB;IAED;;;OAGG;IACH,kBAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,yBAFa,MAAM,CAIlB;IAED;;;;;OAKG;IACH,sBAJW,MAAM,qBACN,EAAE,SAmCZ;IAED;;;;;;;OAOG;IACH,6BANW,EAAE,iBACF,MAAM,aACN,MAAM,GACJ,MAAM,CAoClB;IAED;;;;;;;OAOG;IACH,4BAJW,MAAM,GACJ,EAAE,CA0Bd;IAED;;;;;OAKG;IACH,yBAJW,OAAO,GACL,IAAI,CA0LhB;IAED;;;;OAIG;IACH,mCAHW,OAAO,GACL,OAAO,CAenB;IAED;;;;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IAErD;;OAEG;IACH,iCAlZe,MAAM,wCAGJ,OAAO,CA+Y+B;IAvnBnD;;;OAGG;IACH,qBAFY,UAAU,MAAM,CAAC,CAY5B;CAqlBJ;mBA/gEkB,oCAAoC"}
|
|
@@ -476,11 +476,56 @@ export class EntityComponentDataset {
|
|
|
476
476
|
return result;
|
|
477
477
|
}
|
|
478
478
|
|
|
479
|
+
/**
|
|
480
|
+
*
|
|
481
|
+
* @param {[]} output
|
|
482
|
+
* @param {number} output_offset
|
|
483
|
+
* @param {number} entity_id
|
|
484
|
+
* @returns {number} how many components were written to the output
|
|
485
|
+
* @see getAllComponents
|
|
486
|
+
*/
|
|
487
|
+
readEntityComponents(
|
|
488
|
+
output,
|
|
489
|
+
output_offset,
|
|
490
|
+
entity_id
|
|
491
|
+
) {
|
|
492
|
+
|
|
493
|
+
assert.isNonNegativeInteger(entity_id, 'entity_id');
|
|
494
|
+
assert.ok(this.entityExists(entity_id), `Entity ${entity_id} doesn't exist`);
|
|
495
|
+
assert.isArray(output, "output");
|
|
496
|
+
assert.isNonNegativeInteger(output_offset, 'output_offset');
|
|
497
|
+
|
|
498
|
+
const componentTypeCount = this.componentTypeCount;
|
|
499
|
+
const occupancy_start = componentTypeCount * entity_id;
|
|
500
|
+
const occupancy_end = occupancy_start + componentTypeCount;
|
|
501
|
+
|
|
502
|
+
const occupancy = this.componentOccupancy;
|
|
503
|
+
|
|
504
|
+
let offset = output_offset;
|
|
505
|
+
|
|
506
|
+
for (
|
|
507
|
+
let i = occupancy.nextSetBit(occupancy_start);
|
|
508
|
+
i < occupancy_end && i !== -1;
|
|
509
|
+
i = occupancy.nextSetBit(i + 1)
|
|
510
|
+
) {
|
|
511
|
+
const componentIndex = i % componentTypeCount;
|
|
512
|
+
|
|
513
|
+
const component = this.components[componentIndex][entity_id];
|
|
514
|
+
|
|
515
|
+
output[offset++] = component;
|
|
516
|
+
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
return offset - output_offset;
|
|
520
|
+
}
|
|
521
|
+
|
|
479
522
|
/**
|
|
480
523
|
* Get all components associated with a given entity.
|
|
481
524
|
* Note that this method allocates. If performance is important - prefer alternatives.
|
|
525
|
+
* Prefer to use {@link readEntityComponents} for performance reasons.
|
|
482
526
|
* @param {number} entity_id
|
|
483
527
|
* @returns {[]} all components attached to the entity, array is not compacted
|
|
528
|
+
* @see readEntityComponents
|
|
484
529
|
*/
|
|
485
530
|
getAllComponents(entity_id) {
|
|
486
531
|
assert.isNonNegativeInteger(entity_id, 'entity_id');
|
|
@@ -1775,8 +1820,8 @@ export class EntityComponentDataset {
|
|
|
1775
1820
|
|
|
1776
1821
|
/**
|
|
1777
1822
|
* Notifies every component of specified entity with given event
|
|
1778
|
-
* @param {
|
|
1779
|
-
* @param {
|
|
1823
|
+
* @param {number} entity
|
|
1824
|
+
* @param {string} name event name
|
|
1780
1825
|
* @param {Object} [event=undefined]
|
|
1781
1826
|
* @returns {void}
|
|
1782
1827
|
* @see addEntityEventListener
|
|
@@ -1785,6 +1830,7 @@ export class EntityComponentDataset {
|
|
|
1785
1830
|
// console.log("sendEvent", entity, name, event);
|
|
1786
1831
|
|
|
1787
1832
|
assert.isString(name, "name");
|
|
1833
|
+
assert.isNonNegativeInteger(entity, "entity");
|
|
1788
1834
|
|
|
1789
1835
|
dispatchEntityEventListeners(this.__entityEventListeners, entity, name, event);
|
|
1790
1836
|
|
|
@@ -10,7 +10,7 @@ import { EntityComponentDataset } from "./EntityComponentDataset.js";
|
|
|
10
10
|
import { EntityObserver } from "./EntityObserver.js";
|
|
11
11
|
import { System, SystemState } from "./System.js";
|
|
12
12
|
import { computeSystemComponentDependencyGraph } from "./system/computeSystemComponentDependencyGraph.js";
|
|
13
|
-
import {
|
|
13
|
+
import { system_validate_class } from "./system_validate_class.js";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* @readonly
|
|
@@ -476,7 +476,7 @@ export class EntityManager {
|
|
|
476
476
|
|
|
477
477
|
|
|
478
478
|
try {
|
|
479
|
-
|
|
479
|
+
system_validate_class(system);
|
|
480
480
|
} catch (e) {
|
|
481
481
|
console.error(`Validation of '${computeSystemName(system)}' failed : `, e, system);
|
|
482
482
|
}
|
|
@@ -674,7 +674,7 @@ export class EntityManager {
|
|
|
674
674
|
};
|
|
675
675
|
|
|
676
676
|
// Link EntityManager
|
|
677
|
-
if (system.entityManager === null) {
|
|
677
|
+
if (system.entityManager === null || system.entityManager === undefined) {
|
|
678
678
|
system.entityManager = this;
|
|
679
679
|
} else if (system.entityManager !== this) {
|
|
680
680
|
throw new Error(`System is bound to another EntityManager`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityReference.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/EntityReference.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AACH;
|
|
1
|
+
{"version":3,"file":"EntityReference.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/EntityReference.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AACH;IAwHI;;;;;OAKG;IACH,gBAJW,MAAM,cACN,MAAM,GACL,eAAe,CAQ1B;IAED;;;;;OAKG;IACH,6CAHW,MAAM,GACJ,eAAe,CAQ3B;IAhJD;;;;OAIG;IACH,IAFU,MAAM,CAET;IAEP;;;;;OAKG;IACH,YAFU,MAAM,CAED;IAEf;;;OAGG;IACH,YAFW,eAAe,QAOzB;IAED;;;OAGG;IACH,SAFa,eAAe,CAQ3B;IAED;;;OAGG;IACH,QAFY,MAAM,CAIjB;IAED;;;;OAIG;IACH,cAHW,eAAe,GACd,OAAO,CAMlB;IAED;;;;OAIG;IACH,qCAFa,OAAO,CAYnB;IAED;;;;;OAKG;IACH,sCAFa,OAAO,CASnB;IAED;;;;OAIG;IACH,0CAFW,MAAM,QAShB;IAED;;;;OAIG;IACH,SAHW,MAAM,cACN,MAAM,QAUhB;IA+BL;;;OAGG;IACH,4BAFU,OAAO,CAE0B;CAN1C;;cAWS,eAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"System.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/System.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH;IAEI;;;;;OAKG;IACH,uCAAqB;IAErB;;;;OAIG;IACH,oBAA+C;IAE/C;;;;;;;OAOG;IACH,6BAAkB;IAElB;;;;;;;;;;OAUG;IACH,0BAFU,6BAA6B,CAElB;IAGrB;;OAEG;IACH,mCAcC;IAED;;;;;OAKG;IACH,oCAFY,MAAM,CA8BjB;IAED;;;;;;OAMG;IACH,uCAHa,QAAQ,IAAI,CAAC,CAKzB;IAED;;;;;;;OAOG;IACH,wCAHa,QAAQ,IAAI,CAAC,CAKzB;IAGD;;;;OAIG;IACH,wCAEC;IAED;;;;OAIG;IACH,0CAEC;IAED;;;;;;;;;;OAUG;IACH,6DAEC;IAED;;;;;;;;;;OAUG;IACH,6DAEC;IAIL;;;OAGG;IACH,mBAFU,OAAO,CAEQ;IAEzB;;;;OAIG;IACH,yBAA4B;IAG5B;;;;;;OAMG;IACH,oBAAuB;CAvBtB
|
|
1
|
+
{"version":3,"file":"System.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/System.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH;IAEI;;;;;OAKG;IACH,uCAAqB;IAErB;;;;OAIG;IACH,oBAA+C;IAE/C;;;;;;;OAOG;IACH,6BAAkB;IAElB;;;;;;;;;;OAUG;IACH,0BAFU,6BAA6B,CAElB;IAGrB;;OAEG;IACH,mCAcC;IAED;;;;;OAKG;IACH,oCAFY,MAAM,CA8BjB;IAED;;;;;;OAMG;IACH,uCAHa,QAAQ,IAAI,CAAC,CAKzB;IAED;;;;;;;OAOG;IACH,wCAHa,QAAQ,IAAI,CAAC,CAKzB;IAGD;;;;OAIG;IACH,wCAEC;IAED;;;;OAIG;IACH,0CAEC;IAED;;;;;;;;;;OAUG;IACH,6DAEC;IAED;;;;;;;;;;OAUG;IACH,6DAEC;IAIL;;;OAGG;IACH,mBAFU,OAAO,CAEQ;IAEzB;;;;OAIG;IACH,yBAA4B;IAG5B;;;;;;OAMG;IACH,oBAAuB;CAvBtB;0BA2BS,MAAM;;;;;;;;qBArOK,6BAA6B"}
|
package/src/engine/ecs/System.js
CHANGED
|
@@ -174,7 +174,7 @@ export class System {
|
|
|
174
174
|
|
|
175
175
|
/**
|
|
176
176
|
* Invoked when a dataset is attached to the system, this happens before any entities are linked.
|
|
177
|
-
* Happens as a result of {@link EntityManager.
|
|
177
|
+
* Happens as a result of {@link EntityManager.attachDataset}.
|
|
178
178
|
* It is generally advised *NOT* to modify the dataset here.
|
|
179
179
|
* Managed by {@link EntityManager}'s lifecycle. Do not call this manually.
|
|
180
180
|
*
|
|
@@ -189,7 +189,7 @@ export class System {
|
|
|
189
189
|
|
|
190
190
|
/**
|
|
191
191
|
* Invoked when dataset is about to be detached from the system, this happens after all entities have been unlinked.
|
|
192
|
-
* Happens as a result of {@link EntityManager.
|
|
192
|
+
* Happens as a result of {@link EntityManager.detachDataset}.
|
|
193
193
|
* It is generally advised *NOT* to modify the dataset here.
|
|
194
194
|
* Managed by {@link EntityManager}'s lifecycle. Do not call this manually.
|
|
195
195
|
*
|
|
@@ -223,29 +223,10 @@ System.prototype.fixedUpdate = noop; // by assigning NO-OP we enable a simple ch
|
|
|
223
223
|
* Note that this time step can vary depending on system conditions and hardware we are running on.
|
|
224
224
|
* It is generally safe to assume that this update will happen once per frame, but it is not guaranteed.
|
|
225
225
|
* Also, note that when the application window/tab is suspended, the next update step can have a very large value.
|
|
226
|
-
* @param {number} timeDelta
|
|
226
|
+
* @param {number} timeDelta in seconds
|
|
227
227
|
*/
|
|
228
228
|
System.prototype.update = noop; // by assigning NO-OP we enable a simple check, whether running the update would be useful
|
|
229
229
|
|
|
230
|
-
Object.defineProperties(System.prototype, {
|
|
231
|
-
/**
|
|
232
|
-
* @deprecated
|
|
233
|
-
*/
|
|
234
|
-
componentClass: {
|
|
235
|
-
configurable: true,
|
|
236
|
-
/**
|
|
237
|
-
* @deprecated
|
|
238
|
-
* @returns {Class<C>}
|
|
239
|
-
*/
|
|
240
|
-
get() {
|
|
241
|
-
console.warn(`componentClass property is deprecated and should not be used`);
|
|
242
|
-
return null;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
});
|
|
248
|
-
|
|
249
230
|
/**
|
|
250
231
|
* @readonly
|
|
251
232
|
* @enum {number}
|
|
@@ -273,9 +254,3 @@ export const SystemState = {
|
|
|
273
254
|
STOPPED: 4
|
|
274
255
|
}
|
|
275
256
|
|
|
276
|
-
/**
|
|
277
|
-
* @readonly
|
|
278
|
-
* @deprecated use {@link SystemState} directly instead
|
|
279
|
-
*/
|
|
280
|
-
System.State = SystemState;
|
|
281
|
-
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
* @param {System} system
|
|
4
4
|
* @throws {Error} if the system fails validation
|
|
5
5
|
*/
|
|
6
|
-
export function
|
|
6
|
+
export function system_validate_class(system: System<any, any, any, any, any>): void;
|
|
7
7
|
import { System } from "./System.js";
|
|
8
|
-
//# sourceMappingURL=
|
|
8
|
+
//# sourceMappingURL=system_validate_class.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system_validate_class.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/system_validate_class.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,qFA0FC;uBAjGsB,aAAa"}
|
|
@@ -5,7 +5,7 @@ import { System } from "./System.js";
|
|
|
5
5
|
* @param {System} system
|
|
6
6
|
* @throws {Error} if the system fails validation
|
|
7
7
|
*/
|
|
8
|
-
export function
|
|
8
|
+
export function system_validate_class(system) {
|
|
9
9
|
if (system === undefined) {
|
|
10
10
|
throw new Error("System is undefined");
|
|
11
11
|
}
|
|
@@ -154,7 +154,7 @@ class SceneManager {
|
|
|
154
154
|
|
|
155
155
|
if (this.#current_scene !== null) {
|
|
156
156
|
this.#current_scene.active.set(false);
|
|
157
|
-
this.#entity_manager.
|
|
157
|
+
this.#entity_manager.detachDataset();
|
|
158
158
|
|
|
159
159
|
this.#current_scene = null;
|
|
160
160
|
}
|
|
@@ -191,7 +191,7 @@ class SceneManager {
|
|
|
191
191
|
scene.active.set(false);
|
|
192
192
|
|
|
193
193
|
if (this.#entity_manager.dataset === scene.dataset) {
|
|
194
|
-
this.#entity_manager.
|
|
194
|
+
this.#entity_manager.detachDataset();
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
//remove speed modifiers
|
|
@@ -222,7 +222,7 @@ class SceneManager {
|
|
|
222
222
|
|
|
223
223
|
const em = this.#entity_manager;
|
|
224
224
|
|
|
225
|
-
em.
|
|
225
|
+
em.attachDataset(scene.dataset);
|
|
226
226
|
|
|
227
227
|
scene.active.set(true);
|
|
228
228
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validateSystem.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/validateSystem.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,8EA0FC;uBAjGsB,aAAa"}
|