Skip to content

Deprecate endTurn({ remove: true }) and document what numPlayers no longer means #1329

Description

@devill

Two loose ends left by #1326 and #1327. Neither is urgent; both are cheap once the rest
lands.

endTurn({ remove: true })

Superseded by events.unseat(id), which removes a player through the same path as
leaveGame rather than as a side effect of ending a turn. Worth deprecating rather
than removing, since it is public API.

It also has a bug. In the arg.remove branch, flow.ts:582 returns the state
parameter rather than the locally updated one, so the updated ctx is discarded and
removing the last player silently does nothing. Present since #492 (2018).

concepts.md says nothing about what these mean now

After #1326, ctx.numPlayers is the seat count the match was created with — not how
many players are in it. It is deliberately left alone so that no existing game changes
behaviour, but that makes it the wrong thing to read in a game that opts into seating,
where it goes stale. ctx.players.length is the live count.

ctx.playOrder also needs a line: it is who plays this phase, in order, and it is
always a subset of ctx.players.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions