refactoed backend code to split team and admin messagin logic

This commit is contained in:
2024-04-18 17:21:53 +00:00
parent ae84c552f1
commit f384878964
6 changed files with 324 additions and 269 deletions

View File

@@ -0,0 +1,27 @@
import { game } from ".";
import { sendUpdatedTeamInformations, teamBroadcast } from "./team_socket";
export class PenaltyController {
constructor(game) {
}
addPenalty(teamId) {
let team = game.getTeam(teamId);
if(team.captured) {
return;
}
team.penalties++;
if(team.penalties == game.MAX_PENALTIES) {
game.requestCapture(team.chased);
sendUpdatedTeamInformations(teamId);
sendUpdatedTeamInformations(team.chased);
teamBroadcast(teamId, "warning", "You have been eliminated (reason: too many penalties)")
teamBroadcast(team.chased, "success", "The team you are chasing has changed")
}
}
watchZone() {
}
}