fixed in placement zone detection

This commit is contained in:
2024-04-19 22:34:50 +00:00
parent bde37e4676
commit fac8c2002c
3 changed files with 54 additions and 51 deletions

View File

@@ -131,7 +131,7 @@ export default class Game {
team.currentLocation = location;
//Update the team ready status if they are in their starting area
if (this.state == GameState.PLACEMENT && team.startingArea && team.startingArea && location) {
team.ready = isInCircle(location, [team.startingArea.center.lat, team.startingArea.center.lng], team.startingArea.radius)
team.ready = isInCircle({ lat: location[0], lng: location[1] }, team.startingArea.center, team.startingArea.radius)
}
return true;
}

View File

@@ -45,6 +45,7 @@ const upload = multer({
export function initPhotoUpload() {
clean();
app.post("/upload", upload.single('file'), (req, res) => {
res.set("Access-Control-Allow-Origin", "*");
console.log("upload", req.query)
res.send("")
})
@@ -52,6 +53,7 @@ export function initPhotoUpload() {
let team = game.getTeam(Number(req.query.team));
if (team) {
res.set("Content-Type", "image/png")
res.set("Access-Control-Allow-Origin", "*");
res.sendFile(process.cwd() + "/" + UPLOAD_DIR + "/" + team.id);
} else {
res.send(400, "Team not found")
@@ -61,6 +63,7 @@ export function initPhotoUpload() {
let team = game.getTeam(Number(req.query.team));
if (team) {
res.set("Content-Type", "image/png")
res.set("Access-Control-Allow-Origin", "*");
res.sendFile(process.cwd() + "/" + UPLOAD_DIR + "/" + team.chasing);
} else {
res.send(400, "Team not found")