Fix current user instance timer when game is running elsewhere

This commit is contained in:
Natsumi
2023-09-06 18:05:51 +12:00
parent dc56d7313a
commit bd5bc99f48
2 changed files with 24 additions and 15 deletions
+23 -14
View File
@@ -4834,8 +4834,7 @@ speechSynthesis.getVoices();
this.currentUser.presence.instance = content.instance; this.currentUser.presence.instance = content.instance;
this.currentUser.presence.world = content.worldId; this.currentUser.presence.world = content.worldId;
this.currentUser.$locationTag = content.location; $app.setCurrentUserLocation(content.location);
$app.updateCurrentUserLocation();
break; break;
case 'group-joined': case 'group-joined':
@@ -5104,7 +5103,8 @@ speechSynthesis.getVoices();
methods: { methods: {
update() { update() {
if (!this.epoch) { if (!this.epoch) {
this.text = ''; this.text = '-';
return;
} }
this.text = timeToText(Date.now() - this.epoch); this.text = timeToText(Date.now() - this.epoch);
} }
@@ -5163,7 +5163,7 @@ speechSynthesis.getVoices();
if (epoch >= 0) { if (epoch >= 0) {
this.text = timeToText(epoch); this.text = timeToText(epoch);
} else { } else {
this.text = ''; this.text = '-';
} }
} }
}, },
@@ -22667,14 +22667,15 @@ speechSynthesis.getVoices();
if (result || !this.isRealInstance(location)) { if (result || !this.isRealInstance(location)) {
return; return;
} }
if (this.isGameNoVR) {
this.restartCrashedGame(location);
return;
}
// wait a bit for SteamVR to potentially close before deciding to relaunch // wait a bit for SteamVR to potentially close before deciding to relaunch
var restartDelay = 4000;
if (this.isGameNoVR) {
// wait for game to close before relaunching
restartDelay = 2000;
}
workerTimers.setTimeout( workerTimers.setTimeout(
() => this.restartCrashedGame(location), () => this.restartCrashedGame(location),
3000 restartDelay
); );
}); });
}; };
@@ -24622,17 +24623,25 @@ speechSynthesis.getVoices();
ref.$online_for = API.currentUser.$online_for; ref.$online_for = API.currentUser.$online_for;
ref.$offline_for = API.currentUser.$offline_for; ref.$offline_for = API.currentUser.$offline_for;
ref.$location = API.parseLocation(currentLocation); ref.$location = API.parseLocation(currentLocation);
ref.$location_at = this.lastLocation.date; if (!this.isGameRunning || this.gameLogDisabled) {
ref.$travelingToTime = this.lastLocationDestinationTime; ref.$location_at = API.currentUser.$location_at;
if (!this.isGameRunning) { ref.$travelingToTime = API.currentUser.$travelingToTime;
ref.$location_at = Date.now();
ref.$travelingToTime = Date.now();
this.applyUserDialogLocation(); this.applyUserDialogLocation();
this.applyWorldDialogInstances(); this.applyWorldDialogInstances();
this.applyGroupDialogInstances(); this.applyGroupDialogInstances();
} else {
ref.$location_at = this.lastLocation.date;
ref.$travelingToTime = this.lastLocationDestinationTime;
} }
}; };
$app.methods.setCurrentUserLocation = function (location) {
API.currentUser.$location_at = Date.now();
API.currentUser.$travelingToTime = Date.now();
API.currentUser.$locationTag = location;
this.updateCurrentUserLocation();
};
$app.data.avatarHistory = new Set(); $app.data.avatarHistory = new Set();
$app.data.avatarHistoryArray = []; $app.data.avatarHistoryArray = [];
+1 -1
View File
@@ -122,7 +122,7 @@ html
img(v-lazy="userImage(API.currentUser)") img(v-lazy="userImage(API.currentUser)")
.detail .detail
span.name(v-text="API.currentUser.displayName" :style="{'color':API.currentUser.$userColour}") span.name(v-text="API.currentUser.displayName" :style="{'color':API.currentUser.$userColour}")
location.extra(v-if="isGameRunning" :location="lastLocation.location" :traveling="lastLocationDestination" :link="false") location.extra(v-if="isGameRunning && !gameLogDisabled" :location="lastLocation.location" :traveling="lastLocationDestination" :link="false")
location.extra(v-else-if="isRealInstance(API.currentUser.$locationTag) || isRealInstance(API.currentUser.$travelingToLocation)" :location="API.currentUser.$locationTag" :traveling="API.currentUser.$travelingToLocation" :link="false") location.extra(v-else-if="isRealInstance(API.currentUser.$locationTag) || isRealInstance(API.currentUser.$travelingToLocation)" :location="API.currentUser.$locationTag" :traveling="API.currentUser.$travelingToLocation" :link="false")
span.extra(v-else v-text="API.currentUser.statusDescription") span.extra(v-else v-text="API.currentUser.statusDescription")
.x-friend-group.x-link(@click="isFriendsGroup0 = !isFriendsGroup0" v-show="friendsGroup0.length") .x-friend-group.x-link(@click="isFriendsGroup0 = !isFriendsGroup0" v-show="friendsGroup0.length")