fix: two-player lobby deadlock

This commit is contained in:
2026-08-30 23:42:26 +03:00
parent d5eb26d330
commit 93af738e36
9 changed files with 77 additions and 10 deletions
+2 -3
View File
@@ -549,7 +549,7 @@
ui.modeControls.hidden = !playerOne;
if (playerOne) startLobbyInfoPolling();
else stopLobbyInfoPolling();
const playerTwoReady = info?.player2Available === false;
const playerTwoReady = state.players[1].trim() !== '' || info?.player2Available === false;
const canStart = playerOne && (state.mode === 'bot' || playerTwoReady);
setSpriteIcon(ui.lobbyIcon, canStart ? 'icon-check' : 'icon-hourglass');
document.querySelectorAll('.mode-button').forEach(button => {
@@ -673,8 +673,7 @@
el('join-form').addEventListener('submit', event => {
event.preventDefault();
const requestedRole = info?.player1Available ? 'player1' : info?.player2Available ? 'player2' : 'spectator';
join(requestedRole);
join('player');
});
document.querySelectorAll('.avatar-button').forEach(button => button.addEventListener('click', () => {
ui.name.value = button.dataset.name;