@dcl/ecs 7.20.4-22581991550.commit-9c72184 → 7.20.4-22621752364.commit-d72981b

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.
Files changed (101) hide show
  1. package/dist/components/extended/AudioAnalysis.d.ts +55 -0
  2. package/dist/components/extended/AudioAnalysis.js +66 -0
  3. package/dist/components/extended/Tween.d.ts +90 -0
  4. package/dist/components/extended/Tween.js +152 -0
  5. package/dist/components/generated/AudioAnalysis.gen.d.ts +1 -0
  6. package/dist/components/generated/AudioAnalysis.gen.js +25 -0
  7. package/dist/components/generated/AvatarLocomotionSettings.gen.d.ts +1 -0
  8. package/dist/components/generated/AvatarLocomotionSettings.gen.js +25 -0
  9. package/dist/components/generated/component-names.gen.js +2 -0
  10. package/dist/components/generated/global.gen.d.ts +4 -0
  11. package/dist/components/generated/global.gen.js +2 -0
  12. package/dist/components/generated/index.gen.d.ts +8 -0
  13. package/dist/components/generated/index.gen.js +10 -0
  14. package/dist/components/generated/pb/decentraland/sdk/components/audio_analysis.gen.d.ts +37 -0
  15. package/dist/components/generated/pb/decentraland/sdk/components/audio_analysis.gen.js +161 -0
  16. package/dist/components/generated/pb/decentraland/sdk/components/avatar_locomotion_settings.gen.d.ts +29 -0
  17. package/dist/components/generated/pb/decentraland/sdk/components/avatar_locomotion_settings.gen.js +93 -0
  18. package/dist/components/generated/pb/decentraland/sdk/components/common/input_action.gen.d.ts +12 -2
  19. package/dist/components/generated/pb/decentraland/sdk/components/common/input_action.gen.js +11 -0
  20. package/dist/components/generated/pb/decentraland/sdk/components/pointer_events.gen.d.ts +5 -1
  21. package/dist/components/generated/pb/decentraland/sdk/components/pointer_events.gen.js +20 -1
  22. package/dist/components/generated/pb/decentraland/sdk/components/tween.gen.d.ts +40 -0
  23. package/dist/components/generated/pb/decentraland/sdk/components/tween.gen.js +176 -0
  24. package/dist/components/generated/pb/decentraland/sdk/components/virtual_camera.gen.d.ts +3 -0
  25. package/dist/components/generated/pb/decentraland/sdk/components/virtual_camera.gen.js +10 -1
  26. package/dist/components/index.d.ts +4 -5
  27. package/dist/components/index.js +5 -5
  28. package/dist/components/manual/Transform.d.ts +0 -9
  29. package/dist/components/manual/Transform.js +3 -3
  30. package/dist/components/types.d.ts +2 -2
  31. package/dist/engine/component.d.ts +1 -52
  32. package/dist/engine/grow-only-value-set-component-definition.js +2 -45
  33. package/dist/engine/lww-element-set-component-definition.d.ts +1 -3
  34. package/dist/engine/lww-element-set-component-definition.js +12 -65
  35. package/dist/index.d.ts +2 -2
  36. package/dist/index.js +1 -1
  37. package/dist/serialization/crdt/index.d.ts +0 -1
  38. package/dist/serialization/crdt/index.js +0 -1
  39. package/dist/serialization/crdt/network/utils.d.ts +9 -0
  40. package/dist/serialization/crdt/network/utils.js +60 -0
  41. package/dist/serialization/crdt/types.d.ts +3 -25
  42. package/dist/serialization/crdt/types.js +1 -3
  43. package/dist/systems/crdt/index.d.ts +1 -0
  44. package/dist/systems/crdt/index.js +146 -55
  45. package/dist/systems/events.d.ts +65 -0
  46. package/dist/systems/events.js +70 -8
  47. package/dist-cjs/components/extended/AudioAnalysis.d.ts +55 -0
  48. package/dist-cjs/components/extended/AudioAnalysis.js +70 -0
  49. package/dist-cjs/components/extended/Tween.d.ts +90 -0
  50. package/dist-cjs/components/extended/Tween.js +152 -0
  51. package/dist-cjs/components/generated/AudioAnalysis.gen.d.ts +1 -0
  52. package/dist-cjs/components/generated/AudioAnalysis.gen.js +28 -0
  53. package/dist-cjs/components/generated/AvatarLocomotionSettings.gen.d.ts +1 -0
  54. package/dist-cjs/components/generated/AvatarLocomotionSettings.gen.js +28 -0
  55. package/dist-cjs/components/generated/component-names.gen.js +2 -0
  56. package/dist-cjs/components/generated/global.gen.d.ts +4 -0
  57. package/dist-cjs/components/generated/global.gen.js +3 -1
  58. package/dist-cjs/components/generated/index.gen.d.ts +8 -0
  59. package/dist-cjs/components/generated/index.gen.js +14 -2
  60. package/dist-cjs/components/generated/pb/decentraland/sdk/components/audio_analysis.gen.d.ts +37 -0
  61. package/dist-cjs/components/generated/pb/decentraland/sdk/components/audio_analysis.gen.js +167 -0
  62. package/dist-cjs/components/generated/pb/decentraland/sdk/components/avatar_locomotion_settings.gen.d.ts +29 -0
  63. package/dist-cjs/components/generated/pb/decentraland/sdk/components/avatar_locomotion_settings.gen.js +99 -0
  64. package/dist-cjs/components/generated/pb/decentraland/sdk/components/common/input_action.gen.d.ts +12 -2
  65. package/dist-cjs/components/generated/pb/decentraland/sdk/components/common/input_action.gen.js +12 -1
  66. package/dist-cjs/components/generated/pb/decentraland/sdk/components/pointer_events.gen.d.ts +5 -1
  67. package/dist-cjs/components/generated/pb/decentraland/sdk/components/pointer_events.gen.js +20 -1
  68. package/dist-cjs/components/generated/pb/decentraland/sdk/components/tween.gen.d.ts +40 -0
  69. package/dist-cjs/components/generated/pb/decentraland/sdk/components/tween.gen.js +177 -1
  70. package/dist-cjs/components/generated/pb/decentraland/sdk/components/virtual_camera.gen.d.ts +3 -0
  71. package/dist-cjs/components/generated/pb/decentraland/sdk/components/virtual_camera.gen.js +10 -1
  72. package/dist-cjs/components/index.d.ts +4 -5
  73. package/dist-cjs/components/index.js +7 -7
  74. package/dist-cjs/components/manual/Transform.d.ts +0 -9
  75. package/dist-cjs/components/manual/Transform.js +3 -3
  76. package/dist-cjs/components/types.d.ts +2 -2
  77. package/dist-cjs/engine/component.d.ts +1 -52
  78. package/dist-cjs/engine/grow-only-value-set-component-definition.js +1 -44
  79. package/dist-cjs/engine/lww-element-set-component-definition.d.ts +1 -3
  80. package/dist-cjs/engine/lww-element-set-component-definition.js +13 -68
  81. package/dist-cjs/index.d.ts +2 -2
  82. package/dist-cjs/index.js +2 -2
  83. package/dist-cjs/serialization/crdt/index.d.ts +0 -1
  84. package/dist-cjs/serialization/crdt/index.js +0 -1
  85. package/dist-cjs/serialization/crdt/network/utils.d.ts +9 -0
  86. package/dist-cjs/serialization/crdt/network/utils.js +67 -0
  87. package/dist-cjs/serialization/crdt/types.d.ts +3 -25
  88. package/dist-cjs/serialization/crdt/types.js +1 -3
  89. package/dist-cjs/systems/crdt/index.d.ts +1 -0
  90. package/dist-cjs/systems/crdt/index.js +169 -55
  91. package/dist-cjs/systems/events.d.ts +65 -0
  92. package/dist-cjs/systems/events.js +70 -8
  93. package/package.json +2 -2
  94. package/dist/components/manual/CreatedBy.d.ts +0 -9
  95. package/dist/components/manual/CreatedBy.js +0 -8
  96. package/dist/serialization/crdt/authoritativePutComponent.d.ts +0 -15
  97. package/dist/serialization/crdt/authoritativePutComponent.js +0 -47
  98. package/dist-cjs/components/manual/CreatedBy.d.ts +0 -9
  99. package/dist-cjs/components/manual/CreatedBy.js +0 -10
  100. package/dist-cjs/serialization/crdt/authoritativePutComponent.d.ts +0 -15
  101. package/dist-cjs/serialization/crdt/authoritativePutComponent.js +0 -50
