@hadoku/game-server 0.1.80 → 0.1.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -81,6 +81,11 @@ export interface ShellSeat {
|
|
|
81
81
|
* 2026-10-19). A seat nobody has joined yet is not away — it is starting.
|
|
82
82
|
*/
|
|
83
83
|
away: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* The person on this seat has been at this game: a connection of theirs reached it, once. Never
|
|
86
|
+
* cleared. A seat is held from the match's making (`claim`), so holding one says nothing of this.
|
|
87
|
+
*/
|
|
88
|
+
entered: boolean;
|
|
84
89
|
}
|
|
85
90
|
/** What the shell is handed: the log, and the graces and hooks of a seat's presence, a restart and an ending. */
|
|
86
91
|
export interface ShellDeps {
|
|
@@ -240,6 +245,8 @@ export declare abstract class MatchShell<Line extends {
|
|
|
240
245
|
* {@link checkWaitingOn}, and every bar {@link send} puts on the wire.
|
|
241
246
|
*/
|
|
242
247
|
syncClock(): void;
|
|
248
|
+
/** A seat whose clock a game's own rule holds still while it is waited on. None, unless a game says so. */
|
|
249
|
+
protected clockHeld(_seat: number): boolean;
|
|
243
250
|
/**
|
|
244
251
|
* Time the next flag: a timer for the running seat with the least time left. When it fires with time
|
|
245
252
|
* still on that seat's clock, it is armed again for what is left. Node fires a timer by the event
|
|
@@ -288,6 +295,8 @@ export declare abstract class MatchShell<Line extends {
|
|
|
288
295
|
* it over, and nobody's game is interrupted (`busy.ts`).
|
|
289
296
|
*/
|
|
290
297
|
anyoneHere(): boolean;
|
|
298
|
+
/** By seat: whether its person has been at this game (an AI seat has, always). */
|
|
299
|
+
entered(): boolean[];
|
|
291
300
|
/** A connection for this seat is back: whatever `seatDisconnected` armed is off. */
|
|
292
301
|
seatConnected(seat: number): void;
|
|
293
302
|
/**
|
package/dist/play/match/shell.js
CHANGED
|
@@ -171,12 +171,17 @@ export class MatchShell {
|
|
|
171
171
|
return;
|
|
172
172
|
const now = this.now();
|
|
173
173
|
const running = this.status === 'running' && this.timedOut === null;
|
|
174
|
-
const
|
|
174
|
+
const runs = (seat) => running && this.game.waitedOn(seat) && !this.clockHeld(seat);
|
|
175
|
+
const moved = this.clock.set([runs(0), runs(1)], now);
|
|
175
176
|
if (!moved)
|
|
176
177
|
return;
|
|
177
178
|
this.armFlag(now);
|
|
178
179
|
this.game.tellRoster();
|
|
179
180
|
}
|
|
181
|
+
/** A seat whose clock a game's own rule holds still while it is waited on. None, unless a game says so. */
|
|
182
|
+
clockHeld(_seat) {
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
180
185
|
/**
|
|
181
186
|
* Time the next flag: a timer for the running seat with the least time left. When it fires with time
|
|
182
187
|
* still on that seat's clock, it is armed again for what is left. Node fires a timer by the event
|
|
@@ -350,12 +355,17 @@ export class MatchShell {
|
|
|
350
355
|
anyoneHere() {
|
|
351
356
|
return this.seats.some((s) => s.here);
|
|
352
357
|
}
|
|
358
|
+
/** By seat: whether its person has been at this game (an AI seat has, always). */
|
|
359
|
+
entered() {
|
|
360
|
+
return this.seats.map((s) => s.ai || s.entered);
|
|
361
|
+
}
|
|
353
362
|
/** A connection for this seat is back: whatever `seatDisconnected` armed is off. */
|
|
354
363
|
seatConnected(seat) {
|
|
355
364
|
const s = this.seats[seat];
|
|
356
365
|
if (s === undefined)
|
|
357
366
|
return;
|
|
358
367
|
s.here = true;
|
|
368
|
+
s.entered = true;
|
|
359
369
|
if (s.away) {
|
|
360
370
|
s.away = false;
|
|
361
371
|
this.game.tellRoster();
|
|
@@ -66,7 +66,7 @@ export class RelayMatch extends HostedMatch {
|
|
|
66
66
|
hostSeatRef = null;
|
|
67
67
|
constructor(id, seatCount, deps, restore) {
|
|
68
68
|
super(id, relaySpec(seatCount), deps, restore);
|
|
69
|
-
this.seats = Array.from({ length: seatCount }, (_, seat) => ({ seat, ai: false, owner: null, playerId: seat, departure: null, here: false, away: false }));
|
|
69
|
+
this.seats = Array.from({ length: seatCount }, (_, seat) => ({ seat, ai: false, owner: null, playerId: seat, departure: null, here: false, away: false, entered: false }));
|
|
70
70
|
for (const [seat, owner] of (restore?.owners ?? []).entries()) {
|
|
71
71
|
const s = this.seats[seat];
|
|
72
72
|
if (s !== undefined && owner !== null)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hadoku/game-server",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "0.1.82",
|
|
4
|
+
"gitHead": "371fca27b0544afcd0e5080ee47a5ce9ad0459dc",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"description": "The server parts any hosted game shares, above the kernel: the app config and edge auth, the room core (identity, seats, sessions, membership, the room list, the generic room routes), match hosting (the host contract, local and remote JVMs, placement, the start queue, recordings, the in-process and relay runtimes), streams, erase, telemetry and usage. Knows no game; Magic plugs in from apps/server. MIT; imports only node built-ins, express, socket.io, @wolffm/* and the platform packages.",
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"play/remote/"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@wolffm/host-wire": "npm:@hadoku/host-wire@0.1.
|
|
20
|
-
"@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.
|
|
21
|
-
"@wolffm/service-kernel": "npm:@hadoku/service-kernel@0.1.
|
|
19
|
+
"@wolffm/host-wire": "npm:@hadoku/host-wire@0.1.82",
|
|
20
|
+
"@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.82",
|
|
21
|
+
"@wolffm/service-kernel": "npm:@hadoku/service-kernel@0.1.115",
|
|
22
22
|
"@wolffm/prefs-client": "npm:@hadoku/prefs-client@^1.1.31",
|
|
23
|
-
"@wolffm/rooms-protocol": "npm:@hadoku/rooms-protocol@^0.45.
|
|
24
|
-
"@wolffm/rooms-server": "npm:@hadoku/rooms-server@^0.45.
|
|
23
|
+
"@wolffm/rooms-protocol": "npm:@hadoku/rooms-protocol@^0.45.125",
|
|
24
|
+
"@wolffm/rooms-server": "npm:@hadoku/rooms-server@^0.45.125",
|
|
25
25
|
"express": "^5.1.0",
|
|
26
26
|
"socket.io": "^4.8.3",
|
|
27
27
|
"zod": "4.5.4"
|