@dcl/ecs 7.27.1-33752500148.commit-5ae3ef7 → 7.27.1-33755014733.commit-cb87612

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.
@@ -56,7 +56,9 @@ export function getComponentDefinition(engine, component) {
56
56
  */
57
57
  export function getEntityMapping(engine, compositeEntity, mappedEntities, { entityMapping }) {
58
58
  const existingEntity = mappedEntities.get(compositeEntity);
59
- if (existingEntity) {
59
+ // RootEntity is 0, so a mapping onto it is falsy. Testing the value here made
60
+ // an already-mapped entity look unmapped and allocated a second one.
61
+ if (existingEntity !== undefined) {
60
62
  return existingEntity;
61
63
  }
62
64
  if (entityMapping?.type === EntityMappingMode.EMM_DIRECT_MAPPING) {
@@ -93,7 +95,7 @@ export function instanceComposite(engine, compositeResource, compositeProvider,
93
95
  // First entity that I want to map, the root entity from the composite to the target entity in the engine
94
96
  // If there is no `rootEntity` passed, we assign one from `getNextAvailableEntity`
95
97
  const compositeRootEntity = rootEntity ?? getCompositeEntity(0);
96
- if (rootEntity) {
98
+ if (rootEntity !== undefined) {
97
99
  mappedEntities.set(0, rootEntity);
98
100
  }
99
101
  // ## 2 ##
@@ -84,7 +84,9 @@ exports.getComponentDefinition = getComponentDefinition;
84
84
  */
85
85
  function getEntityMapping(engine, compositeEntity, mappedEntities, { entityMapping }) {
86
86
  const existingEntity = mappedEntities.get(compositeEntity);
87
- if (existingEntity) {
87
+ // RootEntity is 0, so a mapping onto it is falsy. Testing the value here made
88
+ // an already-mapped entity look unmapped and allocated a second one.
89
+ if (existingEntity !== undefined) {
88
90
  return existingEntity;
89
91
  }
90
92
  if (entityMapping?.type === EntityMappingMode.EMM_DIRECT_MAPPING) {
@@ -122,7 +124,7 @@ function instanceComposite(engine, compositeResource, compositeProvider, options
122
124
  // First entity that I want to map, the root entity from the composite to the target entity in the engine
123
125
  // If there is no `rootEntity` passed, we assign one from `getNextAvailableEntity`
124
126
  const compositeRootEntity = rootEntity ?? getCompositeEntity(0);
125
- if (rootEntity) {
127
+ if (rootEntity !== undefined) {
126
128
  mappedEntities.set(0, rootEntity);
127
129
  }
128
130
  // ## 2 ##
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dcl/ecs",
3
3
  "description": "Decentraland ECS",
4
- "version": "7.27.1-33752500148.commit-5ae3ef7",
4
+ "version": "7.27.1-33755014733.commit-cb87612",
5
5
  "author": "DCL",
6
6
  "bugs": "https://github.com/decentraland/ecs/issues",
7
7
  "files": [
@@ -34,5 +34,5 @@
34
34
  "dependencies": {},
35
35
  "types": "./dist/index.d.ts",
36
36
  "typings": "./dist/index.d.ts",
37
- "commit": "5ae3ef7c921887bc7c78d88284f22fc91b1be4d4"
37
+ "commit": "cb87612beaaddb89a3837422fbb966c67f91c4ed"
38
38
  }