Bump dependencies

This commit is contained in:
Andras Schmelczer 2026-06-04 17:46:28 +01:00
parent 52ca1b8844
commit 913abb7642
40 changed files with 6200 additions and 19785 deletions

View file

@ -1,7 +1,10 @@
import { Command } from 'shared';
export class GeneratePointsCommand extends Command {
public constructor(public readonly decla: number, public readonly red: number) {
public constructor(
public readonly decla: number,
public readonly red: number,
) {
super();
}
}

View file

@ -1,5 +1,5 @@
import { PhysicalContainer } from './physics/containers/physical-container';
import ioserver from 'socket.io';
import { Server, Socket } from 'socket.io';
import {
TransportEvents,
deserialize,
@ -62,7 +62,10 @@ export class GameServer extends CommandReceiver {
[GeneratePointsCommand.type]: this.addPoints.bind(this),
};
constructor(private readonly io: ioserver.Server, private options: Options) {
constructor(
private readonly io: Server,
private options: Options,
) {
super();
this.serverName = options.name;
@ -70,7 +73,7 @@ export class GameServer extends CommandReceiver {
this.initialize();
io.on('connection', (socket: SocketIO.Socket) => {
io.on('connection', (socket: Socket) => {
socket.on(TransportEvents.PlayerJoining, (playerInfo: PlayerInformation) => {
try {
const player = this.players.createPlayer(playerInfo, socket);

View file

@ -1,4 +1,4 @@
import ioserver from 'socket.io';
import { Server as IoServer } from 'socket.io';
import express from 'express';
import { Server } from 'http';
import cors from 'cors';
@ -22,7 +22,13 @@ Random.seed = options.seed;
const app = express();
const server = new Server(app);
const io = ioserver(server, { parser } as any);
const io = new IoServer(server, {
parser,
cors: {
origin: true,
credentials: true,
},
} as any);
const gameServer = new GameServer(io, options);

View file

@ -88,9 +88,10 @@ export class CirclePhysical extends CommandReceiver implements Circle, DynamicPh
);
}
public stepManually(
deltaTimeInSeconds: number,
): { hitObject: GameObject | undefined; velocity: vec2 } {
public stepManually(deltaTimeInSeconds: number): {
hitObject: GameObject | undefined;
velocity: vec2;
} {
let delta = vec2.scale(vec2.create(), this.velocity, deltaTimeInSeconds);
this.radius += vec2.length(delta);

View file

@ -72,8 +72,8 @@ export class PlanetPhysical extends PlanetBase implements StaticPhysical {
return Math.abs(this.ownership - 0.5) < 0.1
? CharacterTeam.neutral
: this.ownership < 0.5
? CharacterTeam.decla
: CharacterTeam.red;
? CharacterTeam.decla
: CharacterTeam.red;
}
private timeSinceLastPointGeneration = 0;

View file

@ -5,7 +5,10 @@ import { StaticPhysical } from '../physicals/static-physical';
class Node {
public left: Node | null = null;
public right: Node | null = null;
constructor(public object: StaticPhysical, public parent: Node | null) {}
constructor(
public object: StaticPhysical,
public parent: Node | null,
) {}
}
export class BoundingBoxTree {

View file

@ -56,9 +56,8 @@ export abstract class PlayerBase extends CommandReceiver {
);
const playerBoundingBox = getBoundingBoxOfCircle(playerBoundingCircle);
const possibleIntersectors = this.objectContainer.findIntersecting(
playerBoundingBox,
);
const possibleIntersectors =
this.objectContainer.findIntersecting(playerBoundingBox);
if (!isCircleIntersecting(playerBoundingCircle, possibleIntersectors)) {
return playerPosition;
}

View file

@ -1,4 +1,5 @@
import { CharacterTeam, PlayerInformation, Random, settings, Command } from 'shared';
import { Socket } from 'socket.io';
import { PhysicalContainer } from '../physics/containers/physical-container';
import { NPC } from './npc';
import { Player } from './player';
@ -29,7 +30,7 @@ export class PlayerContainer {
}
}
public createPlayer(playerInfo: PlayerInformation, socket: SocketIO.Socket): Player {
public createPlayer(playerInfo: PlayerInformation, socket: Socket): Player {
if (this._players.length === this.playerMaxCount) {
throw new Error('Too many players');
}

View file

@ -23,6 +23,7 @@ import {
PropertyUpdatesForObject,
PrimaryActionCommand,
} from 'shared';
import { Socket } from 'socket.io';
import { BoundingBox } from '../physics/bounding-boxes/bounding-box';
import { PhysicalContainer } from '../physics/containers/physical-container';
import { CharacterPhysical } from '../objects/character-physical';
@ -51,7 +52,7 @@ export class Player extends PlayerBase {
playerContainer: PlayerContainer,
objectContainer: PhysicalContainer,
team: CharacterTeam,
private readonly socket: SocketIO.Socket,
private readonly socket: Socket,
) {
super(playerInfo, playerContainer, objectContainer, team);
this.createCharacter();