Refresh readiness controls when native presence changes

This commit is contained in:
coyotte508 2026-09-30 10:18:52 +02:00
commit 3e4c915fc2
2 changed files with 11 additions and 0 deletions

View file

@ -139,6 +139,12 @@ export function advanceClock(input, now) {
export function setPresence(input, seats) {
const state = structuredClone(input);
if (
state.players.some(
(player) => player.present !== seats.includes(player.seat),
)
)
state.revision++;
for (const player of state.players)
player.present = seats.includes(player.seat);
return state;

View file

@ -181,6 +181,11 @@ test("platform presence gates readiness; user moves cannot spoof it", () => {
/Unsupported/,
);
const present = e.presenceChanged(absent, [0], ctx(1002));
assert.ok(present.revision > absent.revision);
assert.equal(
e.presenceChanged(present, [0], ctx(1003)).revision,
present.revision,
);
assert.equal(
e.move(present, { type: "ready", sequence: 1 }, 0, ctx(1003)).players[0]
.ready,