Fix custom lobby player IDs not being set correctly when rejoining a lobby

main
peshomir 2025-02-15 11:02:28 +02:00
parent 2688e86b9d
commit 92980649eb
2 changed files with 6 additions and 5 deletions

View File

@ -193,7 +193,7 @@ function isCustomMessage(raw) {
if (playerIsHost) optionsContainer.classList.remove("disabled");
else optionsContainer.classList.add("disabled");
Object.entries(data.options).forEach(([option, value]) => updateOption(option, value));
displayPlayers(data.players);
displayPlayers(data.players, data.id);
} else if (type === "addPlayer") {
addPlayer({ name: data.name, inGame: false, isHost: false });
updatePlayerCount();
@ -204,6 +204,7 @@ function isCustomMessage(raw) {
updatePlayerCount();
} else if (type === "inLobby") {
const index = data;
playerList[index].inGame = false;
playerList[index].inGameBadge.className = "d-none";
} else if (type === "options") {
const [option, value] = data;
@ -260,11 +261,11 @@ function kickButtonHandler(event) {
}
}
/** @param {PlayerInfo[]} players */
function displayPlayers(players) {
function displayPlayers(players, thisPlayerId) {
playerList = [];
playerListDiv.innerHTML = "";
players.forEach(addPlayer);
thisPlayer = playerList[playerList.length - 1];
thisPlayer = playerList[thisPlayerId];
updatePlayerCount();
}
function updatePlayerCount() {

View File

@ -1,5 +1,5 @@
const fx_version = '0.6.7'; // FX Client Version
const fx_update = 'Feb 8'; // FX Client Last Updated
const fx_version = '0.6.7.1'; // FX Client Version
const fx_update = 'Feb 15'; // FX Client Last Updated
if ("serviceWorker" in navigator) {
navigator.serviceWorker.addEventListener("message", (e) => {