From 72f4f06e2177911f8745596d464b21be65d9084b Mon Sep 17 00:00:00 2001 From: EJClaw Date: Sun, 8 Nov 2026 22:26:17 +0900 Subject: [PATCH] =?UTF-8?q?=EC=97=94=EC=A7=84:=20=ED=99=94=EB=A9=B4?= =?UTF-8?q?=EC=97=90=20=EB=B3=B4=EB=82=BC=20=EB=A7=88=EA=B0=90(publicDeadl?= =?UTF-8?q?ine)=EC=9D=84=20=EB=B0=A9=20=EC=95=88=20=EC=8B=9C=EA=B0=84=20?= =?UTF-8?q?=EC=B4=88=EA=B3=BC=EC=99=80=20=EB=B6=84=EB=A6=AC=20(=EC=95=84?= =?UTF-8?q?=EB=B0=9C=EB=A1=A0=20=EC=A0=9C=EC=99=B8=20=EB=B6=80=EB=B6=84)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- apps/server/src/rooms/room.ts | 9 ++++++++- packages/engine/src/types.ts | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/apps/server/src/rooms/room.ts b/apps/server/src/rooms/room.ts index 0bd5a5b..1571770 100644 --- a/apps/server/src/rooms/room.ts +++ b/apps/server/src/rooms/room.ts @@ -462,7 +462,7 @@ export class Room { view, events: [], active: this.game.finished ? [] : def.activePlayers(this.game.state), - deadline: this.game.finished ? null : this.effectiveDeadline(), + deadline: this.game.finished ? null : this.publicDeadline(), ...(cs !== undefined ? { cs } : {}), }; } @@ -1128,6 +1128,13 @@ export class Room { // ---------------------------------------------------------------- timers + /** The deadline clients see (`def.publicDeadline`, default the effective one); timers use `effectiveDeadline`. */ + private publicDeadline(): number | null { + const d = this.effectiveDeadline(); + const g = this.game; + return g && this.def.publicDeadline ? this.def.publicDeadline(g.state, d) : d; + } + /** Earliest time any timed player must be auto-acted for. */ effectiveDeadline(): number | null { const g = this.game; diff --git a/packages/engine/src/types.ts b/packages/engine/src/types.ts index 795daed..0cc25fa 100644 --- a/packages/engine/src/types.ts +++ b/packages/engine/src/types.ts @@ -86,6 +86,12 @@ export interface GameDefinition { * pulls forward to the end of the grace period). Real-time games use it to keep a minimum pace. */ timeoutNotBefore?(state: S): number | null; + /** + * Deadline shown to clients (`state.deadline`), given the room's effective one (the phase clock, pulled forward to + * the end of the grace period of an away timed player). Default: the effective one. Games where *who* is timed is a + * secret (아발론's assassin) hide that pull-forward; the room still times out on the effective deadline. + */ + publicDeadline?(state: S, effective: number | null): number | null; /** Grace period (ms) for disconnected timed players in this state, overriding the room's `graceSec`; null = room default. */ disconnectGraceMs?(state: S): number | null; onTimeout(state: S, player: PlayerId): A;