mirror of
https://git.rezel.net/LudoTech/traque.git
synced 2026-02-09 10:20:16 +01:00
formatage
This commit is contained in:
@@ -73,10 +73,10 @@ export function initAdminSocketHandler() {
|
|||||||
socket.emit("error", "Not logged in");
|
socket.emit("error", "Not logged in");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!game.changeSettings(settings)) {
|
if (!game.changeSettings(settings)) {
|
||||||
socket.emit("error", "Invalid settings");
|
socket.emit("error", "Invalid settings");
|
||||||
}
|
}
|
||||||
secureAdminBroadcast("game_settings",game.settings);
|
secureAdminBroadcast("game_settings", game.settings);
|
||||||
playersBroadcast("game_settings", game.settings);
|
playersBroadcast("game_settings", game.settings);
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -99,10 +99,10 @@ export function initAdminSocketHandler() {
|
|||||||
socket.emit("error", "Not logged in");
|
socket.emit("error", "Not logged in");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!penaltyController.updateSettings(settings)) {
|
if (!penaltyController.updateSettings(settings)) {
|
||||||
socket.emit("error", "Invalid settings");
|
socket.emit("error", "Invalid settings");
|
||||||
socket.emit("penalty_settings", penaltyController.settings)
|
socket.emit("penalty_settings", penaltyController.settings)
|
||||||
}else {
|
} else {
|
||||||
secureAdminBroadcast("penalty_settings", penaltyController.settings)
|
secureAdminBroadcast("penalty_settings", penaltyController.settings)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ export const GameState = {
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
//List of teams, as objects. To see the fields see the addTeam methods
|
//List of teams, as objects. To see the fields see the addTeam methods
|
||||||
teams : [],
|
teams: [],
|
||||||
//Current state of the game
|
//Current state of the game
|
||||||
state : GameState.SETUP,
|
state: GameState.SETUP,
|
||||||
//Settings of the game
|
//Settings of the game
|
||||||
settings : {
|
settings: {
|
||||||
loserEndGameMessage: "",
|
loserEndGameMessage: "",
|
||||||
winnerEndGameMessage: "",
|
winnerEndGameMessage: "",
|
||||||
capturedMessage: "",
|
capturedMessage: "",
|
||||||
@@ -37,7 +37,7 @@ export default {
|
|||||||
* @returns true if the settings are applied
|
* @returns true if the settings are applied
|
||||||
*/
|
*/
|
||||||
changeSettings(newSettings) {
|
changeSettings(newSettings) {
|
||||||
this.settings = {...this.settings, ...newSettings};
|
this.settings = { ...this.settings, ...newSettings };
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -232,7 +232,7 @@ export default {
|
|||||||
}
|
}
|
||||||
//The location sent by the team will be null if the browser call API dooes not succeed
|
//The location sent by the team will be null if the browser call API dooes not succeed
|
||||||
//See issue #19
|
//See issue #19
|
||||||
if(location == null) {
|
if (location == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
team.currentLocation = location;
|
team.currentLocation = location;
|
||||||
@@ -264,7 +264,7 @@ export default {
|
|||||||
if (team == undefined) {
|
if (team == undefined) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(team.currentLocation == null) {
|
if (team.currentLocation == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ This module manages the verification of the game rules and the penalties.
|
|||||||
import { isInCircle } from "./map_utils.js";
|
import { isInCircle } from "./map_utils.js";
|
||||||
import { sendUpdatedTeamInformations, teamBroadcast } from "./team_socket.js";
|
import { sendUpdatedTeamInformations, teamBroadcast } from "./team_socket.js";
|
||||||
import { secureAdminBroadcast } from "./admin_socket.js";
|
import { secureAdminBroadcast } from "./admin_socket.js";
|
||||||
import game, {GameState} from "./game.js";
|
import game, { GameState } from "./game.js";
|
||||||
import zone from "./zone_manager.js";
|
import zone from "./zone_manager.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ It receives messages, checks permissions, manages authentication and performs ac
|
|||||||
This module also exposes functions to send messages via socket to all teams
|
This module also exposes functions to send messages via socket to all teams
|
||||||
*/
|
*/
|
||||||
import { secureAdminBroadcast } from "./admin_socket.js";
|
import { secureAdminBroadcast } from "./admin_socket.js";
|
||||||
import { io} from "./index.js";
|
import { io } from "./index.js";
|
||||||
import game from "./game.js";
|
import game from "./game.js";
|
||||||
import zone from "./zone_manager.js";
|
import zone from "./zone_manager.js";
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ function logoutPlayer(id) {
|
|||||||
|
|
||||||
export function sendUpdatedTeamInformations(teamId) {
|
export function sendUpdatedTeamInformations(teamId) {
|
||||||
let team = game.getTeam(teamId)
|
let team = game.getTeam(teamId)
|
||||||
if(!team) {
|
if (!team) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
team.sockets.forEach(socketId => {
|
team.sockets.forEach(socketId => {
|
||||||
@@ -106,7 +106,7 @@ export function initTeamSocket() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let team = game.getTeam(teamId)
|
let team = game.getTeam(teamId)
|
||||||
if(team == undefined) {
|
if (team == undefined) {
|
||||||
logoutPlayer(socket.id);
|
logoutPlayer(socket.id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -125,8 +125,8 @@ export function initTeamSocket() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
game.updateTeamChasing();
|
game.updateTeamChasing();
|
||||||
teamBroadcast(teamId, "update_team", { enemyLocation: team.enemyLocation,locationSendDeadline: team.locationSendDeadline });
|
teamBroadcast(teamId, "update_team", { enemyLocation: team.enemyLocation, locationSendDeadline: team.locationSendDeadline });
|
||||||
teamBroadcast(teamId,"success", "Position udpated")
|
teamBroadcast(teamId, "success", "Position udpated")
|
||||||
secureAdminBroadcast("teams", game.teams)
|
secureAdminBroadcast("teams", game.teams)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user