mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 14:53:50 +02:00
Only use playersInInstance for current instance user list
This commit is contained in:
@@ -7539,21 +7539,12 @@ speechSynthesis.getVoices();
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var users = [];
|
var users = [];
|
||||||
if (L.isOffline === false) {
|
var playersInInstance = this.lastLocation.playerList;
|
||||||
for (var { ref } of this.friends.values()) {
|
if ((this.lastLocation.location === L.tag) && (playersInInstance.length > 0)) {
|
||||||
if (typeof ref !== 'undefined' &&
|
|
||||||
ref.location === L.tag) {
|
|
||||||
users.push(ref);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this.isGameRunning &&
|
|
||||||
this.lastLocation.location === L.tag) {
|
|
||||||
var ref = API.cachedUsers.get(API.currentUser.id);
|
var ref = API.cachedUsers.get(API.currentUser.id);
|
||||||
if (typeof ref === 'undefined') {
|
if (typeof ref === 'undefined') {
|
||||||
ref = API.currentUser;
|
ref = API.currentUser;
|
||||||
}
|
}
|
||||||
var playersInInstance = this.lastLocation.playerList;
|
|
||||||
if (playersInInstance.includes(ref.displayName)) {
|
if (playersInInstance.includes(ref.displayName)) {
|
||||||
users.push(ref);
|
users.push(ref);
|
||||||
}
|
}
|
||||||
@@ -7577,6 +7568,15 @@ speechSynthesis.getVoices();
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (L.isOffline === false) {
|
||||||
|
for (var { ref } of this.friends.values()) {
|
||||||
|
if (typeof ref !== 'undefined' &&
|
||||||
|
ref.location === L.tag) {
|
||||||
|
users.push(ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
users.sort(compareByDisplayName);
|
users.sort(compareByDisplayName);
|
||||||
D.users = users;
|
D.users = users;
|
||||||
@@ -8085,45 +8085,26 @@ speechSynthesis.getVoices();
|
|||||||
users: []
|
users: []
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
for (var { ref } of this.friends.values()) {
|
var lastLocation$ = API.parseLocation(this.lastLocation.location);
|
||||||
if (typeof ref === 'undefined' ||
|
var playersInInstance = this.lastLocation.playerList;
|
||||||
typeof ref.$location === 'undefined' ||
|
if ((lastLocation$.worldId === D.id) && (playersInInstance.length > 0)) {
|
||||||
ref.$location.worldId !== D.id) {
|
var instance = instances[lastLocation$.instanceId];
|
||||||
continue;
|
|
||||||
}
|
|
||||||
var { instanceId } = ref.$location;
|
|
||||||
var instance = instances[instanceId];
|
|
||||||
if (typeof instance === 'undefined') {
|
if (typeof instance === 'undefined') {
|
||||||
instance = {
|
instance = {
|
||||||
id: instanceId,
|
|
||||||
occupants: 0,
|
|
||||||
users: []
|
|
||||||
};
|
|
||||||
instances[instanceId] = instance;
|
|
||||||
}
|
|
||||||
instance.users.push(ref);
|
|
||||||
}
|
|
||||||
if (this.isGameRunning) {
|
|
||||||
var lastLocation$ = API.parseLocation(this.lastLocation.location);
|
|
||||||
if (lastLocation$.worldId === D.id) {
|
|
||||||
var instance = instances[lastLocation$.instanceId];
|
|
||||||
if (typeof instance === 'undefined') {
|
|
||||||
instance = {
|
|
||||||
id: lastLocation$.instanceId,
|
id: lastLocation$.instanceId,
|
||||||
occupants: 1,
|
occupants: 1,
|
||||||
users: []
|
users: []
|
||||||
};
|
};
|
||||||
instances[instance.id] = instance;
|
instances[instance.id] = instance;
|
||||||
}
|
}
|
||||||
instances[instance.id].occupants = this.lastLocation.playerList.length;
|
instances[instance.id].occupants = playersInInstance.length;
|
||||||
var ref = API.cachedUsers.get(API.currentUser.id);
|
var ref = API.cachedUsers.get(API.currentUser.id);
|
||||||
if (typeof ref === 'undefined') {
|
if (typeof ref === 'undefined') {
|
||||||
ref = API.currentUser;
|
ref = API.currentUser;
|
||||||
}
|
}
|
||||||
var playersInInstance = this.lastLocation.playerList;
|
if (playersInInstance.includes(ref.displayName)) {
|
||||||
if (playersInInstance.includes(ref.displayName)) {
|
instance.users.push(ref);
|
||||||
instance.users.push(ref);
|
}
|
||||||
}
|
|
||||||
var friendsInInstance = this.lastLocation.friendList;
|
var friendsInInstance = this.lastLocation.friendList;
|
||||||
for (var i = 0; i < friendsInInstance.length; i++) {
|
for (var i = 0; i < friendsInInstance.length; i++) {
|
||||||
var addUser = true;
|
var addUser = true;
|
||||||
@@ -8142,9 +8123,27 @@ speechSynthesis.getVoices();
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
for (var { ref } of this.friends.values()) {
|
||||||
|
if (typeof ref === 'undefined' ||
|
||||||
|
typeof ref.$location === 'undefined' ||
|
||||||
|
ref.$location.worldId !== D.id) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var { instanceId } = ref.$location;
|
||||||
|
var instance = instances[instanceId];
|
||||||
|
if (typeof instance === 'undefined') {
|
||||||
|
instance = {
|
||||||
|
id: instanceId,
|
||||||
|
occupants: 0,
|
||||||
|
users: []
|
||||||
|
};
|
||||||
|
instances[instanceId] = instance;
|
||||||
|
}
|
||||||
|
instance.users.push(ref);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var rooms = [];
|
var rooms = [];
|
||||||
for (var instance of Object.values(instances)) {
|
for (var instance of Object.values(instances)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user