Skip to content

Commit

Permalink
Merge branch 'develop' into steam-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphiiko committed Nov 3, 2024
2 parents 31e192b + 8e82510 commit 881218d
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- GPU acceleration for SteamVR overlays (Community contribution by [BenjaminZehowlt](https://github.com/BenjaminZehowlt))

### Fixed

- Fixed parsing of new VRChat join/leave log format

## [1.14.5]

### Fixed
Expand Down
2 changes: 2 additions & 0 deletions src-ui/app/models/vrchat-log-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ interface VRChatLogEventBase {
export interface VRChatOnPlayerJoinedEvent extends VRChatLogEventBase {
type: 'OnPlayerJoined';
displayName: string;
userId: string;
}

export interface VRChatOnPlayerLeftEvent extends VRChatLogEventBase {
type: 'OnPlayerLeft';
displayName: string;
userId: string;
}

export interface VRChatOnLocationChangeEvent extends VRChatLogEventBase {
Expand Down
33 changes: 29 additions & 4 deletions src-ui/app/services/vrchat-log.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,28 @@ export class VRChatLogService {
case 'InitialLoadComplete':
this._initialLoadComplete.next(true);
break;
case 'OnPlayerJoined':
case 'OnPlayerJoined': {
const { displayName, userId } = this.parseNameAndId(event.data);
this._logEvents.next({
type: 'OnPlayerJoined',
timestamp: moment.unix(event.time).toDate(),
displayName: event.data,
initialLoad: event.initialLoad,
displayName,
userId,
});
break;
case 'OnPlayerLeft':
}
case 'OnPlayerLeft': {
const { displayName, userId } = this.parseNameAndId(event.data);
this._logEvents.next({
type: 'OnPlayerLeft',
timestamp: moment.unix(event.time).toDate(),
displayName: event.data,
initialLoad: event.initialLoad,
displayName,
userId,
});
break;
}
case 'OnLocationChange':
this._logEvents.next({
type: 'OnLocationChange',
Expand All @@ -58,4 +64,23 @@ export class VRChatLogService {
});
}
}

private parseNameAndId(data: string): { displayName: string; userId: string } {
const parts = data.split(' ');
if (
parts.length > 1 &&
parts[parts.length - 1].startsWith('(') &&
parts[parts.length - 1].endsWith(')')
) {
return {
displayName: parts.slice(0, parts.length - 1).join(' '),
userId: parts[parts.length - 1].slice(1, -1),
};
} else {
return {
displayName: data,
userId: '',
};
}
}
}
4 changes: 2 additions & 2 deletions src-ui/app/services/vrchat.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ export class VRChatService {
...structuredClone(this._world.value),
playerCount: this._world.value.playerCount + 1,
};
if (event.displayName === this._user.value?.displayName) context.loaded = true;
if (event.userId === this._user.value?.id) context.loaded = true;
this._world.next(context);
break;
}
Expand All @@ -699,7 +699,7 @@ export class VRChatService {
...structuredClone(this._world.value),
playerCount: Math.max(this._world.value.playerCount - 1, 0),
};
if (event.displayName === this._user.value?.displayName) context.loaded = false;
if (event.userId === this._user.value?.id) context.loaded = false;
this._world.next(context);
break;
}
Expand Down

0 comments on commit 881218d

Please sign in to comment.