엔진: 화면에 보낼 마감(publicDeadline)을 방 안 시간 초과와 분리 (아발론 제외 부분)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -86,6 +86,12 @@ export interface GameDefinition<S, A, V, O> {
|
||||
* 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;
|
||||
|
||||
Reference in New Issue
Block a user