Refresh readiness controls when native presence changes
This commit is contained in:
parent
d7630cacb1
commit
3e4c915fc2
2 changed files with 11 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue