Merge branch 'main' of github.com:quentinrsl/traque

This commit is contained in:
Quentin Roussel
2024-05-01 10:46:20 +02:00
2 changed files with 7 additions and 3 deletions

View File

@@ -99,6 +99,10 @@ export function initTeamSocket() {
return;
}
let team = game.getTeam(teamId)
if(team == undefined) {
logoutPlayer(socket.id);
return;
}
if (team.sockets.indexOf(socket.id) == 0) {
game.updateLocation(teamId, position);
teamBroadcast(teamId, "update_team", { currentLocation: team.currentLocation, ready: team.ready });
@@ -120,8 +124,8 @@ export function initTeamSocket() {
});
socket.on('capture', (captureCode) => {
let capturedTeam = game.getTeam(teamId).chasing
if (game.requestCapture(teamId, captureCode)) {
let capturedTeam = game.getTeam(teamId)?.chasing
if (capturedTeam !== undefined && game.requestCapture(teamId, captureCode)) {
sendUpdatedTeamInformations(teamId)
sendUpdatedTeamInformations(capturedTeam)
secureAdminBroadcast("teams", game.teams);

View File

@@ -14,7 +14,7 @@ function TeamProvider({children}) {
const [gameSettings, setGameSettings] = useState(null);
const [zone, setZone] = useState(null);
const [zoneExtremities, setZoneExtremities] = useState(null);
const measuredLocation = useLocation(10000);
const measuredLocation = useLocation(5000);
const {teamSocket} = useSocket();
const {loggedIn} = useTeamConnexion();
const teamInfosRef = useRef();