Error if game already started or more than 4 players

This commit is contained in:
2021-06-18 10:19:03 +02:00
parent 73ced0222f
commit 0287f8aec0
6 changed files with 39 additions and 18 deletions

View File

@@ -59,7 +59,7 @@ io.on('connection', socket => {
generate_log_message(socket.room, socket.username, "JOINED", "");
} else {
// TODO
io.to(socket.id).emit('error', 'Game started already or room has two many members');
}
});
@@ -101,7 +101,7 @@ io.on('connection', socket => {
generate_log_message(socket.room, socket.username, "DICE", randomNumber);
} else {
// TODO
io.to(socket.id).emit('error', 'It\'s not your turn');
}
}
});
@@ -113,7 +113,7 @@ io.on('connection', socket => {
generate_log_message(socket.room, socket.username, "CARD", difficulty);
} else {
// TODO
io.to(socket.id).emit('error', 'It\'s not your turn');
}
}
});
@@ -157,6 +157,9 @@ function generate_log_message(room, user, type, message) {
case 'DICE':
color = '\x1b[34m';
break;
case 'MOVE':
color = '\x1b[30m';
break;
default:
color = '\x1b[0m';
}