Fix friends not being shown in current user instance while traveling

This commit is contained in:
Natsumi
2023-06-03 07:24:19 +12:00
parent fc4d94c279
commit 11d92cabba
2 changed files with 26 additions and 36 deletions

View File

@@ -65,6 +65,7 @@
],
"no-inline-comments": 0,
"no-invalid-this": 0,
"no-loop-func": 0,
"no-magic-numbers": 0,
"no-negated-condition": 0,
"no-plusplus": 0,

View File

@@ -15630,14 +15630,9 @@ speechSynthesis.getVoices();
var friendsInInstance = this.lastLocation.friendList;
for (var friend of friendsInInstance.values()) {
// if friend isn't in instance add them
var addUser = true;
for (var k = 0; k < users.length; k++) {
var user = users[k];
if (friend.displayName === user.displayName) {
addUser = false;
break;
}
}
var addUser = !users.some(function (user) {
return friend.displayName === user.displayName;
});
if (addUser) {
var ref = API.cachedUsers.get(friend.userId);
if (typeof ref !== 'undefined') {
@@ -15646,7 +15641,8 @@ speechSynthesis.getVoices();
}
}
friendCount = users.length - 1;
} else if (!L.isOffline) {
}
if (!L.isOffline) {
for (var friend of this.friends.values()) {
if (typeof friend.ref === 'undefined') {
continue;
@@ -15659,7 +15655,13 @@ speechSynthesis.getVoices();
// don't add offline friends to private instances
continue;
}
users.push(friend.ref);
// if friend isn't in instance add them
var addUser = !users.some(function (user) {
return friend.name === user.displayName;
});
if (addUser) {
users.push(friend.ref);
}
}
}
friendCount = users.length;
@@ -15851,14 +15853,9 @@ speechSynthesis.getVoices();
if (player.displayName === API.currentUser.displayName) {
continue;
}
var addUser = true;
for (var k = 0; k < users.length; k++) {
var user = users[k];
if (player.displayName === user.displayName) {
addUser = false;
break;
}
}
var addUser = !users.some(function (user) {
return player.displayName === user.displayName;
});
if (addUser) {
var ref = API.cachedUsers.get(player.userId);
if (typeof ref !== 'undefined') {
@@ -16800,14 +16797,9 @@ speechSynthesis.getVoices();
instances[instance.id] = instance;
for (var friend of friendsInInstance.values()) {
// if friend isn't in instance add them
var addUser = true;
for (var k = 0; k < instance.users.length; k++) {
var user = instance.users[k];
if (friend.displayName === user.displayName) {
addUser = false;
break;
}
}
var addUser = !instance.users.some(function (user) {
return friend.displayName === user.displayName;
});
if (addUser) {
var ref = API.cachedUsers.get(friend.userId);
if (typeof ref !== 'undefined') {
@@ -16822,7 +16814,8 @@ speechSynthesis.getVoices();
typeof ref.$location === 'undefined' ||
ref.$location.worldId !== D.id ||
(ref.$location.instanceId === lastLocation$.instanceId &&
playersInInstance.size > 0)
playersInInstance.size > 0 &&
ref.location !== 'traveling')
) {
continue;
}
@@ -16970,14 +16963,9 @@ speechSynthesis.getVoices();
instances[currentLocation] = instance;
for (var friend of friendsInInstance.values()) {
// if friend isn't in instance add them
var addUser = true;
for (var k = 0; k < instance.users.length; k++) {
var user = instance.users[k];
if (friend.displayName === user.displayName) {
addUser = false;
break;
}
}
var addUser = !instance.users.some(function (user) {
return friend.displayName === user.displayName;
});
if (addUser) {
var ref = API.cachedUsers.get(friend.userId);
if (typeof ref !== 'undefined') {
@@ -16992,7 +16980,8 @@ speechSynthesis.getVoices();
typeof ref.$location === 'undefined' ||
ref.$location.groupId !== D.id ||
(ref.$location.instanceId === lastLocation$.instanceId &&
playersInInstance.size > 0)
playersInInstance.size > 0 &&
ref.location !== 'traveling')
) {
continue;
}