mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-20 23:33:50 +02:00
Cache world on portal spawn
This commit is contained in:
@@ -8796,6 +8796,7 @@ speechSynthesis.getVoices();
|
||||
var args = await API.getCachedWorld({
|
||||
worldId: L.worldId
|
||||
});
|
||||
this.portalDownloadWorldCache(args.ref, ref);
|
||||
this.addPhotonEventToGameLog({
|
||||
created_at,
|
||||
type: 'PortalSpawn',
|
||||
@@ -10888,6 +10889,9 @@ speechSynthesis.getVoices();
|
||||
$app.data.worldAutoCacheGPSFilter = configRepository.getBool(
|
||||
'VRCX_worldAutoCacheGPSFilter'
|
||||
);
|
||||
$app.data.portalAutoCache = configRepository.getString(
|
||||
'VRCX_portalAutoCache'
|
||||
);
|
||||
$app.data.autoSweepVRChatCache = configRepository.getBool(
|
||||
'VRCX_autoSweepVRChatCache'
|
||||
);
|
||||
@@ -10952,6 +10956,10 @@ speechSynthesis.getVoices();
|
||||
'VRCX_worldAutoCacheGPSFilter',
|
||||
this.worldAutoCacheGPSFilter
|
||||
);
|
||||
configRepository.setString(
|
||||
'VRCX_portalAutoCache',
|
||||
this.portalAutoCache
|
||||
);
|
||||
configRepository.setBool(
|
||||
'VRCX_autoSweepVRChatCache',
|
||||
this.autoSweepVRChatCache
|
||||
@@ -11129,6 +11137,13 @@ speechSynthesis.getVoices();
|
||||
$app.data.worldAutoCacheGPS
|
||||
);
|
||||
}
|
||||
if (!configRepository.getString('VRCX_portalAutoCache')) {
|
||||
$app.data.portalAutoCache = 'Off';
|
||||
configRepository.setString(
|
||||
'VRCX_portalAutoCache',
|
||||
$app.data.portalAutoCache
|
||||
);
|
||||
}
|
||||
if (!configRepository.getBool('VRCX_vrBackgroundEnabled')) {
|
||||
$app.data.vrBackgroundEnabled = false;
|
||||
configRepository.setBool(
|
||||
@@ -17248,6 +17263,18 @@ speechSynthesis.getVoices();
|
||||
}
|
||||
};
|
||||
|
||||
$app.methods.portalDownloadWorldCache = function (worldRef, userRef) {
|
||||
var isFriend = this.friends.has(userRef.id);
|
||||
var isFavorite = API.cachedFavoritesByObjectId.has(userRef.id);
|
||||
if (
|
||||
this.portalAutoCache === 'Everyone' ||
|
||||
(this.portalAutoCache === 'Friends' && isFriend) ||
|
||||
(this.portalAutoCache === 'VIP' && isFavorite)
|
||||
) {
|
||||
this.autoDownloadWorldCache(worldRef.id, 'Portal', userRef.id);
|
||||
}
|
||||
};
|
||||
|
||||
$app.methods.feedDownloadWorldCache = function (id, location) {
|
||||
if (
|
||||
this.worldAutoCacheGPS === 'Always' ||
|
||||
@@ -17341,6 +17368,20 @@ speechSynthesis.getVoices();
|
||||
type: 'success'
|
||||
});
|
||||
}
|
||||
if (
|
||||
this.isGameRunning &&
|
||||
(this.downloadCurrent.type === 'Invite' ||
|
||||
this.downloadCurrent.type === 'Portal')
|
||||
) {
|
||||
var entry = {
|
||||
created_at: new Date().toJSON(),
|
||||
type: 'Event',
|
||||
data: `World finished caching ${this.downloadCurrent.ref.name}`
|
||||
};
|
||||
this.queueGameLogNoty(entry);
|
||||
this.addGameLog(entry);
|
||||
database.addGamelogEventToDatabase(entry);
|
||||
}
|
||||
this.downloadCurrent.status = 'Success';
|
||||
this.downloadCurrent.date = Date.now();
|
||||
this.downloadHistoryTable.data.unshift(this.downloadCurrent);
|
||||
@@ -17398,6 +17439,20 @@ speechSynthesis.getVoices();
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
if (
|
||||
this.isGameRunning &&
|
||||
(this.downloadCurrent.type === 'Invite' ||
|
||||
this.downloadCurrent.type === 'Portal')
|
||||
) {
|
||||
var entry = {
|
||||
created_at: new Date().toJSON(),
|
||||
type: 'Event',
|
||||
data: `World already in cache ${this.downloadCurrent.ref.name}`
|
||||
};
|
||||
this.queueGameLogNoty(entry);
|
||||
this.addGameLog(entry);
|
||||
database.addGamelogEventToDatabase(entry);
|
||||
}
|
||||
this.downloadCurrent.status = 'Already in cache';
|
||||
this.downloadCurrent.date = Date.now();
|
||||
this.downloadHistoryTable.data.unshift(this.downloadCurrent);
|
||||
|
||||
Reference in New Issue
Block a user