Files
OpenFrontIO/src/server/Client.ts
T
Tyler Hanavan 488188ff86 Fix the stale disconnected (Zzz) icon persisting when a client reconnects (#1631)
Fix the stale disconnected (Zzz) icon persisting when a client
reconnects

## Description:

Refer to issue #1630 

This change modifies the GameServer.addClient function to send the
mark_disconnected = false intent when a client that was previously
disconnected gets replaced by a newly joined client with the same
clientID. Under the old logic, this mark_disconnected = false intent is
not sent if the client was disconnected for longer than 60 seconds
before reconnecting.



https://github.com/user-attachments/assets/5e0ce1c3-9519-4f39-aa80-e46f1275649c

Left side browser (player with red tiles) is the disconnected client
that was disconnected at 00:14 game clock time. It reconnected around
03:56 game clock time.
Right side browser (player with green tiles) is the other client. Use
the game clock time from the right side for the live game clock time.

## 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
- [x] I have read and accepted the CLA agreement (only required once).

## Please put your Discord username so you can be contacted if a bug or
regression is found:

slyty

---------

Co-authored-by: Drills Kibo <59177241+drillskibo@users.noreply.github.com>
2025-08-01 04:24:15 +00:00

24 lines
732 B
TypeScript

import WebSocket from "ws";
import { TokenPayload } from "../core/ApiSchemas";
import { Tick } from "../core/game/Game";
import { ClientID } from "../core/Schemas";
export class Client {
public lastPing: number = Date.now();
public hashes: Map<Tick, number> = new Map();
constructor(
public readonly clientID: ClientID,
public readonly persistentID: string,
public readonly claims: TokenPayload | null,
public readonly roles: string[] | undefined,
public readonly flares: string[] | undefined,
public readonly ip: string,
public readonly username: string,
public readonly ws: WebSocket,
public readonly flag: string | undefined,
public readonly pattern: string | undefined,
) {}
}