From 612c5f115b0f54cfdc2c7f6017fd7137b0d33e74 Mon Sep 17 00:00:00 2001 From: Natsumi Date: Wed, 5 Feb 2025 00:27:53 +1300 Subject: [PATCH] Handle currentUser websocket traveling --- src/app.js | 11 ++++++++--- src/classes/websocket.js | 13 ++++++++----- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/app.js b/src/app.js index e2fd101b..a3109d24 100644 --- a/src/app.js +++ b/src/app.js @@ -19916,7 +19916,6 @@ console.log(`isLinux: ${LINUX}`); }; $app.methods.updateCurrentUserLocation = function () { - API.currentUser.$travelingToTime = this.lastLocationDestinationTime; var ref = API.cachedUsers.get(API.currentUser.id); if (typeof ref === 'undefined') { return; @@ -19924,7 +19923,8 @@ console.log(`isLinux: ${LINUX}`); // update cached user with both gameLog and API locations var currentLocation = API.currentUser.$locationTag; - if (API.currentUser.$location === 'traveling') { + var L = $utils.parseLocation(currentLocation); + if (L.isTraveling) { currentLocation = API.currentUser.$travelingToLocation; } ref.location = API.currentUser.$locationTag; @@ -19956,13 +19956,18 @@ console.log(`isLinux: ${LINUX}`); } else { ref.$location_at = this.lastLocation.date; ref.$travelingToTime = this.lastLocationDestinationTime; + API.currentUser.$travelingToTime = this.lastLocationDestinationTime; } }; - $app.methods.setCurrentUserLocation = async function (location) { + $app.methods.setCurrentUserLocation = async function ( + location, + travelingToLocation + ) { API.currentUser.$location_at = Date.now(); API.currentUser.$travelingToTime = Date.now(); API.currentUser.$locationTag = location; + API.currentUser.$travelingToLocation = travelingToLocation; this.updateCurrentUserLocation(); // janky gameLog support for Quest diff --git a/src/classes/websocket.js b/src/classes/websocket.js index c20651b6..de8ff06b 100644 --- a/src/classes/websocket.js +++ b/src/classes/websocket.js @@ -427,12 +427,15 @@ export default class extends baseClass { break; } - // content.user: {} - // content.world: {} + // content.user: {} // we don't trust this + // content.world: {} // this is long gone + // content.worldId // where did worldId go? + // content.instance // without worldId, this is useless - this.currentUser.presence.instance = content.instance; - this.currentUser.presence.world = content.worldId; - $app.setCurrentUserLocation(content.location); + $app.setCurrentUserLocation( + content.location, + content.travelingToLocation + ); break; case 'group-joined':