@dcl/ecs 7.3.15-6200631111.commit-2a2ff73 → 7.3.15-6201308535.commit-dd17bb7
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/dist/components/generated/AvatarBase.gen.d.ts +1 -0
- package/dist/components/generated/AvatarBase.gen.js +25 -0
- package/dist/components/generated/AvatarEmoteCommand.gen.d.ts +1 -0
- package/dist/components/generated/AvatarEmoteCommand.gen.js +25 -0
- package/dist/components/generated/AvatarEquippedData.gen.d.ts +1 -0
- package/dist/components/generated/AvatarEquippedData.gen.js +25 -0
- package/dist/components/generated/PlayerIdentityData.gen.d.ts +1 -0
- package/dist/components/generated/PlayerIdentityData.gen.js +25 -0
- package/dist/components/generated/component-names.gen.js +4 -0
- package/dist/components/generated/pb/decentraland/sdk/components/avatar_base.gen.d.ts +20 -0
- package/dist/components/generated/pb/decentraland/sdk/components/avatar_base.gen.js +78 -0
- package/dist/components/generated/pb/decentraland/sdk/components/avatar_emote_command.gen.d.ts +32 -0
- package/dist/components/generated/pb/decentraland/sdk/components/avatar_emote_command.gen.js +88 -0
- package/dist/components/generated/pb/decentraland/sdk/components/avatar_equipped_data.gen.d.ts +20 -0
- package/dist/components/generated/pb/decentraland/sdk/components/avatar_equipped_data.gen.js +50 -0
- package/dist/components/generated/pb/decentraland/sdk/components/player_identity_data.gen.d.ts +21 -0
- package/dist/components/generated/pb/decentraland/sdk/components/player_identity_data.gen.js +50 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.js +6 -0
- package/dist/components/manual/SyncComponents.d.ts +9 -0
- package/dist/components/manual/SyncComponents.js +8 -0
- package/dist/components/types.d.ts +1 -0
- package/dist/engine/component.d.ts +1 -1
- package/dist/engine/entity.d.ts +20 -1
- package/dist/engine/entity.js +48 -11
- package/dist/engine/grow-only-value-set-component-definition.js +3 -1
- package/dist/engine/index.js +19 -2
- package/dist/engine/lww-element-set-component-definition.d.ts +1 -1
- package/dist/engine/lww-element-set-component-definition.js +8 -1
- package/dist/engine/types.d.ts +13 -2
- package/dist/index.d.ts +7 -1
- package/dist/index.js +6 -0
- package/dist/systems/crdt/index.js +3 -1
- package/dist-cjs/components/generated/AvatarBase.gen.d.ts +1 -0
- package/dist-cjs/components/generated/AvatarBase.gen.js +28 -0
- package/dist-cjs/components/generated/AvatarEmoteCommand.gen.d.ts +1 -0
- package/dist-cjs/components/generated/AvatarEmoteCommand.gen.js +28 -0
- package/dist-cjs/components/generated/AvatarEquippedData.gen.d.ts +1 -0
- package/dist-cjs/components/generated/AvatarEquippedData.gen.js +28 -0
- package/dist-cjs/components/generated/PlayerIdentityData.gen.d.ts +1 -0
- package/dist-cjs/components/generated/PlayerIdentityData.gen.js +28 -0
- package/dist-cjs/components/generated/component-names.gen.js +4 -0
- package/dist-cjs/components/generated/pb/decentraland/sdk/components/avatar_base.gen.d.ts +20 -0
- package/dist-cjs/components/generated/pb/decentraland/sdk/components/avatar_base.gen.js +84 -0
- package/dist-cjs/components/generated/pb/decentraland/sdk/components/avatar_emote_command.gen.d.ts +32 -0
- package/dist-cjs/components/generated/pb/decentraland/sdk/components/avatar_emote_command.gen.js +94 -0
- package/dist-cjs/components/generated/pb/decentraland/sdk/components/avatar_equipped_data.gen.d.ts +20 -0
- package/dist-cjs/components/generated/pb/decentraland/sdk/components/avatar_equipped_data.gen.js +56 -0
- package/dist-cjs/components/generated/pb/decentraland/sdk/components/player_identity_data.gen.d.ts +21 -0
- package/dist-cjs/components/generated/pb/decentraland/sdk/components/player_identity_data.gen.js +56 -0
- package/dist-cjs/components/index.d.ts +5 -0
- package/dist-cjs/components/index.js +8 -1
- package/dist-cjs/components/manual/SyncComponents.d.ts +9 -0
- package/dist-cjs/components/manual/SyncComponents.js +10 -0
- package/dist-cjs/components/types.d.ts +1 -0
- package/dist-cjs/engine/component.d.ts +1 -1
- package/dist-cjs/engine/entity.d.ts +20 -1
- package/dist-cjs/engine/entity.js +49 -12
- package/dist-cjs/engine/grow-only-value-set-component-definition.js +3 -1
- package/dist-cjs/engine/index.js +19 -2
- package/dist-cjs/engine/lww-element-set-component-definition.d.ts +1 -1
- package/dist-cjs/engine/lww-element-set-component-definition.js +8 -1
- package/dist-cjs/engine/types.d.ts +13 -2
- package/dist-cjs/index.d.ts +7 -1
- package/dist-cjs/index.js +7 -1
- package/dist-cjs/systems/crdt/index.js +3 -1
- package/package.json +2 -2
package/dist/engine/entity.js
CHANGED
|
@@ -11,15 +11,16 @@ export const AMOUNT_VERSION_AVAILABLE = MAX_U16 + 1;
|
|
|
11
11
|
// This type matches with @dcl/crdt entity type.
|
|
12
12
|
/**
|
|
13
13
|
* @internal
|
|
14
|
-
* This first 512 entities are reserved by the renderer
|
|
15
14
|
*/
|
|
16
|
-
export const
|
|
15
|
+
export const MAX_ENTITY_NUMBER = MAX_U16;
|
|
17
16
|
/**
|
|
18
|
-
*
|
|
17
|
+
* This first 512 entities are reserved by the renderer
|
|
19
18
|
*/
|
|
20
|
-
export const
|
|
19
|
+
export const RESERVED_STATIC_ENTITIES = 512;
|
|
20
|
+
// Max amount of local entities that can be created
|
|
21
|
+
export const RESERVED_LOCAL_ENTITIES = MAX_ENTITY_NUMBER;
|
|
21
22
|
/**
|
|
22
|
-
* @
|
|
23
|
+
* @public
|
|
23
24
|
*/
|
|
24
25
|
export var EntityUtils;
|
|
25
26
|
(function (EntityUtils) {
|
|
@@ -61,15 +62,32 @@ export var EntityState;
|
|
|
61
62
|
* @internal
|
|
62
63
|
*/
|
|
63
64
|
export function EntityContainer() {
|
|
65
|
+
// Local entities counter
|
|
64
66
|
let entityCounter = RESERVED_STATIC_ENTITIES;
|
|
67
|
+
// Network entities counter
|
|
68
|
+
let networkEntityCounter;
|
|
69
|
+
// Network entities range that can be created by the user
|
|
70
|
+
let networkedEntitiesRange;
|
|
65
71
|
const usedEntities = new Set();
|
|
66
72
|
let toRemoveEntities = [];
|
|
67
73
|
const removedEntities = createVersionGSet();
|
|
68
|
-
|
|
74
|
+
let localEntitiesAvailable = RESERVED_LOCAL_ENTITIES;
|
|
75
|
+
function setNetworkEntitiesRange(reservedLocalEntities, range) {
|
|
76
|
+
localEntitiesAvailable = reservedLocalEntities;
|
|
77
|
+
networkedEntitiesRange = range;
|
|
78
|
+
networkEntityCounter = range[0];
|
|
79
|
+
}
|
|
80
|
+
function generateNewEntity(networked) {
|
|
69
81
|
if (entityCounter > MAX_ENTITY_NUMBER - 1) {
|
|
70
82
|
throw new Error(`It fails trying to generate an entity out of range ${MAX_ENTITY_NUMBER}.`);
|
|
71
83
|
}
|
|
72
|
-
|
|
84
|
+
if (networked && networkEntityCounter > networkedEntitiesRange[1]) {
|
|
85
|
+
throw new Error(`Max amount of network entities reached ${networkedEntitiesRange[1]} `);
|
|
86
|
+
}
|
|
87
|
+
if (!networked && entityCounter >= localEntitiesAvailable) {
|
|
88
|
+
throw new Error(`Max amount of local entities reached ${localEntitiesAvailable}`);
|
|
89
|
+
}
|
|
90
|
+
const entityNumber = networked ? networkEntityCounter++ : entityCounter++;
|
|
73
91
|
const entityVersion = removedEntities.getMap().has(entityNumber)
|
|
74
92
|
? removedEntities.getMap().get(entityNumber) + 1
|
|
75
93
|
: 0;
|
|
@@ -80,13 +98,31 @@ export function EntityContainer() {
|
|
|
80
98
|
usedEntities.add(entity);
|
|
81
99
|
return entity;
|
|
82
100
|
}
|
|
83
|
-
function generateEntity() {
|
|
101
|
+
function generateEntity(networked) {
|
|
102
|
+
if (networked && !networkedEntitiesRange) {
|
|
103
|
+
throw new Error('Network entities ranged not initialized. Connect to a CRDT Server');
|
|
104
|
+
}
|
|
105
|
+
const usedNetworkSize = (networkedEntitiesRange &&
|
|
106
|
+
[...usedEntities.values()].filter(($) => {
|
|
107
|
+
const [entityId] = EntityUtils.fromEntityId($);
|
|
108
|
+
return entityId >= networkedEntitiesRange[0] && entityId <= networkedEntitiesRange[1];
|
|
109
|
+
}).length) ??
|
|
110
|
+
0;
|
|
111
|
+
const usedSize = usedEntities.size - usedNetworkSize;
|
|
84
112
|
// If all entities until `entityCounter` are being used, we need to generate another one
|
|
85
|
-
if (
|
|
86
|
-
return generateNewEntity();
|
|
113
|
+
if (!networked && usedSize + RESERVED_STATIC_ENTITIES >= entityCounter) {
|
|
114
|
+
return generateNewEntity(networked);
|
|
115
|
+
}
|
|
116
|
+
// If all entities until `entityCounter` are being used, we need to generate another one
|
|
117
|
+
if (networked && usedNetworkSize + networkedEntitiesRange[0] >= networkEntityCounter) {
|
|
118
|
+
return generateNewEntity(networked);
|
|
87
119
|
}
|
|
88
120
|
for (const [number, version] of removedEntities.getMap()) {
|
|
89
121
|
if (version < MAX_U16) {
|
|
122
|
+
if (networked && (number < networkedEntitiesRange[0] || number > networkedEntitiesRange[1]))
|
|
123
|
+
continue;
|
|
124
|
+
if (!networked && number >= localEntitiesAvailable)
|
|
125
|
+
continue;
|
|
90
126
|
const entity = EntityUtils.toEntityId(number, version + 1);
|
|
91
127
|
// If the entity is not being used, we can re-use it
|
|
92
128
|
// If the entity was removed in this tick, we're not counting for the usedEntities, but we have it in the toRemoveEntityArray
|
|
@@ -96,7 +132,7 @@ export function EntityContainer() {
|
|
|
96
132
|
}
|
|
97
133
|
}
|
|
98
134
|
}
|
|
99
|
-
return generateNewEntity();
|
|
135
|
+
return generateNewEntity(networked);
|
|
100
136
|
}
|
|
101
137
|
function removeEntity(entity) {
|
|
102
138
|
if (entity < RESERVED_STATIC_ENTITIES)
|
|
@@ -161,6 +197,7 @@ export function EntityContainer() {
|
|
|
161
197
|
return EntityState.Unknown;
|
|
162
198
|
}
|
|
163
199
|
return {
|
|
200
|
+
setNetworkEntitiesRange,
|
|
164
201
|
generateEntity,
|
|
165
202
|
removeEntity,
|
|
166
203
|
getExistingEntities() {
|
|
@@ -127,8 +127,10 @@ export function createValueSetComponentDefinitionFromSchema(componentName, compo
|
|
|
127
127
|
}
|
|
128
128
|
return [null, undefined];
|
|
129
129
|
},
|
|
130
|
-
dumpCrdtStateToBuffer: function (buffer) {
|
|
130
|
+
dumpCrdtStateToBuffer: function (buffer, filterEntity) {
|
|
131
131
|
for (const [entity, { raw }] of data) {
|
|
132
|
+
if (filterEntity && !filterEntity(entity))
|
|
133
|
+
continue;
|
|
132
134
|
for (const it of raw) {
|
|
133
135
|
const buf = new ReadWriteByteBuffer();
|
|
134
136
|
schema.serialize(it.value, buf);
|
package/dist/engine/index.js
CHANGED
|
@@ -15,6 +15,7 @@ function preEngine() {
|
|
|
15
15
|
const entityContainer = EntityContainer();
|
|
16
16
|
const componentsDefinition = new Map();
|
|
17
17
|
const systems = SystemContainer();
|
|
18
|
+
let networkManager;
|
|
18
19
|
let sealed = false;
|
|
19
20
|
function addSystem(fn, priority = SYSTEMS_REGULAR_PRIORITY, name) {
|
|
20
21
|
systems.add(fn, priority, name);
|
|
@@ -22,6 +23,18 @@ function preEngine() {
|
|
|
22
23
|
function removeSystem(selector) {
|
|
23
24
|
return systems.remove(selector);
|
|
24
25
|
}
|
|
26
|
+
function getNetworkManager() {
|
|
27
|
+
if (!networkManager)
|
|
28
|
+
throw new Error('Network manager not initialized. Start CRDT Server');
|
|
29
|
+
return networkManager;
|
|
30
|
+
}
|
|
31
|
+
function addNetworkManager(reservedLocalEntities, range) {
|
|
32
|
+
entityContainer.setNetworkEntitiesRange(reservedLocalEntities, range);
|
|
33
|
+
networkManager = {
|
|
34
|
+
addEntity: () => entityContainer.generateEntity(true)
|
|
35
|
+
};
|
|
36
|
+
return networkManager;
|
|
37
|
+
}
|
|
25
38
|
function addEntity() {
|
|
26
39
|
const entity = entityContainer.generateEntity();
|
|
27
40
|
return entity;
|
|
@@ -184,7 +197,9 @@ function preEngine() {
|
|
|
184
197
|
registerComponentDefinition,
|
|
185
198
|
entityContainer,
|
|
186
199
|
componentsIter,
|
|
187
|
-
seal
|
|
200
|
+
seal,
|
|
201
|
+
addNetworkManager,
|
|
202
|
+
getNetworkManager
|
|
188
203
|
};
|
|
189
204
|
}
|
|
190
205
|
/**
|
|
@@ -228,6 +243,8 @@ export function Engine(options) {
|
|
|
228
243
|
CameraEntity: 2,
|
|
229
244
|
getEntityState: partialEngine.entityContainer.getEntityState,
|
|
230
245
|
addTransport: crdtSystem.addTransport,
|
|
231
|
-
entityContainer: partialEngine.entityContainer
|
|
246
|
+
entityContainer: partialEngine.entityContainer,
|
|
247
|
+
addNetworkManager: partialEngine.addNetworkManager,
|
|
248
|
+
getNetworkManager: partialEngine.getNetworkManager
|
|
232
249
|
};
|
|
233
250
|
}
|
|
@@ -3,6 +3,6 @@ import { ByteBuffer } from '../serialization/ByteBuffer';
|
|
|
3
3
|
import { PutComponentMessageBody, DeleteComponentMessageBody, CrdtMessageBody } from '../serialization/crdt';
|
|
4
4
|
import { Entity } from './entity';
|
|
5
5
|
export declare function incrementTimestamp(entity: Entity, timestamps: Map<Entity, number>): number;
|
|
6
|
-
export declare function createDumpLwwFunctionFromCrdt(componentId: number, timestamps: Map<Entity, number>, schema: Pick<ISchema<any>, 'serialize' | 'deserialize'>, data: Map<Entity, unknown>): (buffer: ByteBuffer) => void;
|
|
6
|
+
export declare function createDumpLwwFunctionFromCrdt(componentId: number, timestamps: Map<Entity, number>, schema: Pick<ISchema<any>, 'serialize' | 'deserialize'>, data: Map<Entity, unknown>): (buffer: ByteBuffer, filterEntity?: ((entity: Entity) => boolean) | undefined) => void;
|
|
7
7
|
export declare function createUpdateLwwFromCrdt(componentId: number, timestamps: Map<Entity, number>, schema: Pick<ISchema<any>, 'serialize' | 'deserialize'>, data: Map<Entity, unknown>): (msg: CrdtMessageBody) => [null | PutComponentMessageBody | DeleteComponentMessageBody, any];
|
|
8
8
|
export declare function createGetCrdtMessagesForLww(componentId: number, timestamps: Map<Entity, number>, dirtyIterator: Set<Entity>, schema: Pick<ISchema<any>, 'serialize'>, data: Map<Entity, unknown>): () => Generator<PutComponentMessageBody | DeleteComponentMessageBody, void, unknown>;
|
|
@@ -8,8 +8,15 @@ export function incrementTimestamp(entity, timestamps) {
|
|
|
8
8
|
return newTimestamp;
|
|
9
9
|
}
|
|
10
10
|
export function createDumpLwwFunctionFromCrdt(componentId, timestamps, schema, data) {
|
|
11
|
-
return function dumpCrdtState(buffer) {
|
|
11
|
+
return function dumpCrdtState(buffer, filterEntity) {
|
|
12
12
|
for (const [entity, timestamp] of timestamps) {
|
|
13
|
+
/* istanbul ignore if */
|
|
14
|
+
if (filterEntity) {
|
|
15
|
+
// I swear that this is being tested on state-to-crdt.spec but jest is trolling me
|
|
16
|
+
/* istanbul ignore next */
|
|
17
|
+
if (!filterEntity(entity))
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
13
20
|
/* istanbul ignore else */
|
|
14
21
|
if (data.has(entity)) {
|
|
15
22
|
const it = data.get(entity);
|
package/dist/engine/types.d.ts
CHANGED
|
@@ -46,10 +46,9 @@ export interface IEngine {
|
|
|
46
46
|
/**
|
|
47
47
|
* @public
|
|
48
48
|
* Increment the used entity counter and return the next one.
|
|
49
|
-
* @param dynamic - whether or no the entity should be considered as Dynamic (vs Static)
|
|
50
49
|
* @returns the next entity unused
|
|
51
50
|
*/
|
|
52
|
-
addEntity(
|
|
51
|
+
addEntity(): Entity;
|
|
53
52
|
/**
|
|
54
53
|
* @public
|
|
55
54
|
* Remove all components of an entity
|
|
@@ -228,4 +227,16 @@ export interface IEngine {
|
|
|
228
227
|
* components that will be available to this engine and to run optimizations.
|
|
229
228
|
*/
|
|
230
229
|
seal(): void;
|
|
230
|
+
/**
|
|
231
|
+
* @alpha
|
|
232
|
+
* Initialize network manager
|
|
233
|
+
*/
|
|
234
|
+
addNetworkManager(reservedLocalEntities: number, range: [number, number]): {
|
|
235
|
+
addEntity: IEngine['addEntity'];
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* @alpha
|
|
239
|
+
* Get netowrk manager to create entities.
|
|
240
|
+
*/
|
|
241
|
+
getNetworkManager(): ReturnType<IEngine['addNetworkManager']>;
|
|
231
242
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export * from './systems/videoEvents';
|
|
|
10
10
|
export * from './systems/async-task';
|
|
11
11
|
export * from './engine/entity';
|
|
12
12
|
export * from './components/types';
|
|
13
|
-
import { MaterialComponentDefinitionExtended, MeshColliderComponentDefinitionExtended, MeshRendererComponentDefinitionExtended, TransformComponentExtended, AnimatorComponentDefinitionExtended } from './components/types';
|
|
13
|
+
import { MaterialComponentDefinitionExtended, MeshColliderComponentDefinitionExtended, MeshRendererComponentDefinitionExtended, TransformComponentExtended, AnimatorComponentDefinitionExtended, ISyncComponents } from './components/types';
|
|
14
14
|
import { NameComponent } from './components/manual/Name';
|
|
15
15
|
export declare const Transform: TransformComponentExtended;
|
|
16
16
|
export declare const Animator: AnimatorComponentDefinitionExtended;
|
|
@@ -18,6 +18,12 @@ export declare const Material: MaterialComponentDefinitionExtended;
|
|
|
18
18
|
export declare const MeshRenderer: MeshRendererComponentDefinitionExtended;
|
|
19
19
|
export declare const MeshCollider: MeshColliderComponentDefinitionExtended;
|
|
20
20
|
export declare const Name: NameComponent;
|
|
21
|
+
/**
|
|
22
|
+
* @alpha
|
|
23
|
+
* This is going to be used for sync components through a server.
|
|
24
|
+
* Can be modified in the future since it's still in research
|
|
25
|
+
*/
|
|
26
|
+
export declare const SyncComponents: ISyncComponents;
|
|
21
27
|
export * from './components/generated/global.gen';
|
|
22
28
|
export * from './components/generated/types.gen';
|
|
23
29
|
export * from './serialization/crdt';
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,12 @@ export const Material = /* @__PURE__*/ components.Material(engine);
|
|
|
23
23
|
export const MeshRenderer = /* @__PURE__*/ components.MeshRenderer(engine);
|
|
24
24
|
export const MeshCollider = /* @__PURE__*/ components.MeshCollider(engine);
|
|
25
25
|
export const Name = components.Name(engine);
|
|
26
|
+
/**
|
|
27
|
+
* @alpha
|
|
28
|
+
* This is going to be used for sync components through a server.
|
|
29
|
+
* Can be modified in the future since it's still in research
|
|
30
|
+
*/
|
|
31
|
+
export const SyncComponents = /* @__PURE__*/ components.SyncComponents(engine);
|
|
26
32
|
// export components for global engine
|
|
27
33
|
export * from './components/generated/global.gen';
|
|
28
34
|
export * from './components/generated/types.gen';
|
|
@@ -92,6 +92,7 @@ export function crdtSceneSystem(engine, onProcessEntityComponentChange) {
|
|
|
92
92
|
for (const msg of messagesToProcess) {
|
|
93
93
|
if (msg.type === CrdtMessageType.DELETE_ENTITY) {
|
|
94
94
|
entitiesShouldBeCleaned.push(msg.entityId);
|
|
95
|
+
broadcastMessages.push(msg);
|
|
95
96
|
}
|
|
96
97
|
else {
|
|
97
98
|
const entityState = engine.entityContainer.getEntityState(msg.entityId);
|
|
@@ -140,7 +141,8 @@ export function crdtSceneSystem(engine, onProcessEntityComponentChange) {
|
|
|
140
141
|
}
|
|
141
142
|
}
|
|
142
143
|
for (const definition of engine.componentsIter()) {
|
|
143
|
-
|
|
144
|
+
// TODO: check this with pato/pravus
|
|
145
|
+
definition.entityDeleted(entity, true);
|
|
144
146
|
}
|
|
145
147
|
engine.entityContainer.updateRemovedEntity(entity);
|
|
146
148
|
onProcessEntityComponentChange && onProcessEntityComponentChange(entity, CrdtMessageType.DELETE_ENTITY);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AvatarBaseSchema = void 0;
|
|
4
|
+
const avatar_base_gen_1 = require("./pb/decentraland/sdk/components/avatar_base.gen");
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
exports.AvatarBaseSchema = {
|
|
9
|
+
COMPONENT_ID: 1087,
|
|
10
|
+
serialize(value, builder) {
|
|
11
|
+
const writer = avatar_base_gen_1.PBAvatarBase.encode(value);
|
|
12
|
+
const buffer = new Uint8Array(writer.finish(), 0, writer.len);
|
|
13
|
+
builder.writeBuffer(buffer, false);
|
|
14
|
+
},
|
|
15
|
+
deserialize(reader) {
|
|
16
|
+
return avatar_base_gen_1.PBAvatarBase.decode(reader.buffer(), reader.remainingBytes());
|
|
17
|
+
},
|
|
18
|
+
create() {
|
|
19
|
+
// TODO: this is a hack.
|
|
20
|
+
return avatar_base_gen_1.PBAvatarBase.decode(new Uint8Array());
|
|
21
|
+
},
|
|
22
|
+
jsonSchema: {
|
|
23
|
+
type: "object",
|
|
24
|
+
properties: {},
|
|
25
|
+
serializationType: "protocol-buffer",
|
|
26
|
+
protocolBuffer: "PBAvatarBase"
|
|
27
|
+
}
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AvatarEmoteCommandSchema = void 0;
|
|
4
|
+
const avatar_emote_command_gen_1 = require("./pb/decentraland/sdk/components/avatar_emote_command.gen");
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
exports.AvatarEmoteCommandSchema = {
|
|
9
|
+
COMPONENT_ID: 1088,
|
|
10
|
+
serialize(value, builder) {
|
|
11
|
+
const writer = avatar_emote_command_gen_1.PBAvatarEmoteCommand.encode(value);
|
|
12
|
+
const buffer = new Uint8Array(writer.finish(), 0, writer.len);
|
|
13
|
+
builder.writeBuffer(buffer, false);
|
|
14
|
+
},
|
|
15
|
+
deserialize(reader) {
|
|
16
|
+
return avatar_emote_command_gen_1.PBAvatarEmoteCommand.decode(reader.buffer(), reader.remainingBytes());
|
|
17
|
+
},
|
|
18
|
+
create() {
|
|
19
|
+
// TODO: this is a hack.
|
|
20
|
+
return avatar_emote_command_gen_1.PBAvatarEmoteCommand.decode(new Uint8Array());
|
|
21
|
+
},
|
|
22
|
+
jsonSchema: {
|
|
23
|
+
type: "object",
|
|
24
|
+
properties: {},
|
|
25
|
+
serializationType: "protocol-buffer",
|
|
26
|
+
protocolBuffer: "PBAvatarEmoteCommand"
|
|
27
|
+
}
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AvatarEquippedDataSchema = void 0;
|
|
4
|
+
const avatar_equipped_data_gen_1 = require("./pb/decentraland/sdk/components/avatar_equipped_data.gen");
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
exports.AvatarEquippedDataSchema = {
|
|
9
|
+
COMPONENT_ID: 1091,
|
|
10
|
+
serialize(value, builder) {
|
|
11
|
+
const writer = avatar_equipped_data_gen_1.PBAvatarEquippedData.encode(value);
|
|
12
|
+
const buffer = new Uint8Array(writer.finish(), 0, writer.len);
|
|
13
|
+
builder.writeBuffer(buffer, false);
|
|
14
|
+
},
|
|
15
|
+
deserialize(reader) {
|
|
16
|
+
return avatar_equipped_data_gen_1.PBAvatarEquippedData.decode(reader.buffer(), reader.remainingBytes());
|
|
17
|
+
},
|
|
18
|
+
create() {
|
|
19
|
+
// TODO: this is a hack.
|
|
20
|
+
return avatar_equipped_data_gen_1.PBAvatarEquippedData.decode(new Uint8Array());
|
|
21
|
+
},
|
|
22
|
+
jsonSchema: {
|
|
23
|
+
type: "object",
|
|
24
|
+
properties: {},
|
|
25
|
+
serializationType: "protocol-buffer",
|
|
26
|
+
protocolBuffer: "PBAvatarEquippedData"
|
|
27
|
+
}
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlayerIdentityDataSchema = void 0;
|
|
4
|
+
const player_identity_data_gen_1 = require("./pb/decentraland/sdk/components/player_identity_data.gen");
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
exports.PlayerIdentityDataSchema = {
|
|
9
|
+
COMPONENT_ID: 1089,
|
|
10
|
+
serialize(value, builder) {
|
|
11
|
+
const writer = player_identity_data_gen_1.PBPlayerIdentityData.encode(value);
|
|
12
|
+
const buffer = new Uint8Array(writer.finish(), 0, writer.len);
|
|
13
|
+
builder.writeBuffer(buffer, false);
|
|
14
|
+
},
|
|
15
|
+
deserialize(reader) {
|
|
16
|
+
return player_identity_data_gen_1.PBPlayerIdentityData.decode(reader.buffer(), reader.remainingBytes());
|
|
17
|
+
},
|
|
18
|
+
create() {
|
|
19
|
+
// TODO: this is a hack.
|
|
20
|
+
return player_identity_data_gen_1.PBPlayerIdentityData.decode(new Uint8Array());
|
|
21
|
+
},
|
|
22
|
+
jsonSchema: {
|
|
23
|
+
type: "object",
|
|
24
|
+
properties: {},
|
|
25
|
+
serializationType: "protocol-buffer",
|
|
26
|
+
protocolBuffer: "PBPlayerIdentityData"
|
|
27
|
+
}
|
|
28
|
+
};
|
|
@@ -10,6 +10,9 @@ exports.coreComponentMappings = {
|
|
|
10
10
|
"core::AudioSource": 1020,
|
|
11
11
|
"core::AudioStream": 1021,
|
|
12
12
|
"core::AvatarAttach": 1073,
|
|
13
|
+
"core::AvatarBase": 1087,
|
|
14
|
+
"core::AvatarEmoteCommand": 1088,
|
|
15
|
+
"core::AvatarEquippedData": 1091,
|
|
13
16
|
"core::AvatarModifierArea": 1070,
|
|
14
17
|
"core::AvatarShape": 1080,
|
|
15
18
|
"core::Billboard": 1090,
|
|
@@ -22,6 +25,7 @@ exports.coreComponentMappings = {
|
|
|
22
25
|
"core::MeshCollider": 1019,
|
|
23
26
|
"core::MeshRenderer": 1018,
|
|
24
27
|
"core::NftShape": 1040,
|
|
28
|
+
"core::PlayerIdentityData": 1089,
|
|
25
29
|
"core::PointerEvents": 1062,
|
|
26
30
|
"core::PointerEventsResult": 1063,
|
|
27
31
|
"core::PointerLock": 1074,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import _m0 from "protobufjs/minimal";
|
|
2
|
+
import { Color3 } from "../../common/colors.gen";
|
|
3
|
+
/** AvatarBase sets all modifiers over the avatar's apparence. */
|
|
4
|
+
/**
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export interface PBAvatarBase {
|
|
8
|
+
skinColor: Color3 | undefined;
|
|
9
|
+
eyesColor: Color3 | undefined;
|
|
10
|
+
hairColor: Color3 | undefined;
|
|
11
|
+
bodyShapeUrn: string;
|
|
12
|
+
name: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export declare namespace PBAvatarBase {
|
|
18
|
+
function encode(message: PBAvatarBase, writer?: _m0.Writer): _m0.Writer;
|
|
19
|
+
function decode(input: _m0.Reader | Uint8Array, length?: number): PBAvatarBase;
|
|
20
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PBAvatarBase = void 0;
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
const minimal_1 = __importDefault(require("protobufjs/minimal"));
|
|
9
|
+
const colors_gen_1 = require("../../common/colors.gen");
|
|
10
|
+
const protobufPackageSarasa = "decentraland.sdk.components";
|
|
11
|
+
function createBasePBAvatarBase() {
|
|
12
|
+
return { skinColor: undefined, eyesColor: undefined, hairColor: undefined, bodyShapeUrn: "", name: "" };
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
var PBAvatarBase;
|
|
18
|
+
(function (PBAvatarBase) {
|
|
19
|
+
function encode(message, writer = minimal_1.default.Writer.create()) {
|
|
20
|
+
if (message.skinColor !== undefined) {
|
|
21
|
+
colors_gen_1.Color3.encode(message.skinColor, writer.uint32(10).fork()).ldelim();
|
|
22
|
+
}
|
|
23
|
+
if (message.eyesColor !== undefined) {
|
|
24
|
+
colors_gen_1.Color3.encode(message.eyesColor, writer.uint32(18).fork()).ldelim();
|
|
25
|
+
}
|
|
26
|
+
if (message.hairColor !== undefined) {
|
|
27
|
+
colors_gen_1.Color3.encode(message.hairColor, writer.uint32(26).fork()).ldelim();
|
|
28
|
+
}
|
|
29
|
+
if (message.bodyShapeUrn !== "") {
|
|
30
|
+
writer.uint32(34).string(message.bodyShapeUrn);
|
|
31
|
+
}
|
|
32
|
+
if (message.name !== "") {
|
|
33
|
+
writer.uint32(42).string(message.name);
|
|
34
|
+
}
|
|
35
|
+
return writer;
|
|
36
|
+
}
|
|
37
|
+
PBAvatarBase.encode = encode;
|
|
38
|
+
function decode(input, length) {
|
|
39
|
+
const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
|
|
40
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
41
|
+
const message = createBasePBAvatarBase();
|
|
42
|
+
while (reader.pos < end) {
|
|
43
|
+
const tag = reader.uint32();
|
|
44
|
+
switch (tag >>> 3) {
|
|
45
|
+
case 1:
|
|
46
|
+
if (tag !== 10) {
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
message.skinColor = colors_gen_1.Color3.decode(reader, reader.uint32());
|
|
50
|
+
continue;
|
|
51
|
+
case 2:
|
|
52
|
+
if (tag !== 18) {
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
message.eyesColor = colors_gen_1.Color3.decode(reader, reader.uint32());
|
|
56
|
+
continue;
|
|
57
|
+
case 3:
|
|
58
|
+
if (tag !== 26) {
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
message.hairColor = colors_gen_1.Color3.decode(reader, reader.uint32());
|
|
62
|
+
continue;
|
|
63
|
+
case 4:
|
|
64
|
+
if (tag !== 34) {
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
message.bodyShapeUrn = reader.string();
|
|
68
|
+
continue;
|
|
69
|
+
case 5:
|
|
70
|
+
if (tag !== 42) {
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
message.name = reader.string();
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
reader.skipType(tag & 7);
|
|
80
|
+
}
|
|
81
|
+
return message;
|
|
82
|
+
}
|
|
83
|
+
PBAvatarBase.decode = decode;
|
|
84
|
+
})(PBAvatarBase = exports.PBAvatarBase || (exports.PBAvatarBase = {}));
|
package/dist-cjs/components/generated/pb/decentraland/sdk/components/avatar_emote_command.gen.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import _m0 from "protobufjs/minimal";
|
|
2
|
+
/**
|
|
3
|
+
* AvatarEmoteCommand is a grow only value set, used to signal the renderer about
|
|
4
|
+
* avatar emotes playback.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export interface PBAvatarEmoteCommand {
|
|
10
|
+
emoteCommand: PBAvatarEmoteCommand_EmoteCommand | undefined;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export interface PBAvatarEmoteCommand_EmoteCommand {
|
|
16
|
+
emoteUrn: string;
|
|
17
|
+
loop: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export declare namespace PBAvatarEmoteCommand {
|
|
23
|
+
function encode(message: PBAvatarEmoteCommand, writer?: _m0.Writer): _m0.Writer;
|
|
24
|
+
function decode(input: _m0.Reader | Uint8Array, length?: number): PBAvatarEmoteCommand;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export declare namespace PBAvatarEmoteCommand_EmoteCommand {
|
|
30
|
+
function encode(message: PBAvatarEmoteCommand_EmoteCommand, writer?: _m0.Writer): _m0.Writer;
|
|
31
|
+
function decode(input: _m0.Reader | Uint8Array, length?: number): PBAvatarEmoteCommand_EmoteCommand;
|
|
32
|
+
}
|
package/dist-cjs/components/generated/pb/decentraland/sdk/components/avatar_emote_command.gen.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PBAvatarEmoteCommand_EmoteCommand = exports.PBAvatarEmoteCommand = void 0;
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
const minimal_1 = __importDefault(require("protobufjs/minimal"));
|
|
9
|
+
const protobufPackageSarasa = "decentraland.sdk.components";
|
|
10
|
+
function createBasePBAvatarEmoteCommand() {
|
|
11
|
+
return { emoteCommand: undefined };
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
var PBAvatarEmoteCommand;
|
|
17
|
+
(function (PBAvatarEmoteCommand) {
|
|
18
|
+
function encode(message, writer = minimal_1.default.Writer.create()) {
|
|
19
|
+
if (message.emoteCommand !== undefined) {
|
|
20
|
+
PBAvatarEmoteCommand_EmoteCommand.encode(message.emoteCommand, writer.uint32(10).fork()).ldelim();
|
|
21
|
+
}
|
|
22
|
+
return writer;
|
|
23
|
+
}
|
|
24
|
+
PBAvatarEmoteCommand.encode = encode;
|
|
25
|
+
function decode(input, length) {
|
|
26
|
+
const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
|
|
27
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
28
|
+
const message = createBasePBAvatarEmoteCommand();
|
|
29
|
+
while (reader.pos < end) {
|
|
30
|
+
const tag = reader.uint32();
|
|
31
|
+
switch (tag >>> 3) {
|
|
32
|
+
case 1:
|
|
33
|
+
if (tag !== 10) {
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
message.emoteCommand = PBAvatarEmoteCommand_EmoteCommand.decode(reader, reader.uint32());
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
reader.skipType(tag & 7);
|
|
43
|
+
}
|
|
44
|
+
return message;
|
|
45
|
+
}
|
|
46
|
+
PBAvatarEmoteCommand.decode = decode;
|
|
47
|
+
})(PBAvatarEmoteCommand = exports.PBAvatarEmoteCommand || (exports.PBAvatarEmoteCommand = {}));
|
|
48
|
+
function createBasePBAvatarEmoteCommand_EmoteCommand() {
|
|
49
|
+
return { emoteUrn: "", loop: false };
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
54
|
+
var PBAvatarEmoteCommand_EmoteCommand;
|
|
55
|
+
(function (PBAvatarEmoteCommand_EmoteCommand) {
|
|
56
|
+
function encode(message, writer = minimal_1.default.Writer.create()) {
|
|
57
|
+
if (message.emoteUrn !== "") {
|
|
58
|
+
writer.uint32(10).string(message.emoteUrn);
|
|
59
|
+
}
|
|
60
|
+
if (message.loop === true) {
|
|
61
|
+
writer.uint32(16).bool(message.loop);
|
|
62
|
+
}
|
|
63
|
+
return writer;
|
|
64
|
+
}
|
|
65
|
+
PBAvatarEmoteCommand_EmoteCommand.encode = encode;
|
|
66
|
+
function decode(input, length) {
|
|
67
|
+
const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
|
|
68
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
69
|
+
const message = createBasePBAvatarEmoteCommand_EmoteCommand();
|
|
70
|
+
while (reader.pos < end) {
|
|
71
|
+
const tag = reader.uint32();
|
|
72
|
+
switch (tag >>> 3) {
|
|
73
|
+
case 1:
|
|
74
|
+
if (tag !== 10) {
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
message.emoteUrn = reader.string();
|
|
78
|
+
continue;
|
|
79
|
+
case 2:
|
|
80
|
+
if (tag !== 16) {
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
message.loop = reader.bool();
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
reader.skipType(tag & 7);
|
|
90
|
+
}
|
|
91
|
+
return message;
|
|
92
|
+
}
|
|
93
|
+
PBAvatarEmoteCommand_EmoteCommand.decode = decode;
|
|
94
|
+
})(PBAvatarEmoteCommand_EmoteCommand = exports.PBAvatarEmoteCommand_EmoteCommand || (exports.PBAvatarEmoteCommand_EmoteCommand = {}));
|