Skip to content

Commit

Permalink
feat(version): v1.0.1 - start
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianjnuwu committed Jan 12, 2025
1 parent 58e9bc6 commit ee8ab30
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
5 changes: 1 addition & 4 deletions server/biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
"enabled": true
},
"files": {
"ignore": [
"node_modules",
"build"
]
"ignore": ["node_modules", "build"]
}
}
1 change: 1 addition & 0 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@types/node": "^22.10.5",
"@types/socket.io": "^3.0.1",
"ts-node-dev": "^2.0.0",
"tslib": "^2.8.1",
"typescript": "^5.7.3"
},
"dependencies": {
Expand Down
22 changes: 11 additions & 11 deletions server/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import express from "express";
import { createServer } from "http";
import { Server, Socket } from "socket.io";
import {
import { createServer } from "node:http";
import { Server, type Socket } from "socket.io";
import type {
Room,
RoomData,
LeaveRoomData,
Expand Down Expand Up @@ -118,7 +118,7 @@ io.on("connection", (socket: Socket) => {
io.to(room_code).emit("update_room", { room_player, room });
console.log(
`Player "${room_player}" joined room "${room_code}". Room state:`,
room
room,
);
});

Expand All @@ -135,7 +135,7 @@ io.on("connection", (socket: Socket) => {
}

room.players = room.players.filter(
(player) => player.room_player !== room_player
(player) => player.room_player !== room_player,
);

if (room.players.length === 0) {
Expand All @@ -150,7 +150,7 @@ io.on("connection", (socket: Socket) => {
io.to(room_code).emit("update_room", { room_player, room });

console.log(
`Player ${room_player} (Socket ID: ${socket.id}) left room ${room_code}`
`Player ${room_player} (Socket ID: ${socket.id}) left room ${room_code}`,
);
});

Expand All @@ -164,7 +164,7 @@ io.on("connection", (socket: Socket) => {
if (!room) return;

const player = room.players.find(
(player) => player.room_player === room_player
(player) => player.room_player === room_player,
);
if (player) {
player.socket = socket.id;
Expand Down Expand Up @@ -221,7 +221,7 @@ io.on("connection", (socket: Socket) => {

console.log(
`Game in room "${room_code}" finished! Ranking:`,
ranking
ranking,
);
return;
}
Expand Down Expand Up @@ -251,16 +251,16 @@ io.on("connection", (socket: Socket) => {
if (!room) return;

const player = room.players.find(
(player) => player.room_player === room_player
(player) => player.room_player === room_player,
);

if (player) {
player.player_data.cookies = cookies;
console.log(
`Player "${room_player}" in room "${room_code}" updated cookies to ${cookies}.`
`Player "${room_player}" in room "${room_code}" updated cookies to ${cookies}.`,
);
}
}
},
);

/**
Expand Down

0 comments on commit ee8ab30

Please sign in to comment.