mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-06 06:46:04 +02:00
Toggle self invite/open in-game
This commit is contained in:
+14
-3
@@ -7,11 +7,13 @@ import { parseLocation } from '../shared/utils';
|
||||
import { useInstanceStore } from './instance';
|
||||
import { useGameStore } from './game';
|
||||
import { useLaunchStore } from './launch';
|
||||
import { useAdvancedSettingsStore } from './settings/advanced';
|
||||
|
||||
export const useInviteStore = defineStore('Invite', () => {
|
||||
const instanceStore = useInstanceStore();
|
||||
const gameStore = useGameStore();
|
||||
const launchStore = useLaunchStore();
|
||||
const advancedSettingsStore = useAdvancedSettingsStore();
|
||||
const state = reactive({
|
||||
editInviteMessageDialog: {
|
||||
visible: false,
|
||||
@@ -111,7 +113,7 @@ export const useInviteStore = defineStore('Invite', () => {
|
||||
/**
|
||||
*
|
||||
* @param {string} messageType
|
||||
* @param {string} inviteMessage
|
||||
* @param {any} inviteMessage
|
||||
*/
|
||||
function showEditInviteMessageDialog(messageType, inviteMessage) {
|
||||
const D = state.editInviteMessageDialog;
|
||||
@@ -149,6 +151,14 @@ export const useInviteStore = defineStore('Invite', () => {
|
||||
});
|
||||
}
|
||||
|
||||
function canOpenInstanceInGame() {
|
||||
return (
|
||||
!LINUX &&
|
||||
gameStore.isGameRunning &&
|
||||
!advancedSettingsStore.selfInviteOverride
|
||||
);
|
||||
}
|
||||
|
||||
function newInstanceSelfInvite(worldId) {
|
||||
instanceStore.createNewInstance(worldId).then((args) => {
|
||||
const location = args?.json?.location;
|
||||
@@ -164,7 +174,7 @@ export const useInviteStore = defineStore('Invite', () => {
|
||||
if (!L.isRealInstance) {
|
||||
return;
|
||||
}
|
||||
if (gameStore.isGameRunning && !LINUX) {
|
||||
if (canOpenInstanceInGame()) {
|
||||
const secureOrShortName =
|
||||
args.json.shortName || args.json.secureName;
|
||||
launchStore.tryOpenInstanceInVrc(location, secureOrShortName);
|
||||
@@ -194,6 +204,7 @@ export const useInviteStore = defineStore('Invite', () => {
|
||||
inviteRequestResponseMessageTable,
|
||||
showEditInviteMessageDialog,
|
||||
refreshInviteMessageTableData,
|
||||
newInstanceSelfInvite
|
||||
newInstanceSelfInvite,
|
||||
canOpenInstanceInGame
|
||||
};
|
||||
});
|
||||
|
||||
@@ -19,6 +19,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
relaunchVRChatAfterCrash: false,
|
||||
vrcQuitFix: true,
|
||||
autoSweepVRChatCache: false,
|
||||
selfInviteOverride: false,
|
||||
saveInstancePrints: false,
|
||||
cropInstancePrints: false,
|
||||
saveInstanceStickers: false,
|
||||
@@ -53,6 +54,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
relaunchVRChatAfterCrash,
|
||||
vrcQuitFix,
|
||||
autoSweepVRChatCache,
|
||||
selfInviteOverride,
|
||||
saveInstancePrints,
|
||||
cropInstancePrints,
|
||||
saveInstanceStickers,
|
||||
@@ -80,6 +82,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
configRepository.getBool('VRCX_relaunchVRChatAfterCrash', false),
|
||||
configRepository.getBool('VRCX_vrcQuitFix', true),
|
||||
configRepository.getBool('VRCX_autoSweepVRChatCache', false),
|
||||
configRepository.getBool('VRCX_selfInviteOverride', false),
|
||||
configRepository.getBool('VRCX_saveInstancePrints', false),
|
||||
configRepository.getBool('VRCX_cropInstancePrints', false),
|
||||
configRepository.getBool('VRCX_saveInstanceStickers', false),
|
||||
@@ -120,6 +123,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
state.relaunchVRChatAfterCrash = relaunchVRChatAfterCrash;
|
||||
state.vrcQuitFix = vrcQuitFix;
|
||||
state.autoSweepVRChatCache = autoSweepVRChatCache;
|
||||
state.selfInviteOverride = selfInviteOverride;
|
||||
state.saveInstancePrints = saveInstancePrints;
|
||||
state.cropInstancePrints = cropInstancePrints;
|
||||
state.saveInstanceStickers = saveInstanceStickers;
|
||||
@@ -166,6 +170,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
);
|
||||
const vrcQuitFix = computed(() => state.vrcQuitFix);
|
||||
const autoSweepVRChatCache = computed(() => state.autoSweepVRChatCache);
|
||||
const selfInviteOverride = computed(() => state.selfInviteOverride);
|
||||
const saveInstancePrints = computed(() => state.saveInstancePrints);
|
||||
const cropInstancePrints = computed(() => state.cropInstancePrints);
|
||||
const saveInstanceStickers = computed(() => state.saveInstanceStickers);
|
||||
@@ -243,6 +248,13 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
state.autoSweepVRChatCache
|
||||
);
|
||||
}
|
||||
function setSelfInviteOverride() {
|
||||
state.selfInviteOverride = !state.selfInviteOverride;
|
||||
configRepository.setBool(
|
||||
'VRCX_selfInviteOverride',
|
||||
state.selfInviteOverride
|
||||
);
|
||||
}
|
||||
function setSaveInstancePrints() {
|
||||
state.saveInstancePrints = !state.saveInstancePrints;
|
||||
configRepository.setBool(
|
||||
@@ -692,6 +704,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
relaunchVRChatAfterCrash,
|
||||
vrcQuitFix,
|
||||
autoSweepVRChatCache,
|
||||
selfInviteOverride,
|
||||
saveInstancePrints,
|
||||
cropInstancePrints,
|
||||
saveInstanceStickers,
|
||||
@@ -722,6 +735,7 @@ export const useAdvancedSettingsStore = defineStore('AdvancedSettings', () => {
|
||||
setRelaunchVRChatAfterCrash,
|
||||
setVrcQuitFix,
|
||||
setAutoSweepVRChatCache,
|
||||
setSelfInviteOverride,
|
||||
setSaveInstancePrints,
|
||||
setCropInstancePrints,
|
||||
setSaveInstanceStickers,
|
||||
|
||||
Reference in New Issue
Block a user