back end elimination

This commit is contained in:
2024-03-29 15:48:54 +00:00
parent 174db483c0
commit 7aa030610d
2 changed files with 3 additions and 2 deletions

View File

@@ -18,7 +18,7 @@ export default class Game {
return false; return false;
} }
//The game has started //The game has started
if(this.state == GameState.PLACEMENT && newState == GameState.PLAYING) { if(newState == GameState.PLAYING) {
this.initLastSentLocations(); this.initLastSentLocations();
} }
this.state = newState; this.state = newState;

View File

@@ -245,9 +245,10 @@ io.of("player").on("connection", (socket) => {
}); });
socket.on('capture', (captureCode) => { socket.on('capture', (captureCode) => {
let capturedTeam = game.getTeam(teamId).chasing
if(game.capture(teamId, captureCode)) { if(game.capture(teamId, captureCode)) {
sendUpdatedTeamInformations(teamId) sendUpdatedTeamInformations(teamId)
sendUpdatedTeamInformations(game.getTeam(teamId).chasing) sendUpdatedTeamInformations(capturedTeam)
secureBroadcast("teams", game.teams); secureBroadcast("teams", game.teams);
}else { }else {
socket.emit("error", "Incorrect code") socket.emit("error", "Incorrect code")