mirror of
https://git.rezel.net/LudoTech/traque.git
synced 2026-02-09 10:20:16 +01:00
fixed penalty check bug
This commit is contained in:
@@ -79,9 +79,9 @@ export class PenaltyController {
|
|||||||
for (let team of game.teams) {
|
for (let team of game.teams) {
|
||||||
if (team.penalties >= this.settings.maxPenalties) {
|
if (team.penalties >= this.settings.maxPenalties) {
|
||||||
this.game.capture(team.id);
|
this.game.capture(team.id);
|
||||||
sendUpdatedTeamInformations(teamId);
|
sendUpdatedTeamInformations(team.id);
|
||||||
sendUpdatedTeamInformations(team.chased);
|
sendUpdatedTeamInformations(team.chased);
|
||||||
teamBroadcast(teamId, "warning", "You have been eliminated (reason: too many penalties)")
|
teamBroadcast(team.id, "warning", "You have been eliminated (reason: too many penalties)")
|
||||||
teamBroadcast(team.chased, "success", "The team you were chasing has been eliminated")
|
teamBroadcast(team.chased, "success", "The team you were chasing has been eliminated")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,9 @@ function logoutPlayer(id) {
|
|||||||
|
|
||||||
export function sendUpdatedTeamInformations(teamId) {
|
export function sendUpdatedTeamInformations(teamId) {
|
||||||
let team = game.getTeam(teamId)
|
let team = game.getTeam(teamId)
|
||||||
|
if(!team) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
team.sockets.forEach(socketId => {
|
team.sockets.forEach(socketId => {
|
||||||
io.of("player").to(socketId).emit("update_team", {
|
io.of("player").to(socketId).emit("update_team", {
|
||||||
name: team.name,
|
name: team.name,
|
||||||
|
|||||||
Reference in New Issue
Block a user