@@ -18,12 +18,14 @@ export function createPointerEventsSystem(engine, inputSystem) {
18
18
  EventType[EventType["Up"] = 2] = "Up";
19
19
  EventType[EventType["HoverEnter"] = 3] = "HoverEnter";
20
20
  EventType[EventType["HoverLeave"] = 4] = "HoverLeave";
21
+ EventType[EventType["ProximityEnter"] = 5] = "ProximityEnter";
22
+ EventType[EventType["ProximityLeave"] = 6] = "ProximityLeave";
21
23
  })(EventType || (EventType = {}));
22
24
  const eventsMap = new Map();
23
25
  function getEvent(entity) {
24
26
  return eventsMap.get(entity) || eventsMap.set(entity, new Map()).get(entity);
25
27
  }
26
- function setPointerEvent(entity, type, opts) {
28
+ function setPointerEvent(entity, type, opts, interactionType = 0 /* InteractionType.CURSOR */) {
27
29
  const pointerEvent = PointerEvents.getMutableOrNull(entity) || PointerEvents.create(entity);
28
30
  pointerEvent.pointerEvents.push({
29
31
  eventType: type,
@@ -33,15 +35,19 @@ export function createPointerEventsSystem(engine, inputSystem) {
33
35
  showHighlight: opts.showHighlight,
34
36
  hoverText: opts.hoverText,
35
37
  maxDistance: opts.maxDistance,
36
- maxPlayerDistance: opts.maxPlayerDistance
37
- }
38
+ maxPlayerDistance: opts.maxPlayerDistance,
39
+ priority: opts.priority
40
+ },
41
+ interactionType: interactionType ?? 0 /* InteractionType.CURSOR */
38
42
  });
39
43
  }
