mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-23 06:09:37 +00:00
db501c68d2
Fixes #3911 ## Description: - Server captures `publicId` and `friends` from `getUserMe()` and includes each player's in-game friend `clientID`s in `PlayerSchema` on game start - Team assignment treats friends as a **soft preference** (best-effort): a non-clan player goes to the team where the most of their friends already are; if that team is full they spill to the next-emptiest team rather than getting kicked - Clans remain strict (kick overflow) since clan membership is an explicit opt-in; friends are implicit, so a friend-of-friend chain that doesn't fit shouldn't bench anyone - Friendship is symmetric — an edge from either direction counts, which keeps things working when one side's `getUserMe` is stale - Lobby preview unchanged — friend grouping only takes effect once the game actually starts (avoids exposing friend lists in the lobby payload) ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: evan
28 lines
868 B
TypeScript
28 lines
868 B
TypeScript
import WebSocket from "ws";
|
|
import { TokenPayload } from "../core/ApiSchemas";
|
|
import { Tick } from "../core/game/Game";
|
|
import { ClientID, PlayerCosmetics, Winner } from "../core/Schemas";
|
|
|
|
export class Client {
|
|
public lastPing: number = Date.now();
|
|
|
|
public hashes: Map<Tick, number> = new Map();
|
|
|
|
public reportedWinner: Winner | null = null;
|
|
|
|
constructor(
|
|
public readonly clientID: ClientID,
|
|
public readonly persistentID: string,
|
|
public readonly claims: TokenPayload | null,
|
|
public readonly role: string | null,
|
|
public readonly flares: string[] | undefined,
|
|
public readonly ip: string,
|
|
public username: string,
|
|
public clanTag: string | null,
|
|
public ws: WebSocket,
|
|
public readonly cosmetics: PlayerCosmetics | undefined,
|
|
public readonly publicId: string | undefined,
|
|
public readonly friends: string[],
|
|
) {}
|
|
}
|