mirror of
https://git.rezel.net/LudoTech/traque.git
synced 2026-02-09 02:10:18 +01:00
Améliorations mineures
This commit is contained in:
@@ -96,10 +96,9 @@ export default {
|
|||||||
team.penalties = 0;
|
team.penalties = 0;
|
||||||
team.captured = false;
|
team.captured = false;
|
||||||
team.enemyLocation = null;
|
team.enemyLocation = null;
|
||||||
team.enemyName = null;
|
|
||||||
team.currentLocation = null;
|
team.currentLocation = null;
|
||||||
team.lastSentLocation = null;
|
team.lastSentLocation = null;
|
||||||
team.distance = null;
|
team.distance = 0;
|
||||||
team.finishDate = null;
|
team.finishDate = null;
|
||||||
team.nCaptures = 0;
|
team.nCaptures = 0;
|
||||||
team.nSentLocation = 0;
|
team.nSentLocation = 0;
|
||||||
@@ -179,19 +178,18 @@ export default {
|
|||||||
*/
|
*/
|
||||||
addTeam(teamName) {
|
addTeam(teamName) {
|
||||||
this.teams.push({
|
this.teams.push({
|
||||||
|
sockets: [],
|
||||||
id: this.getNewTeamId(),
|
id: this.getNewTeamId(),
|
||||||
name: teamName,
|
name: teamName,
|
||||||
chasing: null,
|
chasing: null,
|
||||||
chased: null,
|
chased: null,
|
||||||
currentLocation: null,
|
|
||||||
lastSentLocation: null,
|
lastSentLocation: null,
|
||||||
locationSendDeadline: null,
|
currentLocation: null,
|
||||||
enemyLocation: null,
|
enemyLocation: null,
|
||||||
enemyName: null,
|
locationSendDeadline: null,
|
||||||
captureCode: this.createCaptureCode(),
|
|
||||||
sockets: [],
|
|
||||||
startingArea: null,
|
startingArea: null,
|
||||||
ready: false,
|
ready: false,
|
||||||
|
captureCode: this.createCaptureCode(),
|
||||||
captured: false,
|
captured: false,
|
||||||
penalties: 0,
|
penalties: 0,
|
||||||
outOfZone: false,
|
outOfZone: false,
|
||||||
@@ -228,7 +226,7 @@ export default {
|
|||||||
/**
|
/**
|
||||||
* Update the chasing chain of the teams based of the ordre of the teams array
|
* Update the chasing chain of the teams based of the ordre of the teams array
|
||||||
* If there are only 2 teams left, the game will end
|
* If there are only 2 teams left, the game will end
|
||||||
* This function will update the enemyName, chasing and chased values of each teams
|
* This function will update the chasing and chased values of each teams
|
||||||
* @returns true if successful
|
* @returns true if successful
|
||||||
*/
|
*/
|
||||||
updateTeamChasing() {
|
updateTeamChasing() {
|
||||||
@@ -245,7 +243,6 @@ export default {
|
|||||||
if (previousTeam != null) {
|
if (previousTeam != null) {
|
||||||
this.teams[i].chased = previousTeam;
|
this.teams[i].chased = previousTeam;
|
||||||
this.getTeam(previousTeam).chasing = this.teams[i].id;
|
this.getTeam(previousTeam).chasing = this.teams[i].id;
|
||||||
this.getTeam(previousTeam).enemyName = this.teams[i].name;
|
|
||||||
} else {
|
} else {
|
||||||
firstTeam = this.teams[i].id;
|
firstTeam = this.teams[i].id;
|
||||||
}
|
}
|
||||||
@@ -254,7 +251,6 @@ export default {
|
|||||||
}
|
}
|
||||||
this.getTeam(firstTeam).chased = previousTeam;
|
this.getTeam(firstTeam).chased = previousTeam;
|
||||||
this.getTeam(previousTeam).chasing = firstTeam;
|
this.getTeam(previousTeam).chasing = firstTeam;
|
||||||
this.getTeam(previousTeam).enemyName = this.getTeam(firstTeam).name;
|
|
||||||
secureAdminBroadcast("teams", this.teams);
|
secureAdminBroadcast("teams", this.teams);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -37,29 +37,24 @@ export function playersBroadcast(event, data) {
|
|||||||
*/
|
*/
|
||||||
export function sendUpdatedTeamInformations(teamId) {
|
export function sendUpdatedTeamInformations(teamId) {
|
||||||
const team = game.getTeam(teamId);
|
const team = game.getTeam(teamId);
|
||||||
if (!team) {
|
teamBroadcast(teamId, "update_team", {
|
||||||
return;
|
name: team.name,
|
||||||
}
|
enemyName: game.getTeam(team.chasing).name,
|
||||||
team.sockets.forEach(socketId => {
|
lastSentLocation: team.lastSentLocation,
|
||||||
io.of("player").to(socketId).emit("update_team", {
|
enemyLocation: team.enemyLocation,
|
||||||
name: team.name,
|
locationSendDeadline: team.locationSendDeadline,
|
||||||
enemyLocation: team.enemyLocation,
|
startingArea: team.startingArea,
|
||||||
enemyName: team.enemyName,
|
ready: team.ready,
|
||||||
lastSentLocation: team.lastSentLocation,
|
captureCode: team.captureCode,
|
||||||
locationSendDeadline: team.locationSendDeadline,
|
captured: team.captured,
|
||||||
captureCode: team.captureCode,
|
penalties: team.penalties,
|
||||||
startingArea: team.startingArea,
|
outOfZone: team.outOfZone,
|
||||||
ready: team.ready,
|
outOfZoneDeadline: team.outOfZoneDeadline,
|
||||||
captured: team.captured,
|
distance: team.distance,
|
||||||
penalties: team.penalties,
|
startDate: game.startDate,
|
||||||
outOfZone: team.outOfZone,
|
finishDate: team.finishDate,
|
||||||
outOfZoneDeadline: team.outOfZoneDeadline,
|
nCaptures: team.nCaptures,
|
||||||
distance: team.distance,
|
nSentLocation: team.nSentLocation,
|
||||||
startDate: game.startDate,
|
|
||||||
finishDate: team.finishDate,
|
|
||||||
nCaptures: team.nCaptures,
|
|
||||||
nSentLocation: team.nSentLocation,
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
secureAdminBroadcast("teams", game.teams);
|
secureAdminBroadcast("teams", game.teams);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user