@dcl/ecs 7.0.2 → 7.0.3-3584826534.commit-9df0cb7
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.
|
@@ -11,7 +11,6 @@ export declare namespace EntityUtils {
|
|
|
11
11
|
const RESERVED_ENTITIES_RANGE: EntityRange;
|
|
12
12
|
const STATIC_ENTITIES_RANGE: EntityRange;
|
|
13
13
|
const DYNAMIC_ENTITIES_RANGE: EntityRange;
|
|
14
|
-
function isDynamicEntity(entity: Entity): boolean;
|
|
15
14
|
function isStaticEntity(entity: Entity): boolean;
|
|
16
15
|
function isReservedEntity(entity: Entity): boolean;
|
|
17
16
|
}
|
|
@@ -9,7 +9,8 @@ export var EntityUtils;
|
|
|
9
9
|
];
|
|
10
10
|
EntityUtils.STATIC_ENTITIES_RANGE = [
|
|
11
11
|
EntityUtils.RESERVED_STATIC_ENTITIES,
|
|
12
|
-
EntityUtils.
|
|
12
|
+
EntityUtils.MAX_ENTITIES
|
|
13
|
+
// DYNAMIC_ENTITIES_START_AT - 1
|
|
13
14
|
];
|
|
14
15
|
EntityUtils.DYNAMIC_ENTITIES_RANGE = [
|
|
15
16
|
EntityUtils.DYNAMIC_ENTITIES_START_AT,
|
|
@@ -18,6 +19,7 @@ export var EntityUtils;
|
|
|
18
19
|
function isInRange(entity, range) {
|
|
19
20
|
return entity >= range[0] && entity <= range[1];
|
|
20
21
|
}
|
|
22
|
+
// @internal
|
|
21
23
|
function isDynamicEntity(entity) {
|
|
22
24
|
return isInRange(entity, EntityUtils.DYNAMIC_ENTITIES_RANGE);
|
|
23
25
|
}
|
package/dist/engine/entity.js
CHANGED
|
@@ -4,7 +4,11 @@ export function EntityContainer() {
|
|
|
4
4
|
const dynamicEntity = Entity(EntityUtils.DYNAMIC_ENTITIES_RANGE);
|
|
5
5
|
return {
|
|
6
6
|
generateEntity(dynamic = false) {
|
|
7
|
+
/* istanbul ignore next */
|
|
7
8
|
if (dynamic) {
|
|
9
|
+
// Dynamic entities are not being used, but since we dont know the future of the dynamic entities
|
|
10
|
+
// I prefer to comment the code instead of removing all the logic
|
|
11
|
+
/* istanbul ignore next */
|
|
8
12
|
return dynamicEntity.generateEntity();
|
|
9
13
|
}
|
|
10
14
|
else {
|
package/dist/engine/index.js
CHANGED
|
@@ -17,17 +17,13 @@ function preEngine() {
|
|
|
17
17
|
function removeSystem(selector) {
|
|
18
18
|
return systems.remove(selector);
|
|
19
19
|
}
|
|
20
|
-
function addEntity(
|
|
21
|
-
|
|
22
|
-
const entity = entityContainer.generateEntity(dynamic);
|
|
20
|
+
function addEntity() {
|
|
21
|
+
const entity = entityContainer.generateEntity();
|
|
23
22
|
return entity;
|
|
24
23
|
}
|
|
25
24
|
function entityExists(entity) {
|
|
26
25
|
return entityContainer.entityExists(entity);
|
|
27
26
|
}
|
|
28
|
-
function addDynamicEntity() {
|
|
29
|
-
return addEntity(true);
|
|
30
|
-
}
|
|
31
27
|
function removeEntity(entity) {
|
|
32
28
|
for (const [, component] of componentsDefinition) {
|
|
33
29
|
if (component.has(entity)) {
|
|
@@ -91,7 +87,6 @@ function preEngine() {
|
|
|
91
87
|
entityExists,
|
|
92
88
|
componentsDefinition,
|
|
93
89
|
addEntity,
|
|
94
|
-
addDynamicEntity,
|
|
95
90
|
removeEntity,
|
|
96
91
|
addSystem,
|
|
97
92
|
getSystems,
|
|
@@ -157,7 +152,6 @@ export function Engine() {
|
|
|
157
152
|
}
|
|
158
153
|
return {
|
|
159
154
|
addEntity: engine.addEntity,
|
|
160
|
-
addDynamicEntity: engine.addDynamicEntity,
|
|
161
155
|
removeEntity: engine.removeEntity,
|
|
162
156
|
removeEntityWithChildren,
|
|
163
157
|
addSystem: engine.addSystem,
|
package/dist/engine/types.d.ts
CHANGED
|
@@ -26,10 +26,6 @@ export declare type IEngine = {
|
|
|
26
26
|
* @returns the next entity unused
|
|
27
27
|
*/
|
|
28
28
|
addEntity(dynamic?: boolean): Entity;
|
|
29
|
-
/**
|
|
30
|
-
* An alias of engine.addEntity(true)
|
|
31
|
-
*/
|
|
32
|
-
addDynamicEntity(): Entity;
|
|
33
29
|
/**
|
|
34
30
|
* Remove all components of an entity
|
|
35
31
|
* @param entity - entity
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcl/ecs",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.3-3584826534.commit-9df0cb7",
|
|
4
4
|
"description": "Decentraland ECS",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"typings": "./dist/index.d.ts",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"dist",
|
|
36
36
|
"etc"
|
|
37
37
|
],
|
|
38
|
-
"commit": "
|
|
38
|
+
"commit": "9df0cb71b0206779b6ac83e6e8a06cfea438de2c"
|
|
39
39
|
}
|