Instance full indicator

This commit is contained in:
Natsumi
2023-04-22 00:52:09 +12:00
parent 2be1a75fcb
commit e1d3a1d412
3 changed files with 97 additions and 19 deletions

View File

@@ -2299,6 +2299,10 @@ speechSynthesis.getVoices();
var D = $app.userDialog;
if ($app.userDialog.visible && D.ref.$location.tag === json.id) {
D.instance.occupants = json.n_users;
D.instance.full =
typeof json.hasCapacityForYou !== 'undefined' &&
!json.hasCapacityForYou;
D.instance.json = json;
}
});
@@ -2312,6 +2316,10 @@ speechSynthesis.getVoices();
for (var instance of D.rooms) {
if (instance.id === json.instanceId) {
instance.occupants = json.n_users;
instance.full =
typeof json.hasCapacityForYou !== 'undefined' &&
!json.hasCapacityForYou;
instance.json = json;
break;
}
}
@@ -2328,6 +2336,10 @@ speechSynthesis.getVoices();
for (var instance of D.instances) {
if (instance.id === json.instanceId) {
instance.occupants = json.n_users;
instance.full =
typeof json.hasCapacityForYou !== 'undefined' &&
!json.hasCapacityForYou;
instance.json = json;
break;
}
}
@@ -14969,8 +14981,14 @@ speechSynthesis.getVoices();
D.worlds = [];
D.instance = {
id: '',
tag: '',
$location: {},
occupants: 0,
friendCount: 0
friendCount: 0,
full: false,
users: [],
shortName: '',
json: {}
};
D.representedGroup = {
bannerUrl: '',
@@ -15263,14 +15281,27 @@ speechSynthesis.getVoices();
playersInInstance.size > 0
) {
D.instance = {
id: L.tag,
occupants: this.lastLocation.playerList.size
id: L.instanceId,
tag: L.tag,
$location: L,
occupants: this.lastLocation.playerList.size,
friendCount: 0,
full: false,
users: [],
shortName: '',
json: {}
};
}
if (L.isOffline || L.isPrivate || L.isTraveling || L.worldId === '') {
D.instance = {
id: L.tag,
occupants: 0
id: L.instanceId,
tag: L.tag,
$location: L,
occupants: 0,
full: false,
users: [],
shortName: '',
json: {}
};
}
D.instance.friendCount = friendCount;
@@ -16131,7 +16162,11 @@ speechSynthesis.getVoices();
D.ref = ref;
$app.applyWorldDialogInstances();
for (var room of D.rooms) {
if (room.occupants === 0) {
if (
$app.isRealInstance(room.tag) &&
room.tag !== $app.lastLocation.location &&
(room.$location.accessType !== 'public' || room.occupants === 0)
) {
API.getInstance({
worldId: D.id,
instanceId: room.id
@@ -16311,19 +16346,27 @@ speechSynthesis.getVoices();
for (var [id, occupants] of D.ref.instances) {
instances[id] = {
id,
tag: `${D.id}:${id}`,
occupants,
friendCount: 0,
users: []
full: false,
users: [],
shortName: '',
json: {}
};
}
var {instanceId, shortName} = D.$location;
if (instanceId && typeof instances[instanceId] === 'undefined') {
instances[instanceId] = {
id: instanceId,
tag: `${D.id}:${instanceId}`,
$location: {},
occupants: 0,
friendCount: 0,
full: false,
users: [],
shortName,
users: []
json: {}
};
}
var currentLocation = this.lastLocation.location;
@@ -16336,9 +16379,14 @@ speechSynthesis.getVoices();
var friendsInInstance = this.lastLocation.friendList;
var instance = {
id: lastLocation$.instanceId,
tag: currentLocation,
$location: {},
occupants: playersInInstance.size,
friendCount: friendsInInstance.size,
users: []
full: false,
users: [],
shortName: '',
json: {}
};
instances[instance.id] = instance;
var ref = API.cachedUsers.get(API.currentUser.id);
@@ -16381,9 +16429,14 @@ speechSynthesis.getVoices();
if (typeof instance === 'undefined') {
instance = {
id: instanceId,
tag: `${D.id}:${instanceId}`,
$location: {},
occupants: 0,
friendCount: 0,
users: []
full: false,
users: [],
shortName: '',
json: {}
};
instances[instanceId] = instance;
}
@@ -16424,10 +16477,16 @@ speechSynthesis.getVoices();
}
// reuse instance occupants from getInstance
for (var room of rooms) {
if (room.occupants === 0) {
if (
$app.isRealInstance(room.tag) &&
room.tag !== $app.lastLocation.location &&
(room.$location.accessType !== 'public' || room.occupants === 0)
) {
for (var instance of D.rooms) {
if (instance.id === room.id) {
room.occupants = instance.occupants;
room.full = instance.full;
room.json = instance.json;
break;
}
}
@@ -16459,9 +16518,13 @@ speechSynthesis.getVoices();
instances[instance.location] = {
id: instance.instanceId,
tag: instance.location,
$location: {},
occupants: instance.memberCount,
friendCount: 0,
users: []
full: false,
users: [],
shortName: '',
json: {}
};
}
}
@@ -16476,9 +16539,13 @@ speechSynthesis.getVoices();
var instance = {
id: lastLocation$.instanceId,
tag: currentLocation,
$location: {},
occupants: playersInInstance.size,
friendCount: friendsInInstance.size,
users: []
full: false,
users: [],
shortName: '',
json: {}
};
instances[currentLocation] = instance;
var ref = API.cachedUsers.get(API.currentUser.id);
@@ -16522,9 +16589,13 @@ speechSynthesis.getVoices();
instance = {
id: instanceId,
tag,
$location: {},
occupants: 0,
friendCount: 0,
users: []
full: false,
users: [],
shortName: '',
json: {}
};
instances[tag] = instance;
}