diff --git a/packages/server/src/scene/scene.ts b/packages/server/src/scene/scene.ts index 2acf9f0..ae8c0f4 100644 --- a/packages/server/src/scene/scene.ts +++ b/packages/server/src/scene/scene.ts @@ -1,7 +1,5 @@ import { Body, Plane, Vec3, World } from "cannon-es"; -import type { - Actions, -} from "@neu5/types/src"; +import type { Actions } from "@neu5/types/src"; import { addRigidVehicle, getMapWalls } from "../utils"; import type { Game } from "../index"; @@ -9,7 +7,7 @@ import type { Room } from "../room"; import type { InMemorySessionStore } from "../sessionStore"; const FRAME_IN_MS = 1000 / 30; // 30 FPS -let loop = setInterval(() => { }, FRAME_IN_MS); +let loop = setInterval(() => {}, FRAME_IN_MS); const ACCELERATE = "accelerate"; const BRAKE = "brake"; diff --git a/packages/server/src/sockets/sockets.ts b/packages/server/src/sockets/sockets.ts index 147e9a2..54cb7d2 100644 --- a/packages/server/src/sockets/sockets.ts +++ b/packages/server/src/sockets/sockets.ts @@ -19,7 +19,7 @@ const ACTIONS = { [ACCELERATE]: ACCELERATE, [BRAKE]: BRAKE, [LEFT]: LEFT, - [RIGHT]: RIGHT + [RIGHT]: RIGHT, }; let raceLoop: NodeJS.Timer | null = null; @@ -69,11 +69,11 @@ const playersMapToArray = (list: PlayersList) => userID, ...(vehicle ? { - vehicle: { - body: vehicle?.body, - wheels: vehicle?.wheels, - }, - } + vehicle: { + body: vehicle?.body, + wheels: vehicle?.wheels, + }, + } : undefined), })); @@ -176,7 +176,13 @@ const createSocketHandlers = ({ socket.on( "client:action", - ({ playerActions, id }: { playerActions: Array; id: string }) => { + ({ + playerActions, + id, + }: { + playerActions: Array; + id: string; + }) => { if (playersMap === null) { return; } @@ -208,7 +214,9 @@ const createSocketHandlers = ({ socket.on("client:join race room", async () => { if (game.race.isStarted) { - socket.emit("server:show error", { message: "The race is already going on! You can't join the room now." }); + socket.emit("server:show error", { + message: "The race is already going on! You can't join the room now.", + }); return; } @@ -231,7 +239,9 @@ const createSocketHandlers = ({ socket.on("client:start the race", async () => { if (game.race.isStarted) { - socket.emit("server:show error", { message: "The race is already going on!" }); + socket.emit("server:show error", { + message: "The race is already going on!", + }); return; }