🆙 Stage 1 reconnect

This commit is contained in:
duckietm
2026-03-20 16:06:03 +01:00
parent 5aef7a3de2
commit 958693fe2e
4 changed files with 301 additions and 17 deletions
+18
View File
@@ -17,6 +17,7 @@ export class RoomMessageHandler
private _currentRoomId: number = 0;
private _ownUserId: number = 0;
private _ownRoomIndex: number = -1;
private _initialConnection: boolean = true;
private _guideId: number = -1;
private _requesterId: number = -1;
@@ -635,6 +636,7 @@ export class RoomMessageHandler
if(user.webID === this._ownUserId)
{
this._ownRoomIndex = user.roomIndex;
this._roomEngine.setRoomSessionOwnUser(this._currentRoomId, user.roomIndex);
this._roomEngine.updateRoomObjectUserOwn(this._currentRoomId, user.roomIndex);
}
@@ -735,6 +737,22 @@ export class RoomMessageHandler
this._roomEngine.updateRoomObjectUserLocation(this._currentRoomId, status.id, location, goal, status.canStandUp, height, direction, status.headDirection);
this._roomEngine.updateRoomObjectUserFlatControl(this._currentRoomId, status.id, null);
// Save own user's position for reconnection (only when not locked by reconnect flow)
if(status.id === this._ownRoomIndex)
{
try
{
const locked = sessionStorage.getItem('nitro.session.posLocked');
if(!locked)
{
sessionStorage.setItem('nitro.session.lastPosX', status.x.toString());
sessionStorage.setItem('nitro.session.lastPosY', status.y.toString());
}
}
catch(e) { /* ignore */ }
}
let isPosture = true;
let postureUpdate = false;
let postureType = RoomObjectVariable.STD;