Minor bug fixes

This commit is contained in:
MaciejkaG 2024-04-06 21:44:18 +02:00
parent 7e3db33ae8
commit 322b932dbd
2 changed files with 10 additions and 1 deletions

View File

@ -555,7 +555,10 @@ io.on('connection', async (socket) => {
return; return;
} }
if (playerGame && playerGame.data.state === 'preparation') { const playerIdx = playerGame.data.hostId === session.userId ? 0 : 1;
const userNotReady = !playerGame.data.ready[playerIdx];
if (playerGame && playerGame.data.state === 'preparation' && userNotReady) {
await GInfo.setReady(socket); await GInfo.setReady(socket);
const playerGame = await GInfo.getPlayerGameData(socket); const playerGame = await GInfo.getPlayerGameData(socket);
@ -563,10 +566,14 @@ io.on('connection', async (socket) => {
// Both set ready // Both set ready
await GInfo.resetTimer(playerGame.id); await GInfo.resetTimer(playerGame.id);
callback();
await finishPrepPhase(socket, playerGame); await finishPrepPhase(socket, playerGame);
} else if (playerGame.data.ready[0] || playerGame.data.ready[1]) { } else if (playerGame.data.ready[0] || playerGame.data.ready[1]) {
// One player set ready // One player set ready
callback();
const members = [...roomMemberIterator(playerGame.id)]; const members = [...roomMemberIterator(playerGame.id)];
for (let i = 0; i < members.length; i++) { for (let i = 0; i < members.length; i++) {
const sid = members[i][0]; const sid = members[i][0];

View File

@ -255,6 +255,8 @@ socket.on('turn update', (turnData) => {
$(".boardSwitch").css("opacity", 0.3); $(".boardSwitch").css("opacity", 0.3);
} else { } else {
if (!postPrep) { if (!postPrep) {
$(".readyButton").css({ pointerEvents: 'none', opacity: 0.3 });
$(".controlsOwnBoard").css("opacity", 0.3); $(".controlsOwnBoard").css("opacity", 0.3);
$(".ownBoardInfo").addClass("changing"); $(".ownBoardInfo").addClass("changing");