Skip to content

Commit cae33b0

Browse files
authored
Merge pull request #6125 from decentraland/release/release-20240311
Release 20240311
2 parents 73c9e03 + 709c66b commit cae33b0

File tree

12 files changed

+272
-442
lines changed

12 files changed

+272
-442
lines changed

browser-interface/packages/shared/chat/sagas.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ function initChatCommands() {
216216

217217
if (isValidPosition) {
218218
const { x, y } = coordinates
219-
TeleportController.goTo(x, y).then(
219+
TeleportController.goTo(x, y, false).then(
220220
({ message }) => notifyStatusThroughChat(message),
221221
() => {
222222
// Do nothing. This is handled inside controller

browser-interface/packages/shared/scene-loader/sagas.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,13 @@ function* teleportHandler(action: TeleportToAction) {
135135
try {
136136
// look for the target scene
137137
const pointer = encodeParcelPosition(worldToGrid(action.payload.position))
138-
const command: SetDesiredScenesCommand = yield apply(sceneLoader, sceneLoader.fetchScenesByLocation, [[pointer]])
139-
138+
const command: SetDesiredScenesCommand = yield call(sceneLoader.fetchScenesByLocation, [pointer])
140139
// is a target scene, then it will be used to settle the position
141140
if (command && command.scenes && command.scenes.length) {
142141
// pick always the first scene to unsettle the position once loaded
143142
const settlerScene = command.scenes[0].id
144143

145144
const scene: SceneWorker | undefined = yield call(getSceneWorkerBySceneID, settlerScene)
146-
147145
const spawnPoint =
148146
pickWorldSpawnpoint(
149147
scene?.metadata || command.scenes[0].entity.metadata,

browser-interface/packages/shared/scene-loader/world-loader-impl/index.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,32 @@ export async function createWorldLoader(options: { urns: string[] }): Promise<IS
3131
const emptyParcelController = new EmptyParcelController({ rootUrl: getResourcesURL('.') })
3232

3333
return {
34-
async fetchScenesByLocation(_parcels) {
35-
return { scenes }
34+
async fetchScenesByLocation(parcels) {
35+
// If the world has only one scene, return always that scene.
36+
if (scenes.length === 1) {
37+
return { scenes }
38+
}
39+
40+
// Worlds with more than one scene deployed.
41+
const newScenes = new Set<LoadableScene>()
42+
// First add the scenes based on the location (parcels)
43+
// If there is no scene, add an empty scene.
44+
for (const parcel of parcels) {
45+
const scene = mappingScene.get(parcel)
46+
if (scene) {
47+
newScenes.add(scene)
48+
} else {
49+
const scene = await emptyParcelController.createFakeEntity(parcel)
50+
51+
mappingScene.set(parcel, scene)
52+
newScenes.add(scene)
53+
}
54+
}
55+
// Add the rest of the scenes.
56+
for (const [_, scene] of mappingScene) {
57+
newScenes.add(scene)
58+
}
59+
return { scenes: [...newScenes] }
3660
},
3761
async reportPosition(positionReport) {
3862
const newScenes: Set<LoadableScene> = new Set()

browser-interface/packages/shared/world/TeleportController.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ export class TeleportController {
9494
teleportMessage?: string
9595
): Promise<{ message: string; success: boolean }> {
9696
const tpMessage: string = teleportMessage ? teleportMessage : `Teleporting to ${x}, ${y}...`
97+
9798
if (isInsideWorldLimits(x, y)) {
9899
try {
99100
if (goToMostPopulatedRealm) await changeToMostPopulatedRealm()

unity-renderer/Assets/Scripts/MainScripts/DCL/Components/Avatar/AvatarAnimationEventHandler.cs

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,43 @@
11
using System.Collections;
2-
using System.Collections.Generic;
32
using UnityEngine;
43
using DCL;
54

65
public class AvatarAnimationEventHandler : MonoBehaviour
76
{
8-
const string FOOTSTEP_NAME = "footstep", HEART_NAME = "heart";
9-
const string ANIM_NAME_KISS = "kiss", ANIM_NAME_MONEY = "money", ANIM_NAME_CLAP = "clap", ANIM_NAME_SNOWFLAKE = "snowfall", ANIM_NAME_HOHOHO = "hohoho";
10-
const float MIN_EVENT_WAIT_TIME = 0.1f;
11-
const float HOHOHO_OFFSET = 1.5f;
7+
private const string FOOTSTEP_NAME = "footstep", HEART_NAME = "heart";
8+
private const string ANIM_NAME_KISS = "kiss", ANIM_NAME_MONEY = "money", ANIM_NAME_CLAP = "clap", ANIM_NAME_SNOWFLAKE = "snowfall", ANIM_NAME_HOHOHO = "hohoho";
9+
private const float MIN_EVENT_WAIT_TIME = 0.1f;
10+
private const float HOHOHO_OFFSET = 1.5f;
1211

13-
AudioEvent footstepLight;
14-
AudioEvent footstepSlide;
15-
AudioEvent footstepWalk;
16-
AudioEvent footstepRun;
17-
AudioEvent clothesRustleShort;
18-
AudioEvent clap;
19-
AudioEvent throwMoney;
20-
AudioEvent blowKiss;
12+
private AudioEvent footstepLight;
13+
private AudioEvent footstepSlide;
14+
private AudioEvent footstepWalk;
15+
private AudioEvent footstepRun;
16+
private AudioEvent clothesRustleShort;
17+
private AudioEvent clap;
18+
private AudioEvent throwMoney;
19+
private AudioEvent blowKiss;
2120

22-
Animation anim;
21+
private Animation anim;
2322

24-
float lastEventTime;
23+
private float lastEventTime;
2524

26-
StickersController stickersController;
25+
private StickersController stickersController;
2726

28-
Transform footL;
29-
Transform footR;
30-
Transform handL;
31-
Transform handR;
27+
private int renderingLayer;
3228

33-
public void Init(AudioContainer audioContainer)
29+
private Transform footL;
30+
private Transform footR;
31+
private Transform handL;
32+
private Transform handR;
33+
34+
public void Init(AudioContainer audioContainer, int renderingLayer)
3435
{
3536
if (audioContainer == null)
3637
return;
3738

39+
this.renderingLayer = renderingLayer;
40+
3841
footstepLight = audioContainer.GetEvent("FootstepLight");
3942
footstepSlide = audioContainer.GetEvent("FootstepSlide");
4043
footstepWalk = audioContainer.GetEvent("FootstepWalk");
@@ -65,13 +68,13 @@ public void Init(AudioContainer audioContainer)
6568
public void AnimEvent_FootstepRunLeft()
6669
{
6770
PlayAudioEvent(footstepRun);
68-
PlaySticker(FOOTSTEP_NAME, footL.position, Vector3.up);
71+
PlaySticker(FOOTSTEP_NAME, footL.position, Vector3.up, renderingLayer: renderingLayer);
6972
}
7073

7174
public void AnimEvent_FootstepRunRight()
7275
{
7376
PlayAudioEvent(footstepRun);
74-
PlaySticker(FOOTSTEP_NAME, footR.position, Vector3.up);
77+
PlaySticker(FOOTSTEP_NAME, footR.position, Vector3.up, renderingLayer: renderingLayer);
7578
}
7679

7780
public void AnimEvent_ClothesRustleShort() { PlayAudioEvent(clothesRustleShort); }
@@ -85,7 +88,7 @@ public void AnimEvent_Clap()
8588
return;
8689

8790
PlayAudioEvent(clap);
88-
PlaySticker(ANIM_NAME_CLAP, handR.position, Vector3.up, true);
91+
PlaySticker(ANIM_NAME_CLAP, handR.position, Vector3.up, true, renderingLayer: renderingLayer);
8992
UpdateEventTime();
9093
}
9194

@@ -98,7 +101,7 @@ public void AnimEvent_ThrowMoney()
98101
return;
99102

100103
PlayAudioEvent(throwMoney);
101-
PlaySticker(ANIM_NAME_MONEY, handL.position, handL.rotation.eulerAngles, true);
104+
PlaySticker(ANIM_NAME_MONEY, handL.position, handL.rotation.eulerAngles, true, renderingLayer: renderingLayer);
102105
UpdateEventTime();
103106
}
104107

@@ -115,10 +118,10 @@ public void AnimEvent_BlowKiss()
115118
UpdateEventTime();
116119
}
117120

118-
IEnumerator EmitHeartParticle()
121+
private IEnumerator EmitHeartParticle()
119122
{
120123
yield return new WaitForSeconds(0.8f);
121-
PlaySticker(HEART_NAME, handR.position, transform.rotation.eulerAngles, true);
124+
PlaySticker(HEART_NAME, handR.position, transform.rotation.eulerAngles, true, renderingLayer: renderingLayer);
122125
}
123126

124127
public void AnimEvent_Snowflakes()
@@ -129,27 +132,27 @@ public void AnimEvent_Snowflakes()
129132
if (!AnimationWeightIsOverThreshold(0.2f, ANIM_NAME_SNOWFLAKE))
130133
return;
131134

132-
PlaySticker("snowflakes", transform.position, Vector3.zero, true);
135+
PlaySticker("snowflakes", transform.position, Vector3.zero, true, renderingLayer: renderingLayer);
133136
}
134137

135138
public void AnimEvent_Hohoho()
136139
{
137140
if (LastEventWasTooRecent())
138141
return;
139-
142+
140143
if (!AnimationWeightIsOverThreshold(0.2f, ANIM_NAME_HOHOHO))
141144
return;
142145

143-
PlaySticker(ANIM_NAME_HOHOHO, transform.position + Vector3.up * HOHOHO_OFFSET, Vector3.zero, true);
146+
PlaySticker(ANIM_NAME_HOHOHO, transform.position + Vector3.up * HOHOHO_OFFSET, Vector3.zero, true, renderingLayer: renderingLayer);
144147
}
145148

146-
void PlayAudioEvent(AudioEvent audioEvent)
149+
private void PlayAudioEvent(AudioEvent audioEvent)
147150
{
148151
if (audioEvent != null)
149152
audioEvent.Play(true);
150153
}
151154

152-
bool AnimationWeightIsOverThreshold(float threshold, string animationName)
155+
private bool AnimationWeightIsOverThreshold(float threshold, string animationName)
153156
{
154157
if (anim != null)
155158
{
@@ -170,25 +173,23 @@ bool AnimationWeightIsOverThreshold(float threshold, string animationName)
170173
return false;
171174
}
172175

173-
void UpdateEventTime()
176+
private void UpdateEventTime()
174177
{
175178
lastEventTime = Time.realtimeSinceStartup;
176179
}
177180

178-
bool LastEventWasTooRecent()
179-
{
180-
return lastEventTime + MIN_EVENT_WAIT_TIME >= Time.realtimeSinceStartup;
181-
}
181+
private bool LastEventWasTooRecent() =>
182+
lastEventTime + MIN_EVENT_WAIT_TIME >= Time.realtimeSinceStartup;
182183

183184
/// <summary>
184185
/// Plays a sticker.
185186
/// </summary>
186187
/// <param name="id">ID string of sticker</param>
187188
/// <param name="position">Position in world space</param>
188189
/// <param name="rotation">Euler angles</param>
189-
void PlaySticker(string id, Vector3 position, Vector3 direction, bool followTransform = false)
190+
private void PlaySticker(string id, Vector3 position, Vector3 direction, bool followTransform = false, int renderingLayer = 0)
190191
{
191192
if (stickersController != null)
192-
stickersController.PlaySticker(id, position, direction, followTransform);
193+
stickersController.PlaySticker(id, position, direction, followTransform, renderingLayer);
193194
}
194-
}
195+
}

unity-renderer/Assets/Scripts/MainScripts/DCL/Components/Avatar/AvatarAnimatorLegacy.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public class BlackBoard
8383

8484
[SerializeField] internal AvatarLocomotion femaleLocomotions;
8585
[SerializeField] internal AvatarLocomotion maleLocomotions;
86+
[SerializeField] internal string renderingLayer = "Default";
8687
private AvatarLocomotion currentLocomotions;
8788

8889
public new Animation animation;
@@ -550,7 +551,7 @@ private void InitializeAvatarAudioAndParticleHandlers(Animation createdAnimation
550551

551552
if (audioContainer != null)
552553
{
553-
animationEventHandler.Init(audioContainer);
554+
animationEventHandler.Init(audioContainer, LayerMask.NameToLayer(renderingLayer));
554555

555556
//NOTE(Mordi): If this is a remote avatar, pass the animation component so we can keep track of whether it is culled (off-screen) or not
556557
AvatarAudioHandlerRemote audioHandlerRemote = audioContainer.GetComponent<AvatarAudioHandlerRemote>();

unity-renderer/Assets/Scripts/MainScripts/DCL/Components/Avatar/AvatarShape.prefab

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ MonoBehaviour:
9191
baseAvatarContainer: {fileID: 4288110136316019743}
9292
baseAvatarReferencesPrefab: {fileID: 4766333532709993497, guid: 7bf2abf753051c34c9e0a568a90fc0f0,
9393
type: 3}
94-
boneAnchors: []
9594
everythingIsLoaded: 0
9695
--- !u!114 &122622683908687435
9796
MonoBehaviour:
@@ -165,6 +164,7 @@ MonoBehaviour:
165164
run: {fileID: 7400000, guid: 916369dcf45c5944e9f2409e0be10181, type: 2}
166165
jump: {fileID: 7400000, guid: b51f09eb09017384a8ff4b3b88b00c00, type: 2}
167166
fall: {fileID: 7400000, guid: cd48d8cde6039fa4fac548ddab2ff277, type: 2}
167+
renderingLayer: Default
168168
animation: {fileID: 0}
169169
blackboard:
170170
walkSpeedFactor: 0.3

0 commit comments

Comments
 (0)