This commit is contained in:
2024-06-10 15:24:37 +00:00
parent dadc8d7dd5
commit 42257bd23d
23 changed files with 470 additions and 548 deletions

View File

@@ -3,7 +3,6 @@ import { sendUpdatedTeamInformations, teamBroadcast } from "./team_socket.js";
import { GameState } from "./game.js";
import { secureAdminBroadcast } from "./admin_socket.js";
import { game } from "./index.js";
import { isInZone } from "./zone_manager.js";
export class PenaltyController {
constructor() {
@@ -92,10 +91,10 @@ export class PenaltyController {
this.game.teams.forEach((team) => {
if (team.captured) { return }
//All the informations are not ready yet
if (team.currentLocation == null) {
if (team.currentLocation == null || this.game.zone.currentZone == null) {
return;
}
if (!isInZone(team.currentLocation)) {
if (!isInCircle({ lat: team.currentLocation[0], lng: team.currentLocation[1] }, this.game.zone.currentZone.center, this.game.zone.currentZone.radius)) {
//The team was not previously out of the zone
if (!this.outOfBoundsSince[team.id]) {
this.outOfBoundsSince[team.id] = new Date();