mirror of
https://git.rezel.net/LudoTech/traque.git
synced 2026-02-09 02:10:18 +01:00
Mise en page complète + liaison partielle au backend
This commit is contained in:
@@ -92,17 +92,26 @@ export default {
|
||||
penaltyController.stop();
|
||||
timeoutHandler.endAllSendPositionTimeout();
|
||||
for (let team of this.teams) {
|
||||
team.outOfZone = false;
|
||||
team.penalties = 0;
|
||||
// Chasing
|
||||
team.captured = false;
|
||||
team.enemyLocation = null;
|
||||
team.currentLocation = null;
|
||||
team.chasing = null;
|
||||
team.chased = null;
|
||||
// Locations
|
||||
team.lastSentLocation = null;
|
||||
team.locationSendDeadline = null;
|
||||
team.enemyLocation = null;
|
||||
// Placement
|
||||
team.ready = false;
|
||||
// Zone
|
||||
team.penalties = 0;
|
||||
team.outOfZone = false;
|
||||
team.outOfZoneDeadline = null;
|
||||
// Stats
|
||||
team.distance = 0;
|
||||
team.finishDate = null;
|
||||
team.nCaptures = 0;
|
||||
team.nSentLocation = 0;
|
||||
team.nObserved = 0;
|
||||
team.finishDate = null;
|
||||
}
|
||||
this.startDate = null;
|
||||
this.updateTeamChasing();
|
||||
@@ -178,32 +187,38 @@ export default {
|
||||
*/
|
||||
addTeam(teamName) {
|
||||
this.teams.push({
|
||||
// Identification
|
||||
sockets: [],
|
||||
id: this.getNewTeamId(),
|
||||
name: teamName,
|
||||
id: this.getNewTeamId(),
|
||||
captureCode: this.createCaptureCode(),
|
||||
// Chasing
|
||||
captured: false,
|
||||
chasing: null,
|
||||
chased: null,
|
||||
// Locations
|
||||
lastSentLocation: null,
|
||||
currentLocation: null,
|
||||
enemyLocation: null,
|
||||
locationSendDeadline: null,
|
||||
currentLocation: null,
|
||||
lastCurrentLocationDate: null,
|
||||
enemyLocation: null,
|
||||
// Placement
|
||||
startingArea: null,
|
||||
ready: false,
|
||||
captureCode: this.createCaptureCode(),
|
||||
captured: false,
|
||||
// Zone
|
||||
penalties: 0,
|
||||
outOfZone: false,
|
||||
outOfZoneDeadline: null,
|
||||
// Stats
|
||||
distance: 0,
|
||||
finishDate: null,
|
||||
nCaptures: 0,
|
||||
nSentLocation: 0,
|
||||
nObserved: 0,
|
||||
finishDate: null,
|
||||
// First socket infos
|
||||
phoneModel: null,
|
||||
phoneName: null,
|
||||
battery: null,
|
||||
ping: null,
|
||||
nConnected: 0,
|
||||
});
|
||||
this.updateTeamChasing();
|
||||
return true;
|
||||
|
||||
@@ -38,23 +38,29 @@ export function playersBroadcast(event, data) {
|
||||
export function sendUpdatedTeamInformations(teamId) {
|
||||
const team = game.getTeam(teamId);
|
||||
teamBroadcast(teamId, "update_team", {
|
||||
// Identification
|
||||
name: team.name,
|
||||
captureCode: team.captureCode,
|
||||
// Chasing
|
||||
captured: team.captured,
|
||||
enemyName: game.getTeam(team.chasing).name,
|
||||
// Locations
|
||||
lastSentLocation: team.lastSentLocation,
|
||||
enemyLocation: team.enemyLocation,
|
||||
locationSendDeadline: team.locationSendDeadline,
|
||||
// Placement phase
|
||||
startingArea: team.startingArea,
|
||||
ready: team.ready,
|
||||
captureCode: team.captureCode,
|
||||
captured: team.captured,
|
||||
// Constraints
|
||||
penalties: team.penalties,
|
||||
outOfZone: team.outOfZone,
|
||||
outOfZoneDeadline: team.outOfZoneDeadline,
|
||||
locationSendDeadline: team.locationSendDeadline,
|
||||
// Stats
|
||||
distance: team.distance,
|
||||
startDate: game.startDate,
|
||||
finishDate: team.finishDate,
|
||||
nCaptures: team.nCaptures,
|
||||
nSentLocation: team.nSentLocation,
|
||||
startDate: game.startDate,
|
||||
finishDate: team.finishDate,
|
||||
})
|
||||
secureAdminBroadcast("teams", game.teams);
|
||||
}
|
||||
@@ -65,8 +71,14 @@ export function sendUpdatedTeamInformations(teamId) {
|
||||
*/
|
||||
function logoutPlayer(id) {
|
||||
for (const team of game.teams) {
|
||||
if (team.sockets.indexOf(id) == 0) {
|
||||
team.battery = null;
|
||||
team.phoneModel = null;
|
||||
team.phoneName = null;
|
||||
}
|
||||
team.sockets = team.sockets.filter((sid) => sid != id);
|
||||
}
|
||||
secureAdminBroadcast("teams", game.teams);
|
||||
}
|
||||
|
||||
export function initTeamSocket() {
|
||||
@@ -115,7 +127,9 @@ export function initTeamSocket() {
|
||||
const team = game.getTeam(teamId);
|
||||
if (team.sockets.indexOf(socket.id) == 0) {
|
||||
game.updateLocation(teamId, position);
|
||||
team.lastCurrentLocationDate = Date.now();
|
||||
}
|
||||
secureAdminBroadcast("teams", game.teams);
|
||||
});
|
||||
|
||||
socket.on("send_position", () => {
|
||||
|
||||
Reference in New Issue
Block a user