Skip to content

Commit

Permalink
feat: Change lobby name if it is roaming
Browse files Browse the repository at this point in the history
  • Loading branch information
Panzerhandschuh committed Feb 8, 2025
1 parent 3667ee2 commit 5915afa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 2 additions & 0 deletions scripts/common/online.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export interface Lobby {
members: number;

members_limit: number;

isRoaming: boolean;
}

/* List of all lobbies grouped by currrent/friends/global */
Expand Down
13 changes: 7 additions & 6 deletions scripts/pages/drawer/lobby.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,9 @@ class LobbyHandler {

const ownerSteamID = lobbyData.owner;
const lobbyType = lobbyData.type;
const lobbyName = $.Localize('#Lobby_Owner').replace(
'%owner%',
FriendsAPI.GetNameForXUID(ownerSteamID)
);
const lobbyName = lobbyData.isRoaming
? $.Localize('#Lobby_Roaming')
: $.Localize('#Lobby_Owner').replace('%owner%', FriendsAPI.GetNameForXUID(ownerSteamID));

// Only show items that match the search. Always true if search is empty
if (!lobbyName.includes(this.panels.search.text)) {
Expand Down Expand Up @@ -266,7 +265,7 @@ class LobbyHandler {

/** Update the lobbies details view based on current lobby state */
updateCurrentLobbyDetails() {
const { owner, type, members, members_limit } = Object.values(this.lobbyCurrentData)[0];
const { owner, type, members, members_limit, isRoaming } = Object.values(this.lobbyCurrentData)[0];

this.panels.detailsType.SetImage(`file://{images}/online/${LobbyProperties.get(type).icon}.svg`);

Expand All @@ -275,7 +274,9 @@ class LobbyHandler {

$.GetContextPanel().SetDialogVariable(
'lobbyTitle',
$.Localize('#Lobby_Owner').replace('%owner%', FriendsAPI.GetNameForXUID(owner))
isRoaming
? $.Localize('#Lobby_Roaming')
: $.Localize('#Lobby_Owner').replace('%owner%', FriendsAPI.GetNameForXUID(owner))
);
$.GetContextPanel().SetDialogVariable('lobbyPlayerCount', `${members}/${members_limit}`);
}
Expand Down

0 comments on commit 5915afa

Please sign in to comment.