Add teaching mode: admin can seed themselves as scene-1 Deep

An admin can now opt into "teaching mode" from the lobby, seeding
themselves as the Rank-3 player who must play the Deep in the first
scene (instead of leaving it to the random starting-rank roll), so they
can run the table for new crews.

- Game.teaching_deep_player_id (+ Alembic migration)
- maybe_finish_assign_techniques honors it before rolling ranks, so both
  the normal flow and the dev-mode skip path respect it
- Admin-gated POST .../teaching-mode toggle (pre-rank phases only)
- Lobby checkbox UI, greyed out if another admin already volunteered

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-14 09:14:58 -07:00
parent 5a9d712c95
commit bfe982251e
7 changed files with 117 additions and 1 deletions

View File

@@ -13,6 +13,22 @@
margin-bottom: 2rem;
}
.teaching-box {
text-align: left;
margin-bottom: 2rem;
padding: 1rem 1.25rem;
}
.teaching-box .checkbox-label.disabled {
opacity: 0.6;
cursor: not-allowed;
}
.teaching-box .info-text {
margin: 0.5rem 0 0;
font-size: 0.85rem;
}
.link-item {
margin-bottom: 1.5rem;
}

View File

@@ -24,6 +24,19 @@
starting = false;
}
}
$: teaching = state.game.teaching_deep_player_id === state.player.id;
$: teachingTakenByOther = state.game.teaching_deep_player_id && !teaching;
async function toggleTeaching() {
try {
await apiRequest(`/game/${state.game.id}/player/${state.player.id}/teaching-mode`, 'POST', {
enabled: !teaching
});
} catch (err) {
console.error("Failed to toggle teaching mode:", err);
}
}
</script>
<div class="lobby-view text-center">
@@ -72,6 +85,22 @@
{/if}
</div>
{#if state.player.is_admin}
<div class="teaching-box glass-panel">
<label class="checkbox-label" class:disabled={teachingTakenByOther}>
<input type="checkbox" checked={teaching} disabled={teachingTakenByOther} on:change={toggleTeaching}>
<span>📚 <strong>Teaching mode:</strong> I'll be the Deep for the first scene</span>
</label>
<p class="info-text">
{#if teachingTakenByOther}
Another admin has already volunteered to teach as the Deep.
{:else}
Seeds you as the Rank-3 player who must play the Deep in scene 1, so you can run the table for new crews. Otherwise it's assigned at random.
{/if}
</p>
</div>
{/if}
<div class="lobby-action">
{#if state.player.is_admin}
{#if state.players.length >= 3 || state.game.dev_mode}