mirror of
https://git.rezel.net/LudoTech/traque.git
synced 2026-02-09 02:10:18 +01:00
fixed problems for depployment
This commit is contained in:
4
traque-back/.gitignore
vendored
4
traque-back/.gitignore
vendored
@@ -1,8 +1,6 @@
|
||||
uploads/*
|
||||
#https dev certificates
|
||||
csr.pem
|
||||
key.pem
|
||||
server.crt
|
||||
*.pem
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
||||
@@ -122,6 +122,7 @@ export function initAdminSocketHandler() {
|
||||
}
|
||||
if (game.reorderTeams(newOrder)) {
|
||||
secureAdminBroadcast("teams", game.teams);
|
||||
game.teams.forEach(t => sendUpdatedTeamInformations(t.id))
|
||||
} else {
|
||||
socket.emit("error", "Error reordering teams");
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ export default class Game {
|
||||
}
|
||||
//The game has started
|
||||
if (newState == GameState.PLAYING) {
|
||||
penaltyController.start();
|
||||
if (!this.zone.ready()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,6 @@ function onUpdateZone(zone) {
|
||||
|
||||
export const game = new Game(onUpdateZone, onUpdateNewZone);
|
||||
export const penaltyController = new PenaltyController();
|
||||
penaltyController.init()
|
||||
|
||||
|
||||
initAdminSocketHandler();
|
||||
|
||||
@@ -14,7 +14,7 @@ export class PenaltyController {
|
||||
this.checkIntervalId = null;
|
||||
}
|
||||
|
||||
init() {
|
||||
start() {
|
||||
this.outOfBoundsSince = {};
|
||||
if(this.checkIntervalId) {
|
||||
clearInterval(this.checkIntervalId)
|
||||
@@ -62,6 +62,7 @@ export class PenaltyController {
|
||||
}
|
||||
|
||||
watchZone() {
|
||||
console.log("watching zone")
|
||||
this.game.teams.forEach((team) => {
|
||||
if (team.captured) { return }
|
||||
//All the informations are not ready yet
|
||||
@@ -69,9 +70,11 @@ export class PenaltyController {
|
||||
return;
|
||||
}
|
||||
if (!isInCircle({lat: team.currentLocation[0], lng: team.currentLocation[1]}, this.game.zone.currentZone.center, this.game.zone.currentZone.radius)) {
|
||||
console.log("tema " + team.name + " out of zone")
|
||||
//The team was not previously out of the zone
|
||||
if (!this.outOfBoundsSince[team.id]) {
|
||||
this.outOfBoundsSince[team.id] = new Date();
|
||||
console.log("tema " + team.name + " warned")
|
||||
teamBroadcast(team.id, "warning", `You left the zone, you have ${process.env.ALLOWED_TIME_OUT_OF_ZONE_IN_MINUTES} minutes to get back in the marked area.`)
|
||||
} else {
|
||||
if (new Date() - this.outOfBoundsSince[team.id] > process.env.ALLOWED_TIME_OUT_OF_ZONE_IN_MINUTES * 60 * 1000) {
|
||||
|
||||
Reference in New Issue
Block a user