mirror of
https://github.com/db9979/uconsole_asw_game.git
synced 2026-12-06 21:04:18 +01:00
Side choice: a new game asks which unit to play; solo can play the boat
The uConsole asks "Which unit do you play?" before every new game (frigate or hostile submarine, last choice preselected). The browser lobby first shows the unit, then its stations. A solo browser switches all its stations to the boat's six (and back) from the host bar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
064a2fb063
commit
4d2500fceb
22 files changed
+170
-31
No files matched your search
@@ -19,6 +19,8 @@
|
||||
.lobby-heading { max-width: 60rem; padding-bottom: .9rem; border-bottom: 1px solid var(--line); }
|
||||
.lobby-heading > p:last-child { margin-top: .5rem; color: var(--text-dim); }
|
||||
.lobby-status { min-height: 2.5rem; padding: .6rem 0; color: var(--caution); }
|
||||
.side-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 12rem)); gap: .55rem; padding: 4px; }
|
||||
.side-choice button { min-height: 44px; }
|
||||
.station-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: .55rem; padding: 4px; }
|
||||
.station-card { display: grid; grid-template-rows: auto 1fr auto; gap: .55rem; min-width: 0; padding: .9rem; background: var(--bg-2); border: 1px solid var(--line); border-top: 2px solid var(--live); border-radius: var(--radius); }
|
||||
.station-card h2 { color: var(--text); font-size: var(--font-md); }
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<div class="status-mission"><h1 id="mission-name"></h1><span id="phase" class="badge"></span></div>
|
||||
<div class="status-clocks" data-i18n-aria="status_clocks"><dl id="mission-metrics" class="metrics"></dl><div class="utc-clock"><span data-i18n="status_utc"></span><time id="utc-clock"></time></div></div>
|
||||
<p id="connection" class="connection" role="status" aria-live="polite"></p>
|
||||
<div id="host-bar" class="host-bar" role="group" data-i18n-aria="host_bar" hidden><a id="web-admin-link" href="/admin" data-i18n="admin_room" hidden></a><button id="host-save" type="button" data-i18n="host_save"></button><button id="host-load" type="button" data-i18n="host_load"></button><button id="host-new" type="button" data-i18n="host_new"></button><button id="host-instructor" type="button" data-i18n="instructor_open"></button><span id="host-status" class="host-status" role="status" aria-live="polite"></span></div>
|
||||
<div id="host-bar" class="host-bar" role="group" data-i18n-aria="host_bar" hidden><a id="web-admin-link" href="/admin" data-i18n="admin_room" hidden></a><button id="host-save" type="button" data-i18n="host_save"></button><button id="host-load" type="button" data-i18n="host_load"></button><button id="host-new" type="button" data-i18n="host_new"></button><button id="host-instructor" type="button" data-i18n="instructor_open"></button><button id="host-side" type="button"></button><span id="host-status" class="host-status" role="status" aria-live="polite"></span></div>
|
||||
<div class="status-actions">
|
||||
<button id="sound" type="button" aria-pressed="false" data-i18n="sound_off"></button>
|
||||
<button id="disabled-control-explain" type="button" aria-expanded="false" aria-controls="disabled-control-help" data-i18n-aria="disabled_control_explain" hidden>?</button>
|
||||
@@ -55,6 +55,7 @@
|
||||
<main id="lobby" class="lobby" hidden>
|
||||
<header class="lobby-heading"><p class="eyebrow" data-i18n="lobby_eyebrow"></p><h1 data-i18n="lobby_title"></h1><p data-i18n="lobby_intro"></p><button id="lobby-back" type="button" data-i18n="lobby_back" hidden></button></header>
|
||||
<p id="lobby-status" class="lobby-status" role="status" aria-live="polite"></p>
|
||||
<div id="side-choice" class="side-choice" role="group" data-i18n-aria="side_choice"><button id="side-frigate" type="button" data-side="frigate" aria-pressed="true" data-i18n="side_frigate"></button><button id="side-opfor" type="button" data-side="opfor" aria-pressed="false" data-i18n="side_opfor"></button></div>
|
||||
<div id="station-cards" class="station-cards" data-i18n-aria="lobby_stations"></div>
|
||||
</main>
|
||||
<aside id="role-rail" class="role-rail" hidden aria-labelledby="role-rail-title">
|
||||
|
||||
@@ -20,7 +20,7 @@ import { analysisProfile, renderContactAnalysis } from "../views/analyzer.js";
|
||||
import { chartGeometry, fitChart, plotClick, plotTrackBearing, queueDraw, releaseCanvas } from "../views/chart.js";
|
||||
import { activateDirectFire, confirmFireDialog, renderActionState, renderDirectFireControls, renderSonarControlPage } from "../views/controls.js";
|
||||
import { clearFireConfirmation } from "../views/dom.js";
|
||||
import { acceptSession, activateTab, chooseStation, mutateStation, renderLobby } from "../views/lobby.js";
|
||||
import { acceptSession, activateTab, chooseSide, chooseStation, mutateStation, renderLobby } from "../views/lobby.js";
|
||||
import { changeLookoutRange, queueLookoutDraw, renderLookoutStatus, zoom } from "../views/lookout.js";
|
||||
import { renderSnapshot } from "../views/render.js";
|
||||
import { hideMapTooltip, mapTooltipLines, nearestMapInfo, roleMapGeometry, showMapTooltip, stopOpzSweepAnimation, syncOpzSweepAnimation } from "../views/role-map.js";
|
||||
@@ -296,6 +296,8 @@ export function init() {
|
||||
for (const id of ["add-station", "mobile-add-station", "workstation-add-station"]) {
|
||||
$(id).addEventListener("click", openStationPicker);
|
||||
}
|
||||
for (const button of $("side-choice").querySelectorAll("button"))
|
||||
button.addEventListener("click", () => chooseSide(button.dataset.side));
|
||||
$("lobby-back").addEventListener("click", () => {
|
||||
S.stationPickerOpen = false;
|
||||
renderLobby();
|
||||
|
||||
@@ -37,6 +37,8 @@ export const S = {
|
||||
queuedSonarFocus: null,
|
||||
stationPickerOpen: false,
|
||||
lobbyMessage: null,
|
||||
// Unit chosen in the lobby ("frigate" | "opfor"); held stations decide otherwise.
|
||||
lobbySide: "frigate",
|
||||
commandMessage: null,
|
||||
lastToastedMessage: null,
|
||||
opzMarked: new Set(),
|
||||
|
||||
@@ -5,6 +5,8 @@ import { renderDisabledReasons, unavailable } from "./controls.js";
|
||||
import { node } from "./dom.js";
|
||||
import { simlogActive } from "./simlog.js";
|
||||
import { sendHostAction } from "../net/host.js";
|
||||
import { switchSoloSide } from "./lobby.js";
|
||||
import { opforRoles } from "../core/base.js";
|
||||
|
||||
// ---- Solo host surface --------------------------------------------------
|
||||
const scenarioText = {s1_patrouille: "scenario_s1_patrouille", s2_doppeljagd: "scenario_s2_doppeljagd",
|
||||
@@ -32,7 +34,7 @@ export function renderHost() {
|
||||
$("host-screen").hidden = !menu || simlogActive();
|
||||
if (!active) {
|
||||
for (const id of ["host-save", "host-load", "host-new",
|
||||
"host-instructor", "host-screen-new", "host-screen-load",
|
||||
"host-instructor", "host-side", "host-screen-new", "host-screen-load",
|
||||
"host-new-start"]) $(id).disabled = true;
|
||||
for (const button of $("host-slot-list").querySelectorAll("button"))
|
||||
button.disabled = true;
|
||||
@@ -45,6 +47,9 @@ export function renderHost() {
|
||||
$("host-load").disabled = !replacing;
|
||||
$("host-new").disabled = !replacing;
|
||||
$("host-instructor").disabled = !any;
|
||||
const boat = opforRoles.has(S.session.station);
|
||||
$("host-side").textContent = t(boat ? "host_play_frigate" : "host_play_opfor");
|
||||
$("host-side").disabled = !ready || S.stationMutation;
|
||||
$("host-screen-new").disabled = !replacing;
|
||||
$("host-screen-load").disabled = !replacing;
|
||||
$("host-new-start").disabled = !replacing;
|
||||
@@ -154,6 +159,7 @@ export function init() {
|
||||
for (const id of ["host-save"]) $(id).addEventListener("click", () => openSlotDialog("save"));
|
||||
for (const id of ["host-load", "host-screen-load"]) $(id).addEventListener("click", () => openSlotDialog("load"));
|
||||
for (const id of ["host-new", "host-screen-new"]) $(id).addEventListener("click", openNewGameDialog);
|
||||
$("host-side").addEventListener("click", switchSoloSide);
|
||||
$("host-instructor").addEventListener("click", () => {
|
||||
if (!S.hostView) return;
|
||||
const dialog = $("instructor-dialog");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { S } from "../state/store.js";
|
||||
import { renderSonarAudio, sonarAudioAuthorized, stopSonarAudio } from "../audio/audio.js";
|
||||
import { $, sideStations, stationNames } from "../core/base.js";
|
||||
import { $, opforRoles, sideStations, stationNames } from "../core/base.js";
|
||||
import { authenticated, t } from "../core/format.js";
|
||||
import { poll } from "../net/poll.js";
|
||||
import { request } from "../net/request.js";
|
||||
@@ -57,8 +57,15 @@ export function renderLobby() {
|
||||
return card;
|
||||
}));
|
||||
}
|
||||
// One unit at a time: the side of the held stations, else the lobby choice.
|
||||
const side = S.session.station !== null ? (opforRoles.has(S.session.station) ? "opfor" : "frigate") : S.lobbySide;
|
||||
for (const button of $("side-choice").querySelectorAll("button")) {
|
||||
button.setAttribute("aria-pressed", String(button.dataset.side === side));
|
||||
button.disabled = S.session.station !== null && button.dataset.side !== side;
|
||||
}
|
||||
stationNames.forEach((station, index) => {
|
||||
const record = S.session.stations[station];
|
||||
$("station-cards").children[index].hidden = (opforRoles.has(station) ? "opfor" : "frigate") !== side;
|
||||
const state = record.status;
|
||||
const card = $("station-cards").children[index];
|
||||
const [heading, occupancy, button] = card.children;
|
||||
@@ -194,6 +201,17 @@ export async function mutateStation(path, body) {
|
||||
}
|
||||
}
|
||||
}
|
||||
export function chooseSide(side) {
|
||||
if (!["frigate", "opfor"].includes(side)) return;
|
||||
S.lobbySide = side;
|
||||
renderLobby();
|
||||
}
|
||||
// Solo: the one browser plays the other unit; the server moves every station.
|
||||
export function switchSoloSide() {
|
||||
if (S.session?.host === null || S.session?.station == null || S.stationMutation) return;
|
||||
const target = opforRoles.has(S.session.station) ? "bridge" : "uboot";
|
||||
mutateStation("/stations/request", { station: target });
|
||||
}
|
||||
function requestStation(station) {
|
||||
if (!stationNames.includes(station) || S.session?.stations[station]?.status === "mine" ||
|
||||
S.session.requested_station !== null) return;
|
||||
|
||||
@@ -430,6 +430,11 @@
|
||||
"commander.web.lobby_request_cleared": "Die Stationsanfrage ist nicht mehr ausstehend. Verfügbare Station wählen oder den Host fragen.",
|
||||
"commander.web.station_request": "Beim Host anfragen",
|
||||
"commander.web.station_take": "Station übernehmen",
|
||||
"commander.web.side_choice": "Welche Einheit spielst du?",
|
||||
"commander.web.side_frigate": "Fregatte",
|
||||
"commander.web.side_opfor": "U-Boot",
|
||||
"commander.web.host_play_opfor": "U-Boot spielen",
|
||||
"commander.web.host_play_frigate": "Fregatte spielen",
|
||||
"commander.web.station_requested": "Anfrage ausstehend",
|
||||
"commander.web.lobby_back": "Zurück zur Station",
|
||||
"commander.web.station_mutation_failed": "Die Stationsänderung wurde nicht bestätigt. Nichts wurde wiederholt; vor einem neuen Versuch die Verbindung prüfen.",
|
||||
@@ -4090,6 +4095,12 @@
|
||||
"menu.local_side": "uConsole spielt {side} (Optionen F10, Seite 2)",
|
||||
"menu.local_side.frigate": "die Fregatte",
|
||||
"menu.local_side.uboot": "das U-BOOT (Fregatte über Remote Crew F9)",
|
||||
"menu.choose_side": "Welche Einheit spielst du?",
|
||||
"menu.side.frigate": "Fregatte F-217",
|
||||
"menu.side.frigate.note": "Neun Stationen am uConsole; Browser können jede davon besetzen (F9).",
|
||||
"menu.side.uboot": "Feindliches U-Boot",
|
||||
"menu.side.uboot.note": "Sechs Bootsstationen am uConsole; Browser besetzen Fregatte oder Boot (F9).",
|
||||
"menu.side_hint": "Auf/Ab oder 1/2: wählen | Enter: weiter | Esc: zurück",
|
||||
"help.uboot.title": "U-Boot spielen (uConsole)",
|
||||
"help.uboot.views": "U-Boot-Führung / U-Boot-Sonar / wechseln",
|
||||
"help.uboot.orders": "Kurs / Fahrt / Tiefe befehlen (Zahl, Enter)",
|
||||
|
||||
@@ -430,6 +430,11 @@
|
||||
"commander.web.lobby_request_cleared": "The station request is no longer pending. Select an available station or ask the host.",
|
||||
"commander.web.station_request": "Ask the host",
|
||||
"commander.web.station_take": "Take station",
|
||||
"commander.web.side_choice": "Which unit do you play?",
|
||||
"commander.web.side_frigate": "Frigate",
|
||||
"commander.web.side_opfor": "Submarine",
|
||||
"commander.web.host_play_opfor": "Play the submarine",
|
||||
"commander.web.host_play_frigate": "Play the frigate",
|
||||
"commander.web.station_requested": "Request pending",
|
||||
"commander.web.lobby_back": "Back to station",
|
||||
"commander.web.station_mutation_failed": "The station change was not confirmed. Nothing was retried; check the connection before trying again.",
|
||||
@@ -4090,6 +4095,12 @@
|
||||
"menu.local_side": "uConsole plays {side} (Options F10, page 2)",
|
||||
"menu.local_side.frigate": "the frigate",
|
||||
"menu.local_side.uboot": "the SUBMARINE (frigate via Remote Crew F9)",
|
||||
"menu.choose_side": "Which unit do you play?",
|
||||
"menu.side.frigate": "Frigate F-217",
|
||||
"menu.side.frigate.note": "Nine stations on the uConsole; browsers may crew any of them (F9).",
|
||||
"menu.side.uboot": "Hostile submarine",
|
||||
"menu.side.uboot.note": "Six boat stations on the uConsole; browsers crew the frigate or the boat (F9).",
|
||||
"menu.side_hint": "Up/Down or 1/2: choose | Enter: continue | Esc: back",
|
||||
"help.uboot.title": "Playing the submarine (uConsole)",
|
||||
"help.uboot.views": "Submarine command / submarine sonar / switch",
|
||||
"help.uboot.orders": "Order course / speed / depth (number, Enter)",
|
||||
|
||||
@@ -81,5 +81,5 @@ Die Statuszeile unten zeigt das neueste Ereignis und die wichtigste Telemetrie;
|
||||
|
||||
- Menü: `1`-`4` Szenario (4 = Zufall mit eigener Schwierigkeit), `W` Weltmodus, `R` neuer Seed, `F` Vollbild, `Enter` Start.
|
||||
- `S` / `L`: Speichern / Laden (Plätze 1-5). Spielstände sind exakt und deterministisch: ein geladenes Spiel läuft identisch weiter.
|
||||
- `F10`: Optionen - Sprache, Vollbild, Audio, große Schrift, Tooltips, Bildrate (30 oder 60 FPS; 30 spart Rechenleistung auf der uConsole und ist voreingestellt), Ereignislog/Telemetrie als Statuszeile (Standard, mehr Platz für die Station) oder feste Leiste, Bedienerassistenz aus (Standard: Rohdaten und manuelle Analyse) oder Training (automatische Linienbeschriftung, Blattfrequenz- und Katalog-/Senderkandidaten). Seite 2 (`Bild ab`/`Tab`): welche Seite der uConsole spielt, Fregatte (Standard) oder feindliches U-Boot; nur im Hauptmenü, nie gespeichert.
|
||||
- `F10`: Optionen - Sprache, Vollbild, Audio, große Schrift, Tooltips, Bildrate (30 oder 60 FPS; 30 spart Rechenleistung auf der uConsole und ist voreingestellt), Ereignislog/Telemetrie als Statuszeile (Standard, mehr Platz für die Station) oder feste Leiste, Bedienerassistenz aus (Standard: Rohdaten und manuelle Analyse) oder Training (automatische Linienbeschriftung, Blattfrequenz- und Katalog-/Senderkandidaten). Seite 2 (`Bild ab`/`Tab`): welche Seite der uConsole spielt, Fregatte (Standard) oder feindliches U-Boot; nur im Hauptmenü, nie gespeichert. Ein neues Spiel fragt ohnehin zuerst danach.
|
||||
- `F9`: Commander / Remote Crew - Browser im LAN können Stationen übernehmen. Eine freie Station wird sofort mit allen ihren Rechten übernommen (auch Direktfeuer und Sonar-Liveaudio, wo die Station sie hat); eine Station, die ein Crewmitglied hält, wird angefragt, und der Host kann sie übergeben. Der Host kann jederzeit eine Station oder einzelne Rechte entziehen.
|
||||
@@ -81,5 +81,5 @@ The bottom status ticker shows the newest event and key telemetry; `F11` opens t
|
||||
|
||||
- Menu: `1`-`4` scenario (4 = random with custom difficulty), `W` world mode, `R` new seed, `F` fullscreen, `Enter` start.
|
||||
- `S` / `L`: save / load (slots 1-5). Saves are exact and deterministic: a loaded game continues identically.
|
||||
- `F10`: options - language, fullscreen, audio, large text, tooltips, frame rate (30 or 60 FPS; 30 saves CPU on the uConsole and is the default), event log / telemetry as status ticker (default, more room for the station) or docked band, operator assistance off (default: raw data and manual analysis) or training (automatic line labels, blade-rate and catalogue/emitter candidates). Page 2 (`PgDn`/`Tab`): which side the uConsole plays, frigate (default) or hostile submarine; only in the main menu, never saved.
|
||||
- `F10`: options - language, fullscreen, audio, large text, tooltips, frame rate (30 or 60 FPS; 30 saves CPU on the uConsole and is the default), event log / telemetry as status ticker (default, more room for the station) or docked band, operator assistance off (default: raw data and manual analysis) or training (automatic line labels, blade-rate and catalogue/emitter candidates). Page 2 (`PgDn`/`Tab`): which side the uConsole plays, frigate (default) or hostile submarine; only in the main menu, never saved. A new game asks for it first anyway.
|
||||
- `F9`: Commander / Remote Crew - lets browser clients on the LAN take stations. A free station is taken at once with all of its rights (including direct fire and live sonar audio where the station has them); a station a crewmate holds is requested, and the host can hand it over. The host can revoke a station or single rights at any time.
|
||||
@@ -100,7 +100,7 @@ U-Boot-Physik: der Rumpf beschleunigt auf die befohlene Fahrt (kein Sofortsprint
|
||||
|
||||
## Besetztes Gegner-U-Boot (Remote Crew) {#ref-opfor}
|
||||
|
||||
Eine zweite Crew kann den Gegner spielen. Das Boot hat sechs Stationen: Führung, Sonar, Waffen, Maschine, Mast & ESM und Navigation; ein Browser übernimmt sie wie die der Fregatte (`F9`). Solange eine davon besetzt ist, folgt das lebende feindliche U-Boot mit der kleinsten Nummer nur den Befehlen dieser Crew; werden die Rollen abgegeben, vom Host entzogen oder ein Spielstand geladen, übernimmt die KI das Boot wieder dort, wo es gerade ist. Ein Browser hält nur Rollen einer Seite (Fregatte oder U-Boot), nie beide, und der Solo-Modus enthält die U-Boot-Rollen nie.
|
||||
Eine zweite Crew kann den Gegner spielen. Das Boot hat sechs Stationen: Führung, Sonar, Waffen, Maschine, Mast & ESM und Navigation; ein Browser übernimmt sie wie die der Fregatte (`F9`). Solange eine davon besetzt ist, folgt das lebende feindliche U-Boot mit der kleinsten Nummer nur den Befehlen dieser Crew; werden die Rollen abgegeben, vom Host entzogen oder ein Spielstand geladen, übernimmt die KI das Boot wieder dort, wo es gerade ist. Ein Browser hält nur Rollen einer Seite (Fregatte oder U-Boot), nie beide; die Lobby fragt zuerst, welche Einheit er spielt. Im Solo-Modus hält der eine Browser alle neun Stationen der Fregatte oder mit **U-Boot spielen** in der Host-Leiste alle sechs Stationen des Boots (zurück mit **Fregatte spielen**).
|
||||
|
||||
- **Stationen:** Die *Führung* befiehlt Kurs, Fahrt und Tiefe, legt das Boot auf Grund, pingt, nimmt eine BT-Messung und sieht das ganze Boot. Die *Navigation* befiehlt Kurs und Tiefe, führt den Plot des Boots und überwacht Kiel und Hindernisse. Die *Maschine* bedient Telegraf, Schnorchel, Schleichfahrt und Notanblasen und überwacht Batterie und Lärm. *Mast & ESM* fährt den Mast aus und überwacht ESM und Alarme. Die *Waffen* schießen, lenken die Drähte und stoßen Täuschkörper aus. Das *Sonar* ist der Sonarraum des Boots. Jeder Befehl wird nur von der Station angenommen, zu der er gehört.
|
||||
- **Befehle und Waffen:** das Boot folgt Kurs-, Fahrt- und Tiefenbefehlen im Rahmen seiner Wende-, Tiefen- und Beschleunigungsgrenzen; Fahrtstufen (Stopp, 3, 6, 10, 15 kn, Maximum) setzen die Fahrt schnell. Schießt einen Torpedo auf die gemessene Peilung eines Sonarkontakts, mit Ping-Fix oder TMA-Lösung, solange aktuell, oder auf eine freie Peilung mit optionaler Entfernung; der Schuss braucht ein klares Rohr und das Ziel im Schussfeld der Rohre. Die Crew stellt die Lauftiefe ein (5-300 m, sonst eine flache Voreinstellung) und schießt einen Torpedo oder zwei im Fächer von ±4°, jeder mit eigenem Datum. Jeder Crew-Torpedo läuft am Draht: die Crew kann sein Datum versetzen (Peilung und Entfernung vom Boot), und der Draht dreht ihn darauf ein, bis sein Suchkopf erfasst; schneller als 10 kn oder stärker als 1,5°/s drehen für 5 s lässt den Draht reißen, ebenso eine abgelaufene Spule, und die Crew kann ihn kappen. Stößt einen Täuschkörper aus und bläst einmal notfallmäßig an.
|
||||
@@ -114,7 +114,7 @@ Eine zweite Crew kann den Gegner spielen. Das Boot hat sechs Stationen: Führung
|
||||
|
||||
### U-Boot am uConsole spielen {#ref-opfor-local}
|
||||
|
||||
Im Hauptmenü unter Optionen (`F10`) auf Seite 2 (`Bild ab` oder `Tab`) **uConsole spielt** auf *Feindliches U-Boot* stellen (oder mit `--play-sub` starten): Dann führt der uConsole das feindliche U-Boot statt der Fregatte. Die Fregatte wird dann über Remote Crew (`F9`) aus den Browsern besetzt oder fährt mit Autocrew. Der uConsole zeigt nur das Lagebild des Boots; Banner, Ereignislog, Soundeffekte, Plot und Tooltips der Fregatte erscheinen nie, und Trackball- und Telegraphenbedienung der Fregatte sind gesperrt. Die Seite lässt sich nur außerhalb einer Mission wechseln; die Wahl gilt nur für diesen Programmstart und wird nie gespeichert, jeder Start beginnt also mit der Fregatte.
|
||||
Jedes neue Spiel fragt zuerst **Welche Einheit spielst du?**: *Fregatte F-217* oder *Feindliches U-Boot* (`Auf`/`Ab` oder `1`/`2`, `Enter`; die letzte Wahl ist vorausgewählt, `--play-sub` wählt das U-Boot vor). Außerhalb einer Mission ändert auch Optionen (`F10`) Seite 2 **uConsole spielt** die Wahl, etwa vor dem Laden eines Spielstands. Mit dem U-Boot führt der uConsole das feindliche Boot statt der Fregatte. Die Fregatte wird dann über Remote Crew (`F9`) aus den Browsern besetzt oder fährt mit Autocrew. Der uConsole zeigt nur das Lagebild des Boots; Banner, Ereignislog, Soundeffekte, Plot und Tooltips der Fregatte erscheinen nie, und Trackball- und Telegraphenbedienung der Fregatte sind gesperrt. Die Seite lässt sich nur außerhalb einer Mission wechseln; die Wahl gilt nur für diesen Programmstart und wird nie gespeichert, jeder Start beginnt also mit der Fregatte.
|
||||
|
||||
Die **U-Boot-Führung** ist aufgebaut wie die Brücke: links die Seekarte (bekannte Geografie, das eigene Boot mit Sollkurs und Fahrtvektor, die Peilstriche der eigenen Sonarkontakte bzw. ihr Symbol bei aktuellem Ping- oder TMA-Fix, die eigenen Torpedos `T1`…, ein begrenztes Schussfeld der Rohre), rechts die Station mit Bedrohungsleiste (Torpedoalarm und gehörtes Aktivsonar mit gemessener Peilung, Rumpfschaden, Kavitation, schwache Batterie, ESM-Radarerfassung) und zwei Seiten. **Navigation** zeigt Kurs und Tiefe, das Wasser unter dem Kiel und ein kartiertes Hindernis voraus, Fahrt, Eigenlärm, Batterie und die aktiven Betriebsarten sowie die Wassersäule unter dem Boot: Bootstiefe, befohlene Tiefe, sichere Tiefe und Grund; die Sprungschicht erscheint dort erst nach einer eigenen BT-Messung (`E` am U-Boot-Sonar). **Waffen & Kontakte** zeigt Feuerbereitschaft, Torpedos, klare Rohre, Nachladen, Täuschkörper, Notanblasen und die eigenen Sonarkontakte. Unten stehen Bootslog und Telemetrie des Boots, als Leiste oder Statuszeile wie in den Optionen eingestellt; Befehle, Schüsse und Täuschkörper werden dort protokolliert.
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ Submarine physics: the hull accelerates toward an ordered speed (no instant spri
|
||||
|
||||
## Crewed opposing submarine (Remote Crew) {#ref-opfor}
|
||||
|
||||
A second crew can play the enemy. The boat has six stations: Command, Sonar, Weapons, Engine room, Mast & ESM and Navigation; a browser takes them like the frigate's (`F9`). As long as one of them is held, the living hostile submarine with the lowest number follows only that crew's orders; when the roles are released, the host revokes them or a game is loaded, the AI takes the boat back from where it is. A browser holds roles of one side only (frigate or submarine), never both, and solo mode never includes the submarine roles.
|
||||
A second crew can play the enemy. The boat has six stations: Command, Sonar, Weapons, Engine room, Mast & ESM and Navigation; a browser takes them like the frigate's (`F9`). As long as one of them is held, the living hostile submarine with the lowest number follows only that crew's orders; when the roles are released, the host revokes them or a game is loaded, the AI takes the boat back from where it is. A browser holds roles of one side only (frigate or submarine), never both; the lobby first asks which unit it plays. In solo mode the one browser holds all nine frigate stations, or with **Play the submarine** in the host bar all six boat stations (and back with **Play the frigate**).
|
||||
|
||||
- **Stations:** *Command* orders course, speed and depth, lies on the bottom, pings and takes a BT, and sees the whole boat. *Navigation* orders course and depth, keeps the boat's plot and watches keel and obstacles. *Engine room* runs the telegraph, snorkel, silent running and the emergency blow and watches battery and noise. *Mast & ESM* raises the mast and watches ESM and alarms. *Weapons* fires, guides the wires and launches decoys. *Sonar* is the boat's sonar room. Each order is accepted only from the station that owns it.
|
||||
- **Orders and weapons:** the boat follows course, speed and depth orders within its turn, depth and acceleration limits; telegraph steps (stop, 3, 6, 10, 15 kn, maximum) set the speed quickly. Fires a torpedo down a sonar contact's measured bearing, with its ping fix or TMA solution while current, or down a free bearing with an optional range; firing needs a ready tube and the target inside the tube arc. The crew sets the run depth (5-300 m, otherwise a shallow default) and fires one torpedo or two in a ±4° spread, each with its own datum. Every crew torpedo runs on a wire: the crew can move its datum (bearing and distance from the boat) and the wire turns it onto the new datum until its seeker acquires; faster than 10 kn or turning harder than 1.5°/s for 5 s breaks the wire, as does running out of either spool, and the crew can cut it. Launches a decoy and makes the one emergency blow.
|
||||
@@ -114,7 +114,7 @@ A second crew can play the enemy. The boat has six stations: Command, Sonar, Wea
|
||||
|
||||
### Playing the submarine on the uConsole {#ref-opfor-local}
|
||||
|
||||
In the main menu, open Options (`F10`), switch to page 2 (`PgDn` or `Tab`) and set **uConsole plays** to *Hostile submarine* (or start with `--play-sub`): the uConsole then commands the hostile submarine instead of the frigate. The frigate is then crewed from the browsers through Remote Crew (`F9`) or runs on autocrew. The uConsole shows only the boat's own picture; the frigate's banners, event log, sound cues, plot and tooltips never appear, and its trackball and telegraph controls are disabled. The side can only be changed outside a mission; it lasts for this launch and is never saved, so every launch starts with the frigate.
|
||||
Every new game first asks **Which unit do you play?**: *Frigate F-217* or *Hostile submarine* (`Up`/`Down` or `1`/`2`, `Enter`; the last choice is preselected, `--play-sub` preselects the submarine). Outside a mission, Options (`F10`) page 2 **uConsole plays** changes it as well, for example before loading a game. With the submarine the uConsole commands the hostile boat instead of the frigate. The frigate is then crewed from the browsers through Remote Crew (`F9`) or runs on autocrew. The uConsole shows only the boat's own picture; the frigate's banners, event log, sound cues, plot and tooltips never appear, and its trackball and telegraph controls are disabled. The side can only be changed outside a mission; it lasts for this launch and is never saved, so every launch starts with the frigate.
|
||||
|
||||
The **submarine command** station is laid out like the Bridge: the chart on the left (known geography, the boat with its ordered course and motion vector, the bearing lines of its own sonar contacts or their symbol while a ping or TMA fix is current, its own torpedoes `T1`…, a limited tube firing arc), the station on the right with a threat bar (torpedo alarm and active sonar heard with measured bearing, hull damage, cavitation, low battery, ESM radar intercept) and two pages. **Navigation** shows course and depth, water under the keel and any charted obstacle ahead, speed, own noise, battery and the active modes, and the water column under the boat: boat depth, ordered depth, safe depth and seabed; the layer appears there only after the boat's own BT measurement (`E` at the submarine sonar). **Weapons & contacts** shows fire readiness, torpedoes, tubes ready, reload, decoys, emergency blow and the boat's own sonar contacts. Below are the boat log and the boat's telemetry, as a band or a status ticker as set in the options; orders, shots and decoys are logged there.
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ Die Statuszeile unten zeigt das neueste Ereignis und die wichtigste Telemetrie;
|
||||
|
||||
- Menü: `1`-`4` Szenario (4 = Zufall mit eigener Schwierigkeit), `W` Weltmodus, `R` neuer Seed, `F` Vollbild, `Enter` Start.
|
||||
- `S` / `L`: Speichern / Laden (Plätze 1-5). Spielstände sind exakt und deterministisch: ein geladenes Spiel läuft identisch weiter.
|
||||
- `F10`: Optionen - Sprache, Vollbild, Audio, große Schrift, Tooltips, Bildrate (30 oder 60 FPS; 30 spart Rechenleistung auf der uConsole und ist voreingestellt), Ereignislog/Telemetrie als Statuszeile (Standard, mehr Platz für die Station) oder feste Leiste, Bedienerassistenz aus (Standard: Rohdaten und manuelle Analyse) oder Training (automatische Linienbeschriftung, Blattfrequenz- und Katalog-/Senderkandidaten). Seite 2 (`Bild ab`/`Tab`): welche Seite der uConsole spielt, Fregatte (Standard) oder feindliches U-Boot; nur im Hauptmenü, nie gespeichert.
|
||||
- `F10`: Optionen - Sprache, Vollbild, Audio, große Schrift, Tooltips, Bildrate (30 oder 60 FPS; 30 spart Rechenleistung auf der uConsole und ist voreingestellt), Ereignislog/Telemetrie als Statuszeile (Standard, mehr Platz für die Station) oder feste Leiste, Bedienerassistenz aus (Standard: Rohdaten und manuelle Analyse) oder Training (automatische Linienbeschriftung, Blattfrequenz- und Katalog-/Senderkandidaten). Seite 2 (`Bild ab`/`Tab`): welche Seite der uConsole spielt, Fregatte (Standard) oder feindliches U-Boot; nur im Hauptmenü, nie gespeichert. Ein neues Spiel fragt ohnehin zuerst danach.
|
||||
- `F9`: Commander / Remote Crew - Browser im LAN können Stationen übernehmen. Eine freie Station wird sofort mit allen ihren Rechten übernommen (auch Direktfeuer und Sonar-Liveaudio, wo die Station sie hat); eine Station, die ein Crewmitglied hält, wird angefragt, und der Host kann sie übergeben. Der Host kann jederzeit eine Station oder einzelne Rechte entziehen.
|
||||
|
||||
## 1 Brücke
|
||||
@@ -1025,7 +1025,7 @@ U-Boot-Physik: der Rumpf beschleunigt auf die befohlene Fahrt (kein Sofortsprint
|
||||
|
||||
### Besetztes Gegner-U-Boot (Remote Crew)
|
||||
|
||||
Eine zweite Crew kann den Gegner spielen. Das Boot hat sechs Stationen: Führung, Sonar, Waffen, Maschine, Mast & ESM und Navigation; ein Browser übernimmt sie wie die der Fregatte (`F9`). Solange eine davon besetzt ist, folgt das lebende feindliche U-Boot mit der kleinsten Nummer nur den Befehlen dieser Crew; werden die Rollen abgegeben, vom Host entzogen oder ein Spielstand geladen, übernimmt die KI das Boot wieder dort, wo es gerade ist. Ein Browser hält nur Rollen einer Seite (Fregatte oder U-Boot), nie beide, und der Solo-Modus enthält die U-Boot-Rollen nie.
|
||||
Eine zweite Crew kann den Gegner spielen. Das Boot hat sechs Stationen: Führung, Sonar, Waffen, Maschine, Mast & ESM und Navigation; ein Browser übernimmt sie wie die der Fregatte (`F9`). Solange eine davon besetzt ist, folgt das lebende feindliche U-Boot mit der kleinsten Nummer nur den Befehlen dieser Crew; werden die Rollen abgegeben, vom Host entzogen oder ein Spielstand geladen, übernimmt die KI das Boot wieder dort, wo es gerade ist. Ein Browser hält nur Rollen einer Seite (Fregatte oder U-Boot), nie beide; die Lobby fragt zuerst, welche Einheit er spielt. Im Solo-Modus hält der eine Browser alle neun Stationen der Fregatte oder mit **U-Boot spielen** in der Host-Leiste alle sechs Stationen des Boots (zurück mit **Fregatte spielen**).
|
||||
|
||||
- **Stationen:** Die *Führung* befiehlt Kurs, Fahrt und Tiefe, legt das Boot auf Grund, pingt, nimmt eine BT-Messung und sieht das ganze Boot. Die *Navigation* befiehlt Kurs und Tiefe, führt den Plot des Boots und überwacht Kiel und Hindernisse. Die *Maschine* bedient Telegraf, Schnorchel, Schleichfahrt und Notanblasen und überwacht Batterie und Lärm. *Mast & ESM* fährt den Mast aus und überwacht ESM und Alarme. Die *Waffen* schießen, lenken die Drähte und stoßen Täuschkörper aus. Das *Sonar* ist der Sonarraum des Boots. Jeder Befehl wird nur von der Station angenommen, zu der er gehört.
|
||||
- **Befehle und Waffen:** das Boot folgt Kurs-, Fahrt- und Tiefenbefehlen im Rahmen seiner Wende-, Tiefen- und Beschleunigungsgrenzen; Fahrtstufen (Stopp, 3, 6, 10, 15 kn, Maximum) setzen die Fahrt schnell. Schießt einen Torpedo auf die gemessene Peilung eines Sonarkontakts, mit Ping-Fix oder TMA-Lösung, solange aktuell, oder auf eine freie Peilung mit optionaler Entfernung; der Schuss braucht ein klares Rohr und das Ziel im Schussfeld der Rohre. Die Crew stellt die Lauftiefe ein (5-300 m, sonst eine flache Voreinstellung) und schießt einen Torpedo oder zwei im Fächer von ±4°, jeder mit eigenem Datum. Jeder Crew-Torpedo läuft am Draht: die Crew kann sein Datum versetzen (Peilung und Entfernung vom Boot), und der Draht dreht ihn darauf ein, bis sein Suchkopf erfasst; schneller als 10 kn oder stärker als 1,5°/s drehen für 5 s lässt den Draht reißen, ebenso eine abgelaufene Spule, und die Crew kann ihn kappen. Stößt einen Täuschkörper aus und bläst einmal notfallmäßig an.
|
||||
@@ -1039,7 +1039,7 @@ Eine zweite Crew kann den Gegner spielen. Das Boot hat sechs Stationen: Führung
|
||||
|
||||
#### U-Boot am uConsole spielen
|
||||
|
||||
Im Hauptmenü unter Optionen (`F10`) auf Seite 2 (`Bild ab` oder `Tab`) **uConsole spielt** auf *Feindliches U-Boot* stellen (oder mit `--play-sub` starten): Dann führt der uConsole das feindliche U-Boot statt der Fregatte. Die Fregatte wird dann über Remote Crew (`F9`) aus den Browsern besetzt oder fährt mit Autocrew. Der uConsole zeigt nur das Lagebild des Boots; Banner, Ereignislog, Soundeffekte, Plot und Tooltips der Fregatte erscheinen nie, und Trackball- und Telegraphenbedienung der Fregatte sind gesperrt. Die Seite lässt sich nur außerhalb einer Mission wechseln; die Wahl gilt nur für diesen Programmstart und wird nie gespeichert, jeder Start beginnt also mit der Fregatte.
|
||||
Jedes neue Spiel fragt zuerst **Welche Einheit spielst du?**: *Fregatte F-217* oder *Feindliches U-Boot* (`Auf`/`Ab` oder `1`/`2`, `Enter`; die letzte Wahl ist vorausgewählt, `--play-sub` wählt das U-Boot vor). Außerhalb einer Mission ändert auch Optionen (`F10`) Seite 2 **uConsole spielt** die Wahl, etwa vor dem Laden eines Spielstands. Mit dem U-Boot führt der uConsole das feindliche Boot statt der Fregatte. Die Fregatte wird dann über Remote Crew (`F9`) aus den Browsern besetzt oder fährt mit Autocrew. Der uConsole zeigt nur das Lagebild des Boots; Banner, Ereignislog, Soundeffekte, Plot und Tooltips der Fregatte erscheinen nie, und Trackball- und Telegraphenbedienung der Fregatte sind gesperrt. Die Seite lässt sich nur außerhalb einer Mission wechseln; die Wahl gilt nur für diesen Programmstart und wird nie gespeichert, jeder Start beginnt also mit der Fregatte.
|
||||
|
||||
Die **U-Boot-Führung** ist aufgebaut wie die Brücke: links die Seekarte (bekannte Geografie, das eigene Boot mit Sollkurs und Fahrtvektor, die Peilstriche der eigenen Sonarkontakte bzw. ihr Symbol bei aktuellem Ping- oder TMA-Fix, die eigenen Torpedos `T1`…, ein begrenztes Schussfeld der Rohre), rechts die Station mit Bedrohungsleiste (Torpedoalarm und gehörtes Aktivsonar mit gemessener Peilung, Rumpfschaden, Kavitation, schwache Batterie, ESM-Radarerfassung) und zwei Seiten. **Navigation** zeigt Kurs und Tiefe, das Wasser unter dem Kiel und ein kartiertes Hindernis voraus, Fahrt, Eigenlärm, Batterie und die aktiven Betriebsarten sowie die Wassersäule unter dem Boot: Bootstiefe, befohlene Tiefe, sichere Tiefe und Grund; die Sprungschicht erscheint dort erst nach einer eigenen BT-Messung (`E` am U-Boot-Sonar). **Waffen & Kontakte** zeigt Feuerbereitschaft, Torpedos, klare Rohre, Nachladen, Täuschkörper, Notanblasen und die eigenen Sonarkontakte. Unten stehen Bootslog und Telemetrie des Boots, als Leiste oder Statuszeile wie in den Optionen eingestellt; Befehle, Schüsse und Täuschkörper werden dort protokolliert.
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ The bottom status ticker shows the newest event and key telemetry; `F11` opens t
|
||||
|
||||
- Menu: `1`-`4` scenario (4 = random with custom difficulty), `W` world mode, `R` new seed, `F` fullscreen, `Enter` start.
|
||||
- `S` / `L`: save / load (slots 1-5). Saves are exact and deterministic: a loaded game continues identically.
|
||||
- `F10`: options - language, fullscreen, audio, large text, tooltips, frame rate (30 or 60 FPS; 30 saves CPU on the uConsole and is the default), event log / telemetry as status ticker (default, more room for the station) or docked band, operator assistance off (default: raw data and manual analysis) or training (automatic line labels, blade-rate and catalogue/emitter candidates). Page 2 (`PgDn`/`Tab`): which side the uConsole plays, frigate (default) or hostile submarine; only in the main menu, never saved.
|
||||
- `F10`: options - language, fullscreen, audio, large text, tooltips, frame rate (30 or 60 FPS; 30 saves CPU on the uConsole and is the default), event log / telemetry as status ticker (default, more room for the station) or docked band, operator assistance off (default: raw data and manual analysis) or training (automatic line labels, blade-rate and catalogue/emitter candidates). Page 2 (`PgDn`/`Tab`): which side the uConsole plays, frigate (default) or hostile submarine; only in the main menu, never saved. A new game asks for it first anyway.
|
||||
- `F9`: Commander / Remote Crew - lets browser clients on the LAN take stations. A free station is taken at once with all of its rights (including direct fire and live sonar audio where the station has them); a station a crewmate holds is requested, and the host can hand it over. The host can revoke a station or single rights at any time.
|
||||
|
||||
## 1 Bridge
|
||||
@@ -1024,7 +1024,7 @@ Submarine physics: the hull accelerates toward an ordered speed (no instant spri
|
||||
|
||||
### Crewed opposing submarine (Remote Crew)
|
||||
|
||||
A second crew can play the enemy. The boat has six stations: Command, Sonar, Weapons, Engine room, Mast & ESM and Navigation; a browser takes them like the frigate's (`F9`). As long as one of them is held, the living hostile submarine with the lowest number follows only that crew's orders; when the roles are released, the host revokes them or a game is loaded, the AI takes the boat back from where it is. A browser holds roles of one side only (frigate or submarine), never both, and solo mode never includes the submarine roles.
|
||||
A second crew can play the enemy. The boat has six stations: Command, Sonar, Weapons, Engine room, Mast & ESM and Navigation; a browser takes them like the frigate's (`F9`). As long as one of them is held, the living hostile submarine with the lowest number follows only that crew's orders; when the roles are released, the host revokes them or a game is loaded, the AI takes the boat back from where it is. A browser holds roles of one side only (frigate or submarine), never both; the lobby first asks which unit it plays. In solo mode the one browser holds all nine frigate stations, or with **Play the submarine** in the host bar all six boat stations (and back with **Play the frigate**).
|
||||
|
||||
- **Stations:** *Command* orders course, speed and depth, lies on the bottom, pings and takes a BT, and sees the whole boat. *Navigation* orders course and depth, keeps the boat's plot and watches keel and obstacles. *Engine room* runs the telegraph, snorkel, silent running and the emergency blow and watches battery and noise. *Mast & ESM* raises the mast and watches ESM and alarms. *Weapons* fires, guides the wires and launches decoys. *Sonar* is the boat's sonar room. Each order is accepted only from the station that owns it.
|
||||
- **Orders and weapons:** the boat follows course, speed and depth orders within its turn, depth and acceleration limits; telegraph steps (stop, 3, 6, 10, 15 kn, maximum) set the speed quickly. Fires a torpedo down a sonar contact's measured bearing, with its ping fix or TMA solution while current, or down a free bearing with an optional range; firing needs a ready tube and the target inside the tube arc. The crew sets the run depth (5-300 m, otherwise a shallow default) and fires one torpedo or two in a ±4° spread, each with its own datum. Every crew torpedo runs on a wire: the crew can move its datum (bearing and distance from the boat) and the wire turns it onto the new datum until its seeker acquires; faster than 10 kn or turning harder than 1.5°/s for 5 s breaks the wire, as does running out of either spool, and the crew can cut it. Launches a decoy and makes the one emergency blow.
|
||||
@@ -1038,7 +1038,7 @@ A second crew can play the enemy. The boat has six stations: Command, Sonar, Wea
|
||||
|
||||
#### Playing the submarine on the uConsole
|
||||
|
||||
In the main menu, open Options (`F10`), switch to page 2 (`PgDn` or `Tab`) and set **uConsole plays** to *Hostile submarine* (or start with `--play-sub`): the uConsole then commands the hostile submarine instead of the frigate. The frigate is then crewed from the browsers through Remote Crew (`F9`) or runs on autocrew. The uConsole shows only the boat's own picture; the frigate's banners, event log, sound cues, plot and tooltips never appear, and its trackball and telegraph controls are disabled. The side can only be changed outside a mission; it lasts for this launch and is never saved, so every launch starts with the frigate.
|
||||
Every new game first asks **Which unit do you play?**: *Frigate F-217* or *Hostile submarine* (`Up`/`Down` or `1`/`2`, `Enter`; the last choice is preselected, `--play-sub` preselects the submarine). Outside a mission, Options (`F10`) page 2 **uConsole plays** changes it as well, for example before loading a game. With the submarine the uConsole commands the hostile boat instead of the frigate. The frigate is then crewed from the browsers through Remote Crew (`F9`) or runs on autocrew. The uConsole shows only the boat's own picture; the frigate's banners, event log, sound cues, plot and tooltips never appear, and its trackball and telegraph controls are disabled. The side can only be changed outside a mission; it lasts for this launch and is never saved, so every launch starts with the frigate.
|
||||
|
||||
The **submarine command** station is laid out like the Bridge: the chart on the left (known geography, the boat with its ordered course and motion vector, the bearing lines of its own sonar contacts or their symbol while a ping or TMA fix is current, its own torpedoes `T1`…, a limited tube firing arc), the station on the right with a threat bar (torpedo alarm and active sonar heard with measured bearing, hull damage, cavitation, low battery, ESM radar intercept) and two pages. **Navigation** shows course and depth, water under the keel and any charted obstacle ahead, speed, own noise, battery and the active modes, and the water column under the boat: boat depth, ordered depth, safe depth and seabed; the layer appears there only after the boat's own BT measurement (`E` at the submarine sonar). **Weapons & contacts** shows fire readiness, torpedoes, tubes ready, reload, decoys, emergency blow and the boat's own sonar contacts. Below are the boat log and the boat's telemetry, as a band or a status ticker as set in the options; orders, shots and decoys are logged there.
|
||||
|
||||
|
||||
+18
-4
@@ -1484,8 +1484,11 @@ class CommanderServer:
|
||||
return CommanderServer._station_grants(station)
|
||||
|
||||
def _solo_grant_all_locked(self, session, active=None):
|
||||
"""Lease every station to the single solo session with full grants."""
|
||||
for station in STATIONS:
|
||||
"""Lease every station of one side to the single solo session with full
|
||||
grants: the frigate's nine, or the boat's six when ``active`` is a boat
|
||||
station (the solo player chose to play the submarine)."""
|
||||
stations = OPFOR_ROLES if role_side(active) == "opfor" else STATIONS
|
||||
for station in stations:
|
||||
self._station_generations[station] += 1
|
||||
session["leases"][station] = {
|
||||
"generation": self._station_generations[station],
|
||||
@@ -1497,7 +1500,13 @@ class CommanderServer:
|
||||
session["host_generation"] += 1
|
||||
session["active_station"] = None
|
||||
self._set_active_station_locked(
|
||||
session, active if active in session["leases"] else STATIONS[0])
|
||||
session, active if active in session["leases"] else stations[0])
|
||||
|
||||
def _solo_switch_side_locked(self, session, station):
|
||||
"""The solo player picks the other unit: all stations change side."""
|
||||
for held in tuple(session["leases"]):
|
||||
self._release_station_locked(session, held, "role_revoked")
|
||||
self._solo_grant_all_locked(session, station)
|
||||
|
||||
def solo_rebase(self):
|
||||
"""Keep the solo session across a world replacement, as a fresh authority.
|
||||
@@ -3280,7 +3289,12 @@ class _Handler(BaseHTTPRequestHandler):
|
||||
status, response = 400, {"error": "invalid_request"}
|
||||
else:
|
||||
station = body["station"]
|
||||
if (not owner._auto_grant_locked(session, station)
|
||||
if session["solo_host"] and owner._solo and owner._side_conflict(
|
||||
session, station):
|
||||
# Solo: choosing a station of the other unit moves
|
||||
# the whole session to that unit.
|
||||
owner._solo_switch_side_locked(session, station)
|
||||
elif (not owner._auto_grant_locked(session, station)
|
||||
and station not in session["leases"]
|
||||
and station not in session["requests"]
|
||||
and not owner._side_conflict(session, station)):
|
||||
|
||||
+27
-2
@@ -11402,9 +11402,10 @@ class Game:
|
||||
elif key in (pygame.K_RETURN, pygame.K_SPACE):
|
||||
action = entries[self.main_menu_sel]
|
||||
if action == "new":
|
||||
# A new game first asks which unit the uConsole plays.
|
||||
self.main_menu = False
|
||||
self.menu_screen = "scenario"
|
||||
self.menu_sel = 0
|
||||
self.menu_screen = "side"
|
||||
self.menu_sel = 1 if self.local_side == "uboot" else 0
|
||||
elif action == "load":
|
||||
self._open_administration("load")
|
||||
elif action == "mission_editor":
|
||||
@@ -11421,6 +11422,19 @@ class Game:
|
||||
elif key in (pygame.K_ESCAPE, pygame.K_q):
|
||||
self._open_administration("quit")
|
||||
return
|
||||
if self.menu_screen == "side":
|
||||
if key in (pygame.K_UP, pygame.K_DOWN, pygame.K_LEFT, pygame.K_RIGHT, pygame.K_TAB):
|
||||
self.menu_sel = 1 - self.menu_sel
|
||||
elif key in (pygame.K_1, pygame.K_2):
|
||||
self.menu_sel = 0 if key == pygame.K_1 else 1
|
||||
elif key in (pygame.K_RETURN, pygame.K_SPACE):
|
||||
self.local_side = ("frigate", "uboot")[self.menu_sel]
|
||||
self.menu_screen = "scenario"
|
||||
self.menu_sel = 0
|
||||
elif key in (pygame.K_ESCAPE, pygame.K_q):
|
||||
self.main_menu = True
|
||||
self.main_menu_sel = 0
|
||||
return
|
||||
if self.menu_screen == "scenario":
|
||||
n = len(config.SCENARIO_ORDER)
|
||||
if key == pygame.K_UP:
|
||||
@@ -11497,6 +11511,17 @@ class Game:
|
||||
color = config.COLOR_TEXT if i == self.main_menu_sel else config.COLOR_TEXT_DIM
|
||||
center(message("menu.choice", marker=marker,
|
||||
label=self.tr(key).upper()), 185 + i * 47, color=color)
|
||||
elif self.menu_screen == "side":
|
||||
center(self.tr("menu.choose_side"), 170, color=config.COLOR_TEXT_DIM)
|
||||
for i, side in enumerate(("frigate", "uboot")):
|
||||
selected = i == self.menu_sel
|
||||
center(message("menu.choice", marker="► " if selected else " ",
|
||||
label=self.tr(f"menu.side.{side}")),
|
||||
250 + i * 90, self.menu_font_big if selected else None,
|
||||
config.COLOR_TEXT if selected else config.COLOR_TEXT_DIM)
|
||||
layout.blit_line(s, f"menu.side.{side}.note", (cx - 420, 285 + i * 90, 840, 26),
|
||||
config.COLOR_TEXT_DIM, size=18, align="center")
|
||||
center(self.tr("menu.side_hint"), 470, color=config.COLOR_TEXT_DIM)
|
||||
elif self.menu_screen == "scenario":
|
||||
center(self.tr("menu.choose_scenario"),
|
||||
150, color=config.COLOR_TEXT_DIM)
|
||||
|
||||
@@ -33,7 +33,9 @@ async function run() {
|
||||
const cards = [...$("station-cards").children];
|
||||
const root = document.documentElement;
|
||||
const lobby = $("lobby").getBoundingClientRect();
|
||||
const lobbyControls = cards.every((card) => {
|
||||
// One unit at a time: the frigate's cards, then the side choice.
|
||||
const sideControls = [...$("side-choice").querySelectorAll("button")];
|
||||
const lobbyControls = sideControls.length === 2 && [...cards.filter((card) => !card.hidden), ...sideControls.map((button) => ({querySelector: () => button}))].every((card) => {
|
||||
const button = card.querySelector("button");
|
||||
const bounds = button.getBoundingClientRect();
|
||||
return button.type === "button" && bounds.width >= 44 && bounds.height >= 40;
|
||||
|
||||
@@ -94,7 +94,8 @@ def test_solo_pairing_leases_every_station_with_full_grants(server):
|
||||
assert session["active_station"] == session["station"] == "bridge"
|
||||
assert session["simlog"] is True and session["grants"]["simlog"] is True
|
||||
assert list(session["stations"]) == list(ROLES)
|
||||
# Solo is the frigate console: the submarine roles are never part of it.
|
||||
# Solo starts on the frigate; the boat's stations are not held until the
|
||||
# player chooses the submarine.
|
||||
assert all(session["stations"][role]["status"] == "available" for role in OPFOR_ROLES)
|
||||
for station in STATIONS:
|
||||
row = session["stations"][station]
|
||||
@@ -577,3 +578,23 @@ def test_a_replayed_host_command_id_is_applied_once(solo):
|
||||
solo.bridge.pump(solo.game, solo.server, now=time.monotonic())
|
||||
assert solo.game.world.sea_state == 2
|
||||
assert send(solo, dict(body, action="host_save", params={"slot": 1}))[0] == 409
|
||||
|
||||
|
||||
def test_solo_player_switches_the_whole_session_to_the_other_unit(server):
|
||||
cookie, session = solo_pair(server)
|
||||
status, _, boat = request(server, "/api/v2/stations/request", "POST",
|
||||
{"station": "uboot"}, cookie, session["csrf"])
|
||||
assert status == 200 and boat["station"] == "uboot" and boat["host"] is not None
|
||||
assert all(boat["stations"][role]["status"] == "mine" for role in OPFOR_ROLES)
|
||||
assert all(boat["stations"][role]["status"] == "available" for role in STATIONS)
|
||||
assert boat["stations"]["uboot_weapons"]["grants"]["direct_fire"] is True
|
||||
assert boat["stations"]["uboot_sonar"]["grants"]["sonar_audio"] is True
|
||||
# A rebase (new world) keeps the chosen unit.
|
||||
server.solo_rebase()
|
||||
again = request(server, "/api/v2/session", cookie=cookie)[2]
|
||||
assert all(again["stations"][role]["status"] == "mine" for role in OPFOR_ROLES)
|
||||
status, _, frigate = request(server, "/api/v2/stations/request", "POST",
|
||||
{"station": "bridge"}, cookie, again["csrf"])
|
||||
assert status == 200 and frigate["station"] == "bridge"
|
||||
assert all(frigate["stations"][role]["status"] == "mine" for role in STATIONS)
|
||||
assert all(frigate["stations"][role]["status"] == "available" for role in OPFOR_ROLES)
|
||||
@@ -66,7 +66,8 @@ def test_normal_menu_start_keeps_world_pairing_grant_and_session(game, paired_me
|
||||
world, sonar = game.world, game.sonar
|
||||
assigned = request(server, "/api/v2/session", cookie=cookie)[2]
|
||||
station_generation = assigned["station_generation"]
|
||||
key(game, confirm) # Main menu -> scenarios.
|
||||
key(game, confirm) # Main menu -> which unit.
|
||||
key(game, confirm) # Frigate -> scenarios.
|
||||
key(game, confirm) # Default patrol -> briefing.
|
||||
assert game.menu_screen == "briefing" and game.in_menu
|
||||
game.commander.pump(game)
|
||||
@@ -104,7 +105,8 @@ def test_real_replacements_still_revoke_on_next_pump(game, paired_menu, change):
|
||||
elif change == "load":
|
||||
game.load_state(game.save_state()) # Includes a sim_t == 0 save.
|
||||
else:
|
||||
key(game, pygame.K_RETURN)
|
||||
key(game, pygame.K_RETURN) # New game -> which unit.
|
||||
key(game, pygame.K_RETURN) # Frigate -> scenarios.
|
||||
if change == "seed":
|
||||
key(game, pygame.K_r)
|
||||
elif change == "world_mode":
|
||||
@@ -151,7 +153,7 @@ def test_late_failed_load_preserves_preparation_and_pairing(game, paired_menu, m
|
||||
"station_generation"] == assigned["station_generation"]
|
||||
game.commander.pump(game)
|
||||
assert bridge.status == before
|
||||
for _ in range(3):
|
||||
for _ in range(4): # New game, frigate, patrol, start.
|
||||
key(game, pygame.K_RETURN)
|
||||
game.commander.pump(game)
|
||||
assert game.world is world and game.sonar is sonar
|
||||
|
||||
@@ -406,7 +406,9 @@ def test_quit_dialog_returns_to_main_menu_without_saving(game):
|
||||
sim_t = game.sim_t
|
||||
game.update(1.0)
|
||||
assert game.sim_t == sim_t
|
||||
# "New game" -> scenario list -> briefing starts a fresh mission.
|
||||
# "New game" -> unit (frigate) -> scenario list -> briefing starts a fresh mission.
|
||||
press(game, pygame.K_RETURN)
|
||||
assert game.menu_screen == "side"
|
||||
press(game, pygame.K_RETURN)
|
||||
press(game, pygame.K_2)
|
||||
press(game, pygame.K_RETURN)
|
||||
|
||||
+19
-1
@@ -197,7 +197,7 @@ def test_submarine_sonar_commands_never_touch_the_frigate_sonar():
|
||||
"uboot") is False
|
||||
|
||||
|
||||
def test_solo_never_holds_and_one_session_never_mixes_sides():
|
||||
def test_solo_starts_on_the_frigate_and_one_session_never_mixes_sides():
|
||||
server = CommanderServer()
|
||||
with server._lock:
|
||||
_token, crew = server._new_session_locked("crew", web_host=False)
|
||||
@@ -838,3 +838,21 @@ def test_each_boat_station_owns_its_own_orders():
|
||||
assert bridge._apply_opfor_action(game, "uboot_mast", {"enabled": False}, "uboot_weapons") is False
|
||||
assert bridge._apply_opfor_action(game, "uboot_set_course", {"course": 45.0}, "uboot_nav") is True
|
||||
assert sub.order_course == 45.0
|
||||
|
||||
|
||||
def test_new_game_asks_which_unit_the_uconsole_plays():
|
||||
game = Game(seed=83, start_menu=True, audio_enabled=False, language="de")
|
||||
assert game.main_menu
|
||||
game._handle_menu_key(pygame.K_RETURN)
|
||||
assert game.menu_screen == "side" and game.menu_sel == 0
|
||||
game.draw()
|
||||
game._handle_menu_key(pygame.K_2)
|
||||
game._handle_menu_key(pygame.K_RETURN)
|
||||
assert game.local_side == "uboot" and game.menu_screen == "scenario"
|
||||
game._handle_menu_key(pygame.K_ESCAPE)
|
||||
game._handle_menu_key(pygame.K_RETURN)
|
||||
assert game.menu_screen == "side" and game.menu_sel == 1 # Last choice preselected.
|
||||
game._handle_menu_key(pygame.K_UP)
|
||||
game._handle_menu_key(pygame.K_RETURN)
|
||||
assert game.local_side == "frigate"
|
||||
game.audio.shutdown()
|
||||
+4
-2
@@ -171,8 +171,10 @@ def _run_smoke() -> None:
|
||||
# --- W4: Menue (Hauptmenue -> Szenario -> Custom-Difficulty -> Briefing) ---
|
||||
g2 = Game(seed=42, start_menu=True)
|
||||
assert g2.in_menu and g2.main_menu
|
||||
g2._handle_menu_key(pygame.K_RETURN) # New Game -> scenario
|
||||
assert not g2.main_menu and g2.menu_screen == "scenario"
|
||||
g2._handle_menu_key(pygame.K_RETURN) # New Game -> which unit
|
||||
assert not g2.main_menu and g2.menu_screen == "side"
|
||||
g2._handle_menu_key(pygame.K_RETURN) # Frigate -> scenario
|
||||
assert g2.local_side == "frigate" and g2.menu_screen == "scenario"
|
||||
g2._handle_menu_key(pygame.K_4) # s4_zufall
|
||||
g2._handle_menu_key(pygame.K_RETURN) # -> Custom-Difficulty
|
||||
assert g2.menu_screen == "difficulty"
|
||||
|
||||
Reference in new issue
Block a user