@dcl/ecs 7.27.1-33751406308.commit-24d6624 → 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
|
-
|
|
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 ##
|
|
@@ -7,8 +7,11 @@ export var DeleteEntityNetwork;
|
|
|
7
7
|
(function (DeleteEntityNetwork) {
|
|
8
8
|
DeleteEntityNetwork.MESSAGE_HEADER_LENGTH = 8;
|
|
9
9
|
function write(entity, networkId, buf) {
|
|
10
|
-
// Write CrdtMessage header
|
|
11
|
-
|
|
10
|
+
// Write CrdtMessage header. The body is the entity and the network id, so
|
|
11
|
+
// it is MESSAGE_HEADER_LENGTH long: declaring 4 described a message four
|
|
12
|
+
// bytes shorter than the one being written, and anything that skips by the
|
|
13
|
+
// declared length landed in the middle of it.
|
|
14
|
+
buf.writeUint32(CRDT_MESSAGE_HEADER_LENGTH + DeleteEntityNetwork.MESSAGE_HEADER_LENGTH);
|
|
12
15
|
buf.writeUint32(CrdtMessageType.DELETE_ENTITY_NETWORK);
|
|
13
16
|
// body
|
|
14
17
|
buf.writeUint32(entity);
|
|
@@ -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
|
-
|
|
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 ##
|
|
@@ -10,8 +10,11 @@ var DeleteEntityNetwork;
|
|
|
10
10
|
(function (DeleteEntityNetwork) {
|
|
11
11
|
DeleteEntityNetwork.MESSAGE_HEADER_LENGTH = 8;
|
|
12
12
|
function write(entity, networkId, buf) {
|
|
13
|
-
// Write CrdtMessage header
|
|
14
|
-
|
|
13
|
+
// Write CrdtMessage header. The body is the entity and the network id, so
|
|
14
|
+
// it is MESSAGE_HEADER_LENGTH long: declaring 4 described a message four
|
|
15
|
+
// bytes shorter than the one being written, and anything that skips by the
|
|
16
|
+
// declared length landed in the middle of it.
|
|
17
|
+
buf.writeUint32(types_1.CRDT_MESSAGE_HEADER_LENGTH + DeleteEntityNetwork.MESSAGE_HEADER_LENGTH);
|
|
15
18
|
buf.writeUint32(types_1.CrdtMessageType.DELETE_ENTITY_NETWORK);
|
|
16
19
|
// body
|
|
17
20
|
buf.writeUint32(entity);
|
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-
|
|
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": "
|
|
37
|
+
"commit": "cb87612beaaddb89a3837422fbb966c67f91c4ed"
|
|
38
38
|
}
|