mirror of
https://github.com/db9979/uconsole_asw_game.git
synced 2026-12-06 04:44:18 +01:00
Important feed events (torpedo in the water, new contact, breaking-up noises, torpedo away, hit, action stations, patrol aircraft on station, mission result) become transient callouts with bearings spoken digit by digit. The uConsole speaks through an installed espeak-ng behind a new option (off by default, silent without espeak); browsers get the callouts in the common audio block and speak them with SpeechSynthesis in their own language behind a per-viewer switch. Frigate roles only. Also moves the main-menu test indices past the new Training and Campaign entries. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019eZphdvoJiBgWqq2zSH4aJ
122 lines
3.4 KiB
JavaScript
122 lines
3.4 KiB
JavaScript
import { defaultSonarPage } from "./shared.js";
|
|
|
|
// Mutable client state shared by several modules. Transient: never sent to
|
|
// the host, stored or placed in the DOM.
|
|
export const S = {
|
|
language: (navigator.language || "en").toLowerCase().startsWith("de") ? "de" : "en",
|
|
catalog: {},
|
|
// Session metadata stays closure-local: no URL, DOM or persistence.
|
|
session: null,
|
|
pairingAvailable: false,
|
|
generation: 0,
|
|
snapshot: null,
|
|
chart: null,
|
|
chartSession: null,
|
|
chartEpoch: null,
|
|
chartRole: null,
|
|
selected: null,
|
|
connected: false,
|
|
linkState: "unpaired",
|
|
lastSuccess: 0,
|
|
lastSessionFetch: 0,
|
|
failures: 0,
|
|
pollTimer: null,
|
|
polling: false,
|
|
pending: null,
|
|
v2State: null,
|
|
roleStale: false,
|
|
// Solo host surface: the published host view and the one host command in flight.
|
|
hostView: null,
|
|
hostPending: null,
|
|
hostMessage: null,
|
|
hostMessageTimer: null,
|
|
stationRenderSignature: null,
|
|
nextCommandSeq: 0,
|
|
stationMutation: false,
|
|
activatingStation: null,
|
|
queuedSonarFocus: null,
|
|
// Focus this client last sent, until the state shows it or it is rejected.
|
|
requestedSonarFocus: 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(),
|
|
opzSuppressed: new Set(),
|
|
opzManage: false,
|
|
stationDrafts: new Set(),
|
|
// Emitter the mast station has selected in the boat's ESM list (by number).
|
|
ubootEsmSelected: null,
|
|
requestQueue: Promise.resolve(),
|
|
activeRequest: null,
|
|
languageRequest: 0,
|
|
audio: null,
|
|
soundEnabled: false,
|
|
speechEnabled: false,
|
|
speechQueued: 0,
|
|
calloutContext: null,
|
|
calloutHighWater: 0,
|
|
sonarAudioEnabled: false,
|
|
sonarAudioController: null,
|
|
sonarAudioTimer: null,
|
|
sonarAudioSequence: null,
|
|
sonarAudioNextTime: 0,
|
|
helicopterAudioSource: null,
|
|
sonarAudioSources: [],
|
|
sonarAudioGain: null,
|
|
sonarAudioHighpass: null,
|
|
sonarAudioLowpass: null,
|
|
sonarAudioWorklet: null,
|
|
sonarAudioSocket: null,
|
|
sonarAudioReconnect: null,
|
|
sonarAudioMetrics: {buffered: 0, gaps: 0, concealed: 0, rate: 1, stale: false},
|
|
gameSoundContext: null,
|
|
gameSoundHighWater: 0,
|
|
chartHits: [],
|
|
drag: null,
|
|
activeTab: "operations",
|
|
contactAnalysis: null,
|
|
analysisSelected: null,
|
|
analysisImageKey: null,
|
|
lastSimlogFetch: 0,
|
|
proposals: null,
|
|
eventContext: null,
|
|
eventBaselinePending: false,
|
|
eventHighWater: 0,
|
|
eventHistory: [],
|
|
analysisError: false,
|
|
latestSimlogState: null,
|
|
simlogMapData: null,
|
|
simlogMapSeq: null,
|
|
simlogMapLatest: false,
|
|
simlogMapFit: "world",
|
|
roleMapHits: [],
|
|
// Hover information for the maps (tracks, own ship, assets, chart items);
|
|
// separate from the click hit lists so selection semantics are unchanged.
|
|
roleMapInfo: [],
|
|
chartInfo: [],
|
|
damageHits: [],
|
|
sonarVisualPage: defaultSonarPage(),
|
|
helicopterVisualPage: "acoustic",
|
|
helicopterPlot: "lofar",
|
|
weatherFrame: null,
|
|
weatherTimer: null,
|
|
weatherLastDraw: 0,
|
|
roleMapDrag: null,
|
|
plotAnchor: null,
|
|
plotListKey: "",
|
|
sonarBroadbandDrag: null,
|
|
opzSweepFrame: null,
|
|
opzSweepSample: null,
|
|
fireConfirmation: null,
|
|
fireConfirmationTimer: null,
|
|
sonarAudioGeneration: 0,
|
|
// World session/epoch the live audio last saw; a change resumes the stream.
|
|
sonarAudioWorld: null,
|
|
// Pointer position over the weather profile (CSS px), or null.
|
|
weatherCursor: null,
|
|
webHostAvailable: false,
|
|
};
|