Let unready players finish choosing their own careers

This commit is contained in:
coyotte508 2026-09-30 03:14:55 +02:00
commit d3e20792a7
5 changed files with 14 additions and 7 deletions

View file

@ -237,8 +237,8 @@ export function move(input, command, seat, context) {
)
)
reject("Unsupported career field");
if (state.stage !== "presence" || state.players.some((p) => p.ready))
reject("Choose careers before anyone confirms readiness");
if (state.stage !== "presence" || state.players[seat].ready)
reject("Choose your career before confirming readiness");
const id = state.bgs.playerIds[seat],
e = state.bgs.explorers[id];
if (!e || !state.bgs.settings.careers)
@ -351,7 +351,8 @@ export function stripSecret(state, seat, context) {
e.id === id && e.runs.length
? eligibleAchievements(e, e.runs.at(-1).id)
: [],
editable: e.id === id,
editable:
e.id === id && state.stage === "presence" && !state.players[seat]?.ready,
}));
return view;
}

View file

@ -11,7 +11,7 @@
"engine": {
"package": {
"name": "@boardgamers/space-alert",
"version": "0.1.0"
"version": "0.1.1"
},
"entryPoint": "bgs/engine.js"
},

View file

@ -1,6 +1,6 @@
{
"name": "@boardgamers/space-alert",
"version": "0.1.0",
"version": "0.1.1",
"private": true,
"type": "module",
"description": "Space Alert and The New Frontier: deterministic game engine and local playtest",

View file

@ -767,7 +767,7 @@ export function mountConsole(root, host = null) {
host &&
e.editable &&
view.stage === "presence" &&
!view.players.some((p) => p.ready)
!view.players[seat]?.ready
? e.dead
? `<button data-new-explorer="${e.id}">${t("Nouvel explorateur", "New explorer")}</button>`
: Object.keys(e.specializations)

View file

@ -94,8 +94,14 @@ test("careers carry by account across reordered seats, and only their owner can
previous: { state: old, gameId: "old", playerIds: ["alice", "bob"] },
}),
);
const learned = e.move(
const teammateReady = e.move(
next,
{ type: "ready", sequence: 1 },
0,
ctx(2000),
);
const learned = e.move(
teammateReady,
{ type: "career", action: "learn", specialization: "medic", sequence: 1 },
1,
ctx(2001),