40
- function removePointerEvent(entity, type, button) {
44
+ function removePointerEvent(entity, type, button, interactionType = 0 /* InteractionType.CURSOR */) {
41
45
  const pointerEvent = PointerEvents.getMutableOrNull(entity);
42
46
  if (!pointerEvent)
43
47
  return;
44
- pointerEvent.pointerEvents = pointerEvent.pointerEvents.filter((pointer) => !(pointer.eventInfo?.button === button && pointer.eventType === type));
48
+ pointerEvent.pointerEvents = pointerEvent.pointerEvents.filter((pointer) => !(pointer.eventInfo?.button === button &&
49
+ pointer.eventType === type &&
50
+ pointer.interactionType === interactionType));
45
51
  }
46
52
  function getPointerEvent(eventType) {
47
53
  if (eventType === EventType.Up) {
@@ -53,9 +59,15 @@ export function createPointerEventsSystem(engine, inputSystem) {
53
59
  else if (eventType === EventType.HoverEnter) {
54
60
  return 2 /* PointerEventType.PET_HOVER_ENTER */;
55
61
  }
62
+ else if (eventType === EventType.ProximityEnter) {
63
+ return 4 /* PointerEventType.PET_PROXIMITY_ENTER */;
64
+ }
65
+ else if (eventType === EventType.ProximityLeave) {
66
+ return 5 /* PointerEventType.PET_PROXIMITY_LEAVE */;
67
+ }
56
68
  return 1 /* PointerEventType.PET_DOWN */;
57
69
  }
58
- function removeEvent(entity, type) {
70
+ function removeEvent(entity, type, interactionType = 0 /* InteractionType.CURSOR */) {
59
71
  const event = getEvent(entity);
60
72
  const pointerEvent = event.get(type);
61
73
  if (pointerEvent?.opts.hoverText) {
@@ -78,7 +90,9 @@ export function createPointerEventsSystem(engine, inputSystem) {
78
90
  if (eventType === EventType.Down ||
79
91
  eventType === EventType.Up ||
80
92
  eventType === EventType.HoverEnter ||
81
- eventType === EventType.HoverLeave) {
93
+ eventType === EventType.HoverLeave ||
94
+ eventType === EventType.ProximityEnter ||
95
+ eventType === EventType.ProximityLeave) {
82
96
  const command = inputSystem.getInputCommand(opts.button, getPointerEvent(eventType), entity);
83
97
  if (command) {
84
98
  checkNotThenable(cb(command), 'Event handler returned a thenable. Only synchronous functions are allowed');
@@ -125,6 +139,38 @@ export function createPointerEventsSystem(engine, inputSystem) {
125
139
  getEvent(entity).set(EventType.HoverLeave, { cb, opts: options });
126
140
  setPointerEvent(entity, 3 /* PointerEventType.PET_HOVER_LEAVE */, options);
127
141
  };
142
+ const onProximityDown = (...args) => {
143
+ const [data, cb] = args;
144
+ const { entity, opts } = data;
145
+ const options = getDefaultOpts(opts);
146
+ removeEvent(entity, EventType.Down, 1 /* InteractionType.PROXIMITY */);
147
+ getEvent(entity).set(EventType.Down, { cb, opts: options });
148
+ setPointerEvent(entity, 1 /* PointerEventType.PET_DOWN */, options, 1 /* InteractionType.PROXIMITY */);
149
+ };
150
+ const onProximityUp = (...args) => {
151
+ const [data, cb] = args;
152
+ const { entity, opts } = data;
153
+ const options = getDefaultOpts(opts);
154
+ removeEvent(entity, EventType.Up, 1 /* InteractionType.PROXIMITY */);
155
+ getEvent(entity).set(EventType.Up, { cb, opts: options });
156
+ setPointerEvent(entity, 0 /* PointerEventType.PET_UP */, options, 1 /* InteractionType.PROXIMITY */);
157
+ };
158
+ const onProximityEnter = (...args) => {
159
+ const [data, cb] = args;
160
+ const { entity, opts } = data;
161
+ const options = getDefaultOpts(opts);
162
+ removeEvent(entity, EventType.ProximityEnter, 1 /* InteractionType.PROXIMITY */);
163
+ getEvent(entity).set(EventType.ProximityEnter, { cb, opts: options });
164
+ setPointerEvent(entity, 4 /* PointerEventType.PET_PROXIMITY_ENTER */, options, 1 /* InteractionType.PROXIMITY */);
165
+ };
166
+ const onProximityLeave = (...args) => {
167
+ const [data, cb] = args;
168
+ const { entity, opts } = data;
169
+ const options = getDefaultOpts(opts);
170
+ removeEvent(entity, EventType.ProximityLeave, 1 /* InteractionType.PROXIMITY */);
171
+ getEvent(entity).set(EventType.ProximityLeave, { cb, opts: options });
172
+ setPointerEvent(entity, 5 /* PointerEventType.PET_PROXIMITY_LEAVE */, options, 1 /* InteractionType.PROXIMITY */);
173
+ };
128
174
  return {
129
175
  removeOnClick(entity) {
130
176
  removeEvent(entity, EventType.Click);
@@ -141,6 +187,18 @@ export function createPointerEventsSystem(engine, inputSystem) {
141
187
  removeOnPointerHoverLeave(entity) {
142
188
  removeEvent(entity, EventType.HoverLeave);
143
189
  },
190
+ removeOnProximityDown(entity) {
191
+ removeEvent(entity, EventType.Down, 1 /* InteractionType.PROXIMITY */);
192
+ },
193
+ removeOnProximityUp(entity) {
194
+ removeEvent(entity, EventType.Up, 1 /* InteractionType.PROXIMITY */);
195
+ },
196
+ removeOnProximityEnter(entity) {
197
+ removeEvent(entity, EventType.ProximityEnter, 1 /* InteractionType.PROXIMITY */);
198
+ },
199
+ removeOnProximityLeave(entity) {
200
+ removeEvent(entity, EventType.ProximityLeave, 1 /* InteractionType.PROXIMITY */);
201
+ },
144
202
  onClick(value, cb) {
145
203
  const { entity } = value;
146
204
  const options = getDefaultOpts(value.opts);
@@ -153,6 +211,10 @@ export function createPointerEventsSystem(engine, inputSystem) {
153
211
  onPointerDown,
154
212
  onPointerUp,
155
213
  onPointerHoverEnter,
156
- onPointerHoverLeave
214
+ onPointerHoverLeave,
215
+ onProximityDown,
216
+ onProximityUp,
217
+ onProximityEnter,
218
+ onProximityLeave
157
219
  };
158
220
  }
@@ -0,0 +1,55 @@
1
+ import { Entity, IEngine } from '../../engine';
2
+ import { LastWriteWinElementSetComponentDefinition } from '../../engine/component';
3
+ import { PBAudioAnalysis, PBAudioAnalysisMode } from '../generated/pb/decentraland/sdk/components/audio_analysis.gen';
4
+ export interface AudioAnalysisComponentDefinitionExtended extends LastWriteWinElementSetComponentDefinition<PBAudioAnalysis> {
5
+ /**
6
+ * Reads the component data of `entity` into the provided `out` view.
7
+ *
8
+ * @throws Error if the entity does not have an AudioAnalysis component.
9
+ * @param entity - The entity whose AudioAnalysis data will be read.
10
+ * @param out - An existing AudioAnalysisView to populate with the latest values.
11
+ */
12
+ readIntoView(entity: Entity, out: AudioAnalysisView): void;
13
+ /**
14
+ * Attempts to read the component data of `entity` into the provided `out` view.
15
+ *
16
+ * @returns `true` if the component exists and data was written into `out`,
17
+ * `false` if the entity does not have an AudioAnalysis component.
18
+ * @param entity - The entity whose AudioAnalysis data will be read.
19
+ * @param out - An existing AudioAnalysisView to populate.
20
+ */
21
+ tryReadIntoView(entity: Entity, out: AudioAnalysisView): boolean;
22
+ /**
23
+ * Creates an AudioAnalysis component for the given `entity`.
24
+ *
25
+ * If a component already exists on the entity, this call fails (does not replace).
26
+ *
27
+ * @param entity - The entity to attach the component to.
28
+ * @param mode - Analysis mode. Defaults to `PBAudioAnalysisMode.MODE_LOGARITHMIC`.
29
+ * @param amplitudeGain - Optional amplitude gain multiplier.
30
+ * @param bandsGain - Optional gain multiplier applied to all frequency bands.
31
+ */
32
+ createAudioAnalysis(entity: Entity, mode?: PBAudioAnalysisMode, // default is PBAudioAnalysisMode.MODE_LOGARITHMIC
33
+ amplitudeGain?: number, bandsGain?: number): void;
34
+ /**
35
+ * Creates the AudioAnalysis component if missing, or replaces the existing one.
36
+ *
37
+ * @param entity - The target entity.
38
+ * @param mode - Analysis mode. Defaults to `PBAudioAnalysisMode.MODE_LOGARITHMIC`.
39
+ * @param amplitudeGain - Optional amplitude gain multiplier.
40
+ * @param bandsGain - Optional gain multiplier applied to the frequency bands.
41
+ */
42
+ createOrReplaceAudioAnalysis(entity: Entity, mode?: PBAudioAnalysisMode, // default is PBAudioAnalysisMode.MODE_LOGARITHMIC
43
+ amplitudeGain?: number, bandsGain?: number): void;
44
+ }
45
+ /**
46
+ * A read-only JavaScript-friendly view of AudioAnalysis ECS data.
47
+ *
48
+ * `amplitude` represents the aggregated signal strength.
49
+ * `bands` represents the processed frequency bands.
50
+ */
51
+ export type AudioAnalysisView = {
52
+ amplitude: number;
53
+ bands: number[];
54
+ };
55
+ export declare function defineAudioAnalysisComponent(engine: Pick<IEngine, 'defineComponentFromSchema'>): AudioAnalysisComponentDefinitionExtended;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defineAudioAnalysisComponent = void 0;
4
+ const index_gen_1 = require("../generated/index.gen");
5
+ function defineAudioAnalysisComponent(engine) {
6
+ const theComponent = (0, index_gen_1.AudioAnalysis)(engine);
7
+ return {
8
+ ...theComponent,
9
+ readIntoView(entity, out) {
10
+ const audioAnalysis = theComponent.get(entity);
11
+ out.amplitude = audioAnalysis.amplitude;
12
+ out.bands[0] = audioAnalysis.band0;
13
+ out.bands[1] = audioAnalysis.band1;
14
+ out.bands[2] = audioAnalysis.band2;
15
+ out.bands[3] = audioAnalysis.band3;
16
+ out.bands[4] = audioAnalysis.band4;
17
+ out.bands[5] = audioAnalysis.band5;
18
+ out.bands[6] = audioAnalysis.band6;
19
+ out.bands[7] = audioAnalysis.band7;
20
+ },
21
+ tryReadIntoView(entity, out) {
22
+ const audioAnalysis = theComponent.getOrNull(entity);
23
+ if (!audioAnalysis)
24
+ return false;
25
+ out.amplitude = audioAnalysis.amplitude;
26
+ out.bands[0] = audioAnalysis.band0;
27
+ out.bands[1] = audioAnalysis.band1;
28
+ out.bands[2] = audioAnalysis.band2;
29
+ out.bands[3] = audioAnalysis.band3;
30
+ out.bands[4] = audioAnalysis.band4;
31
+ out.bands[5] = audioAnalysis.band5;
32
+ out.bands[6] = audioAnalysis.band6;
33
+ out.bands[7] = audioAnalysis.band7;
34
+ return true;
35
+ },
36
+ createAudioAnalysis(entity, mode, amplitudeGain, bandsGain) {
37
+ theComponent.create(entity, {
38
+ mode: mode || 1 /* PBAudioAnalysisMode.MODE_LOGARITHMIC */,
39
+ amplitudeGain: amplitudeGain ?? undefined,
40
+ bandsGain: bandsGain ?? undefined,
41
+ amplitude: 0,
42
+ band0: 0,
43
+ band1: 0,
44
+ band2: 0,
45
+ band3: 0,
46
+ band4: 0,
47
+ band5: 0,
48
+ band6: 0,
49
+ band7: 0
50
+ });
51
+ },
52
+ createOrReplaceAudioAnalysis(entity, mode, amplitudeGain, bandsGain) {
53
+ theComponent.createOrReplace(entity, {
54
+ mode: mode || 1 /* PBAudioAnalysisMode.MODE_LOGARITHMIC */,
55
+ amplitudeGain: amplitudeGain ?? undefined,
56
+ bandsGain: bandsGain ?? undefined,
57
+ amplitude: 0,
58
+ band0: 0,
59
+ band1: 0,
60
+ band2: 0,
61
+ band3: 0,
62
+ band4: 0,
63
+ band5: 0,
64
+ band6: 0,
65
+ band7: 0
66
+ });
67
+ }
68
+ };
69
+ }
70
+ exports.defineAudioAnalysisComponent = defineAudioAnalysisComponent;
@@ -1,6 +1,66 @@
1
1
  import { Entity, IEngine, LastWriteWinElementSetComponentDefinition } from '../../engine';
2
2
  import { Quaternion, Vector2, Vector3 } from '../generated/pb/decentraland/common/vectors.gen';
3
3
  import { EasingFunction, Move, MoveContinuous, PBTween, Rotate, RotateContinuous, Scale, TextureMove, TextureMoveContinuous, TextureMovementType } from '../generated/index.gen';
4
+ /**
5
+ * @public
6
+ * Partial params for Tween.Mode.MoveRotateScale(). At least one of position, rotation, or scale must be provided.
7
+ * Use this when building a mode for Tween.createOrReplace() or TweenSequence (e.g. only positionStart/positionEnd).
8
+ */
9
+ export interface MoveRotateScaleModeParams {
10
+ /** Position tween (start → end). Optional. */
11
+ position?: {
12
+ start: Vector3;
13
+ end: Vector3;
14
+ };
15
+ /** Rotation tween (start → end). Optional. */
16
+ rotation?: {
17
+ start: Quaternion;
18
+ end: Quaternion;
19
+ };
20
+ /** Scale tween (start → end). Optional. */
21
+ scale?: {
22
+ start: Vector3;
23
+ end: Vector3;
24
+ };
25
+ }
26
+ /**
27
+ * @public
28
+ * Parameters for setMoveRotateScale. At least one of position, rotation, or scale must be provided.
29
+ */
30
+ export interface SetMoveRotateScaleParams extends MoveRotateScaleModeParams {
31
+ /** Duration of the tween in milliseconds. */
32
+ duration: number;
33
+ /** Easing function (defaults to EF_LINEAR). */
34
+ easingFunction?: EasingFunction;
35
+ }
36
+ /**
37
+ * @public
38
+ * Partial params for Tween.Mode.MoveRotateScaleContinuous(). At least one of position, rotation, or scale must be provided.
39
+ */
40
+ export interface MoveRotateScaleContinuousModeParams {
41
+ /** Position direction for continuous movement. Optional. */
42
+ position?: {
43
+ direction: Vector3;
44
+ };
45
+ /** Rotation direction for continuous rotation. Optional. */
46
+ rotation?: {
47
+ direction: Quaternion;
48
+ };
49
+ /** Scale direction for continuous scale change. Optional. */
50
+ scale?: {
51
+ direction: Vector3;
52
+ };
53
+ /** Speed of the animation per second. */
54
+ speed: number;
55
+ }
56
+ /**
57
+ * @public
58
+ * Parameters for setMoveRotateScaleContinuous. At least one of position, rotation, or scale must be provided.
59
+ */
60
+ export interface SetMoveRotateScaleContinuousParams extends MoveRotateScaleContinuousModeParams {
61
+ /** Duration in milliseconds (defaults to 0 for infinite). */
62
+ duration?: number;
63
+ }
4
64
  /**
5
65
  * @public
6
66
  */
@@ -33,6 +93,16 @@ export interface TweenHelper {
33
93
  * @returns a texture-move-continuous mode tween
34
94
  */
35
95
  TextureMoveContinuous: (textureMove: TextureMoveContinuous) => PBTween['mode'];
96
+ /**
97
+ * @returns a move-rotate-scale mode tween
98
+ * @param params - partial transform (at least one of position, rotation, scale); omit axes you don't need
99
+ */
100
+ MoveRotateScale: (params: MoveRotateScaleModeParams) => PBTween['mode'];
101
+ /**
102
+ * @returns a move-rotate-scale-continuous mode tween
103
+ * @param params - partial transform (at least one of position, rotation, scale) + speed; omit axes you don't need
104
+ */
105
+ MoveRotateScaleContinuous: (params: MoveRotateScaleContinuousModeParams) => PBTween['mode'];
36
106
  }
37
107
  /**
38
108
  * @public
@@ -118,5 +188,25 @@ export interface TweenComponentDefinitionExtended extends LastWriteWinElementSet
118
188
  * @param duration - duration of the tween in milliseconds (defaults to 0 for infinite)
119
189
  */
120
190
  setTextureMoveContinuous(entity: Entity, direction: Vector2, speed: number, movementType?: TextureMovementType, duration?: number): void;
191
+ /**
192
+ * @public
193
+ *
194
+ * Creates or replaces a move-rotate-scale tween component that simultaneously animates
195
+ * an entity's position, rotation, and/or scale from start to end. Provide only the
196
+ * properties you need (at least one of position, rotation, or scale).
197
+ * @param entity - entity to apply the tween to
198
+ * @param params - object with optional position, rotation, scale (each with start/end), duration, and optional easingFunction
199
+ */
200
+ setMoveRotateScale(entity: Entity, params: SetMoveRotateScaleParams): void;
201
+ /**
202
+ * @public
203
+ *
204
+ * Creates or replaces a continuous move-rotate-scale tween component that simultaneously
205
+ * moves, rotates, and/or scales an entity continuously. Provide only the properties
206
+ * you need (at least one of position, rotation, or scale).
207
+ * @param entity - entity to apply the tween to
208
+ * @param params - object with optional position, rotation, scale (each with direction), speed, and optional duration
209
+ */
210
+ setMoveRotateScaleContinuous(entity: Entity, params: SetMoveRotateScaleContinuousParams): void;
121
211
  }
122
212
  export declare function defineTweenComponent(engine: Pick<IEngine, 'defineComponentFromSchema'>): TweenComponentDefinitionExtended;
@@ -2,6 +2,77 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.defineTweenComponent = void 0;
4
4
  const index_gen_1 = require("../generated/index.gen");
5
+ function validateAtLeastOneMoveRotateScale(hasPosition, hasRotation, hasScale, apiName) {
6
+ if (!hasPosition && !hasRotation && !hasScale) {
7
+ throw new Error(`${apiName}: at least one of position, rotation, or scale must be provided`);
8
+ }
9
+ }
10
+ function validateDuration(duration, apiName) {
11
+ if (typeof duration !== 'number' || !Number.isFinite(duration) || duration < 0) {
12
+ throw new Error(`${apiName}: duration must be a non-negative finite number`);
13
+ }
14
+ }
15
+ function validateSpeed(speed, apiName) {
16
+ if (typeof speed !== 'number' || !Number.isFinite(speed)) {
17
+ throw new Error(`${apiName}: speed must be a finite number`);
18
+ }
19
+ }
20
+ /** Shared validation for params that have optional position/rotation/scale with start & end. */
21
+ function validateMoveRotateScaleAxesStartEnd(params, apiName) {
22
+ const hasPosition = params.position != null;
23
+ const hasRotation = params.rotation != null;
24
+ const hasScale = params.scale != null;
25
+ validateAtLeastOneMoveRotateScale(hasPosition, hasRotation, hasScale, apiName);
26
+ if (hasPosition) {
27
+ const pos = params.position;
28
+ if (pos.start == null || pos.end == null) {
29
+ throw new Error(`${apiName}: position must have both start and end`);
30
+ }
31
+ }
32
+ if (hasRotation) {
33
+ const rot = params.rotation;
34
+ if (rot.start == null || rot.end == null) {
35
+ throw new Error(`${apiName}: rotation must have both start and end`);
36
+ }
37
+ }
38
+ if (hasScale) {
39
+ const scl = params.scale;
40
+ if (scl.start == null || scl.end == null) {
41
+ throw new Error(`${apiName}: scale must have both start and end`);
42
+ }
43
+ }
44
+ }
45
+ /** Shared validation for params that have optional position/rotation/scale with direction + speed. */
46
+ function validateMoveRotateScaleAxesDirection(params, apiName) {
47
+ const hasPosition = params.position != null;
48
+ const hasRotation = params.rotation != null;
49
+ const hasScale = params.scale != null;
50
+ validateAtLeastOneMoveRotateScale(hasPosition, hasRotation, hasScale, apiName);
51
+ validateSpeed(params.speed, apiName);
52
+ if (hasPosition && params.position.direction == null) {
53
+ throw new Error(`${apiName}: position must have direction`);
54
+ }
55
+ if (hasRotation && params.rotation.direction == null) {
56
+ throw new Error(`${apiName}: rotation must have direction`);
57
+ }
58
+ if (hasScale && params.scale.direction == null) {
59
+ throw new Error(`${apiName}: scale must have direction`);
60
+ }
61
+ }
62
+ function validateSetMoveRotateScaleParams(params, apiName) {
63
+ validateMoveRotateScaleModeParams(params, apiName);
64
+ validateDuration(params.duration, apiName);
65
+ }
66
+ function validateSetMoveRotateScaleContinuousParams(params, apiName) {
67
+ validateMoveRotateScaleContinuousModeParams(params, apiName);
68
+ validateDuration(params.duration ?? 0, apiName);
69
+ }
70
+ function validateMoveRotateScaleModeParams(params, apiName) {
71
+ validateMoveRotateScaleAxesStartEnd(params, apiName);
72
+ }
73
+ function validateMoveRotateScaleContinuousModeParams(params, apiName) {
74
+ validateMoveRotateScaleAxesDirection(params, apiName);
75
+ }
5
76
  const TweenHelper = {
6
77
  Move(move) {
7
78
  return {
@@ -44,6 +115,40 @@ const TweenHelper = {
44
115
  $case: 'textureMoveContinuous',
45
116
  textureMoveContinuous
46
117
  };
118
+ },
119
+ MoveRotateScale(params) {
120
+ validateMoveRotateScaleModeParams(params, 'Tween.Mode.MoveRotateScale');
121
+ const hasPosition = params.position != null;
122
+ const hasRotation = params.rotation != null;
123
+ const hasScale = params.scale != null;
124
+ const moveRotateScale = {
125
+ positionStart: hasPosition ? params.position.start : undefined,
126
+ positionEnd: hasPosition ? params.position.end : undefined,
127
+ rotationStart: hasRotation ? params.rotation.start : undefined,
128
+ rotationEnd: hasRotation ? params.rotation.end : undefined,
129
+ scaleStart: hasScale ? params.scale.start : undefined,
130
+ scaleEnd: hasScale ? params.scale.end : undefined
131
+ };
132
+ return {
133
+ $case: 'moveRotateScale',
134
+ moveRotateScale
135
+ };
136
+ },
137
+ MoveRotateScaleContinuous(params) {
138
+ validateMoveRotateScaleContinuousModeParams(params, 'Tween.Mode.MoveRotateScaleContinuous');
139
+ const hasPosition = params.position != null;
140
+ const hasRotation = params.rotation != null;
141
+ const hasScale = params.scale != null;
142
+ const moveRotateScaleContinuous = {
143
+ positionDirection: hasPosition ? params.position.direction : undefined,
144
+ rotationDirection: hasRotation ? params.rotation.direction : undefined,
145
+ scaleDirection: hasScale ? params.scale.direction : undefined,
146
+ speed: params.speed
147
+ };
148
+ return {
149
+ $case: 'moveRotateScaleContinuous',
150
+ moveRotateScaleContinuous
151
+ };
47
152
  }
48
153
  };
49
154
  function defineTweenComponent(engine) {
@@ -150,6 +255,53 @@ function defineTweenComponent(engine) {
150
255
  easingFunction: 0 /* EasingFunction.EF_LINEAR */,
151
256
  playing: true
152
257
  });
258
+ },
259
+ setMoveRotateScale(entity, params) {
260
+ validateSetMoveRotateScaleParams(params, 'setMoveRotateScale');
261
+ const { position, rotation, scale, duration, easingFunction = 0 /* EasingFunction.EF_LINEAR */ } = params;
262
+ const hasPosition = position != null;
263
+ const hasRotation = rotation != null;
264
+ const hasScale = scale != null;
265
+ const moveRotateScale = {
266
+ positionStart: hasPosition ? position.start : undefined,
267
+ positionEnd: hasPosition ? position.end : undefined,
268
+ rotationStart: hasRotation ? rotation.start : undefined,
269
+ rotationEnd: hasRotation ? rotation.end : undefined,
270
+ scaleStart: hasScale ? scale.start : undefined,
271
+ scaleEnd: hasScale ? scale.end : undefined
272
+ };
273
+ theComponent.createOrReplace(entity, {
274
+ mode: {
275
+ $case: 'moveRotateScale',
276
+ moveRotateScale
277
+ },
278
+ duration,
279
+ easingFunction,
280
+ playing: true
281
+ });
282
+ },
283
+ setMoveRotateScaleContinuous(entity, params) {
284
+ const duration = params.duration ?? 0;
285
+ validateSetMoveRotateScaleContinuousParams(params, 'setMoveRotateScaleContinuous');
286
+ const { position, rotation, scale, speed } = params;
287
+ const hasPosition = position != null;
288
+ const hasRotation = rotation != null;
289
+ const hasScale = scale != null;
290
+ const moveRotateScaleContinuous = {
291
+ positionDirection: hasPosition ? position.direction : undefined,
292
+ rotationDirection: hasRotation ? rotation.direction : undefined,
293
+ scaleDirection: hasScale ? scale.direction : undefined,
294
+ speed
295
+ };
296
+ theComponent.createOrReplace(entity, {
297
+ mode: {
298
+ $case: 'moveRotateScaleContinuous',
299
+ moveRotateScaleContinuous
300
+ },
301
+ duration,
302
+ easingFunction: 0 /* EasingFunction.EF_LINEAR */,
303
+ playing: true
304
+ });
153
305
  }
154
306
  };
155
307
  }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AudioAnalysisSchema = void 0;
4
+ const audio_analysis_gen_1 = require("./pb/decentraland/sdk/components/audio_analysis.gen");
5
+ /**
6
+ * @internal
7
+ */
8
+ exports.AudioAnalysisSchema = {
9
+ COMPONENT_ID: 1212,
10
+ serialize(value, builder) {
11
+ const writer = audio_analysis_gen_1.PBAudioAnalysis.encode(value);
12
+ const buffer = new Uint8Array(writer.finish(), 0, writer.len);
13
+ builder.writeBuffer(buffer, false);
14
+ },
15
+ deserialize(reader) {
16
+ return audio_analysis_gen_1.PBAudioAnalysis.decode(reader.buffer(), reader.remainingBytes());
17
+ },
18
+ create() {
19
+ // TODO: this is a hack.
20
+ return audio_analysis_gen_1.PBAudioAnalysis.decode(new Uint8Array());
21
+ },
22
+ jsonSchema: {
23
+ type: "object",
24
+ properties: {},
25
+ serializationType: "protocol-buffer",
26
+ protocolBuffer: "PBAudioAnalysis"
27
+ }
28
+ };
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AvatarLocomotionSettingsSchema = void 0;
4
+ const avatar_locomotion_settings_gen_1 = require("./pb/decentraland/sdk/components/avatar_locomotion_settings.gen");
5
+ /**
6
+ * @internal
7
+ */
8
+ exports.AvatarLocomotionSettingsSchema = {
9
+ COMPONENT_ID: 1211,
10
+ serialize(value, builder) {
11
+ const writer = avatar_locomotion_settings_gen_1.PBAvatarLocomotionSettings.encode(value);
12
+ const buffer = new Uint8Array(writer.finish(), 0, writer.len);
13
+ builder.writeBuffer(buffer, false);
14
+ },
15
+ deserialize(reader) {
16
+ return avatar_locomotion_settings_gen_1.PBAvatarLocomotionSettings.decode(reader.buffer(), reader.remainingBytes());
17
+ },
18
+ create() {
19
+ // TODO: this is a hack.
20
+ return avatar_locomotion_settings_gen_1.PBAvatarLocomotionSettings.decode(new Uint8Array());
21
+ },
22
+ jsonSchema: {
23
+ type: "object",
24
+ properties: {},
25
+ serializationType: "protocol-buffer",
26
+ protocolBuffer: "PBAvatarLocomotionSettings"
27
+ }
28
+ };
@@ -9,6 +9,7 @@ exports.coreComponentMappings = {
9
9
  "core::Animator": 1042,
10
10
  "core::AssetLoad": 1213,
11
11
  "core::AssetLoadLoadingState": 1214,
12
+ "core::AudioAnalysis": 1212,
12
13
  "core::AudioEvent": 1105,
13
14
  "core::AudioSource": 1020,
14
15
  "core::AudioStream": 1021,
@@ -16,6 +17,7 @@ exports.coreComponentMappings = {
16
17
  "core::AvatarBase": 1087,
17
18
  "core::AvatarEmoteCommand": 1088,
18
19
  "core::AvatarEquippedData": 1091,
20
+ "core::AvatarLocomotionSettings": 1211,
19
21
  "core::AvatarModifierArea": 1070,
20
22
  "core::AvatarShape": 1080,
21
23
  "core::Billboard": 1090,
@@ -2,6 +2,7 @@ import { LastWriteWinElementSetComponentDefinition, GrowOnlyValueSetComponentDef
2
2
  export * from './index.gen';
3
3
  import { PBAssetLoad } from './pb/decentraland/sdk/components/asset_load.gen';
4
4
  import { PBAssetLoadLoadingState } from './pb/decentraland/sdk/components/asset_load_loading_state.gen';
5
+ import { PBAudioAnalysis } from './pb/decentraland/sdk/components/audio_analysis.gen';
5
6
  import { PBAudioEvent } from './pb/decentraland/sdk/components/audio_event.gen';
6
7
  import { PBAudioSource } from './pb/decentraland/sdk/components/audio_source.gen';
7
8
  import { PBAudioStream } from './pb/decentraland/sdk/components/audio_stream.gen';
@@ -9,6 +10,7 @@ import { PBAvatarAttach } from './pb/decentraland/sdk/components/avatar_attach.g
9
10
  import { PBAvatarBase } from './pb/decentraland/sdk/components/avatar_base.gen';
10
11
  import { PBAvatarEmoteCommand } from './pb/decentraland/sdk/components/avatar_emote_command.gen';
11
12
  import { PBAvatarEquippedData } from './pb/decentraland/sdk/components/avatar_equipped_data.gen';
13
+ import { PBAvatarLocomotionSettings } from './pb/decentraland/sdk/components/avatar_locomotion_settings.gen';
12
14
  import { PBAvatarModifierArea } from './pb/decentraland/sdk/components/avatar_modifier_area.gen';
13
15
  import { PBAvatarShape } from './pb/decentraland/sdk/components/avatar_shape.gen';
14
16
  import { PBBillboard } from './pb/decentraland/sdk/components/billboard.gen';
@@ -50,6 +52,7 @@ import { PBVirtualCamera } from './pb/decentraland/sdk/components/virtual_camera
50
52
  import { PBVisibilityComponent } from './pb/decentraland/sdk/components/visibility_component.gen';
51
53
  /** @public */ export declare const AssetLoad: LastWriteWinElementSetComponentDefinition<PBAssetLoad>;
52
54
  /** @public */ export declare const AssetLoadLoadingState: GrowOnlyValueSetComponentDefinition<PBAssetLoadLoadingState>;
55
+ /** @public */ export declare const AudioAnalysis: LastWriteWinElementSetComponentDefinition<PBAudioAnalysis>;
53
56
  /** @public */ export declare const AudioEvent: GrowOnlyValueSetComponentDefinition<PBAudioEvent>;
54
57
  /** @public */ export declare const AudioSource: LastWriteWinElementSetComponentDefinition<PBAudioSource>;
55
58
  /** @public */ export declare const AudioStream: LastWriteWinElementSetComponentDefinition<PBAudioStream>;
@@ -57,6 +60,7 @@ import { PBVisibilityComponent } from './pb/decentraland/sdk/components/visibili
57
60
  /** @public */ export declare const AvatarBase: LastWriteWinElementSetComponentDefinition<PBAvatarBase>;
58
61
  /** @public */ export declare const AvatarEmoteCommand: GrowOnlyValueSetComponentDefinition<PBAvatarEmoteCommand>;
59
62
  /** @public */ export declare const AvatarEquippedData: LastWriteWinElementSetComponentDefinition<PBAvatarEquippedData>;
63
+ /** @public */ export declare const AvatarLocomotionSettings: LastWriteWinElementSetComponentDefinition<PBAvatarLocomotionSettings>;
60
64
  /** @public */ export declare const AvatarModifierArea: LastWriteWinElementSetComponentDefinition<PBAvatarModifierArea>;
61
65
  /** @public */ export declare const AvatarShape: LastWriteWinElementSetComponentDefinition<PBAvatarShape>;
62
66
  /** @public */ export declare const Billboard: LastWriteWinElementSetComponentDefinition<PBBillboard>;