mirror of
https://github.com/db9979/uconsole_asw_game.git
synced 2026-12-05 12:24:25 +01:00
Boat side: key 0 opens the weather panel on the uConsole
The weather panel was frigate-only on the uConsole: aboard the crewed boat key 0 did nothing. It now opens over the whole station area from the boat's own instruments and BT, with the boat block (mast on radar, sighting range, ambient noise, snorkel) instead of the helicopter flight weather. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BdXs5tkJ6kzdeubNWqPHtG
This commit is contained in:
11 files changed
+145
-16
No files matched your search
+12
-1
@@ -4424,5 +4424,16 @@
|
||||
"bridge.footer.glasses_train": "SCHWENKEN",
|
||||
"help.bridge.lookout_glasses": "Ausguck-Seite: Fernglas über der Karte ein/aus (, / . schwenken)",
|
||||
"bridge.line.glasses_row": "{bearing}° {what} {range} sm",
|
||||
"bridge.line.glasses_unknown": "nicht erkannt"
|
||||
"bridge.line.glasses_unknown": "nicht erkannt",
|
||||
"weather.line.temperature_boat": "Luft {air} °C Wasser {sea} °C",
|
||||
"weather.box.boat": "Boot · Tarnung und Geräusch",
|
||||
"weather.boat.mast_radar": "Mast im Radar: erfasst auf {range} sm (ruhige See {calm} sm)",
|
||||
"weather.boat.sighting": "Aufgetaucht mit dem Auge: gesichtet auf {range} sm (Tag, klar, ruhig {reference} sm)",
|
||||
"weather.boat.sighting_none": "Aufgetaucht mit dem Auge: bei diesem Licht und Seegang nicht gesichtet (Tag, klar, ruhig {reference} sm)",
|
||||
"weather.boat.ambient": "Umgebungsrauschen ggü. ruhig: {bands}",
|
||||
"weather.boat.band": "{band} Hz {excess} dB",
|
||||
"weather.boat.snorkel": "Schnorchel: max. {speed} kn · +{noise} dB · Diesellinien {lines} Hz hörbar",
|
||||
"weather.boat.snorkel_active": "SCHNORCHELT: max. {speed} kn · +{noise} dB · Diesellinien {lines} Hz hörbar",
|
||||
"weather.boat.snorkel_none": "Schnorchel: keiner (keine Dieselanlage)",
|
||||
"help.uboot.weather": "Wetterseite des Boots (0 oder Esc schließt)"
|
||||
}
|
||||
+12
-1
@@ -4424,5 +4424,16 @@
|
||||
"bridge.footer.glasses_train": "TRAIN",
|
||||
"help.bridge.lookout_glasses": "Lookout page: binoculars over the chart on/off (, / . train them)",
|
||||
"bridge.line.glasses_row": "{bearing}° {what} {range} NM",
|
||||
"bridge.line.glasses_unknown": "unidentified"
|
||||
"bridge.line.glasses_unknown": "unidentified",
|
||||
"weather.line.temperature_boat": "Air {air} °C Sea {sea} °C",
|
||||
"weather.box.boat": "Boat · concealment and noise",
|
||||
"weather.boat.mast_radar": "Mast on radar: seen at {range} NM (calm sea {calm} NM)",
|
||||
"weather.boat.sighting": "Surfaced boat by eye: seen at {range} NM (day, clear, calm {reference} NM)",
|
||||
"weather.boat.sighting_none": "Surfaced boat by eye: not sighted in this light and sea (day, clear, calm {reference} NM)",
|
||||
"weather.boat.ambient": "Ambient noise vs. calm: {bands}",
|
||||
"weather.boat.band": "{band} Hz {excess} dB",
|
||||
"weather.boat.snorkel": "Snorkel: max {speed} kn · +{noise} dB · diesel lines {lines} Hz audible",
|
||||
"weather.boat.snorkel_active": "SNORKELLING: max {speed} kn · +{noise} dB · diesel lines {lines} Hz audible",
|
||||
"weather.boat.snorkel_none": "Snorkel: none (no diesel plant)",
|
||||
"help.uboot.weather": "Weather panel of the boat (0 or Esc closes)"
|
||||
}
|
||||
@@ -73,7 +73,7 @@ Taste `0` öffnet über jeder Station ein Analysepanel über den ganzen Bildschi
|
||||
- **Umwelt:** Uhrzeit, Tageslicht (Tag, bürgerliche oder nautische Dämmerung, Nacht), Mondphase, Wetter und Niederschlag, Sicht, Wind mit Böen und Beaufort, Seegang, Barometer mit 3-Stunden-Tendenz (steigend, stabil, fallend, rasch fallend), Luft- und Wassertemperatur, Wolkenuntergrenze und Vereisung. Rasch fallender Luftdruck unter etwa 1004 hPa löst eine Sturmwarnung aus. Das Wetter ändert sich höchstens um eine Seegangsstufe pro Stunde, deshalb bewegt sich das Barometer schneller als ein echtes.
|
||||
- **Wettereinflüsse:** Sonne (starke Sprungschicht), Wind (tiefere Deckschicht) und Regen oder Schnee (süßeres Oberflächenwasser, Regenrauschen) leuchten, solange sie wirken.
|
||||
- **Helikopter-Flugwetter:** CLEAR, LIMITED (innerhalb von 80 % eines Grenzwerts oder leichte Vereisung) oder NO-GO, mit Wind, Böen, Seitenwind, Sicht, Wolkenuntergrenze, Seegang, Rollen und Stampfen des Decks, Vereisung und ob Tauchsonar möglich ist.
|
||||
- **Boot (Stationen des bemannten U-Boots im Web-Client):** statt Helikopter-Flugwetter, Wolkenuntergrenze und Vereisung zeigen die Stationen des Boots, was das Wetter mit dem Boot macht. *Mast im Radar:* die Entfernung, auf der ein Überwasser-Suchradar wie das der Fregatte einen ausgefahrenen Mast oder Schnorchelkopf erfasst (bei der Hälfte aller Umläufe), bei aktuellem Seegang und Regen, neben dem Wert bei ruhiger See; Seegangsecho verdeckt das kleine Echo, der Radarhorizont begrenzt es. *Mit dem Auge:* wie weit ein Ausguck das aufgetauchte Boot bei aktuellem Licht, Mond, Sicht und Seegang sichtet (5 sm an einem klaren, ruhigen Tag); ein ausgefahrener Mast auf Sehrohrtiefe wird mit dem Auge nie gesichtet. *Umgebungsrauschen:* Wind- und Regenrauschen über ruhiger See (Seegang 1) in den vier Sonarbändern (100, 400, 1600, 6400 Hz); es tarnt das Boot vor Passivsonar und dämpft ebenso das eigene Horchen. *Schnorchel:* höchstens 6 kn, +12 dB Abstrahlpegel und Diesellinien bei 50 und 100 Hz, die ein Sonar hören kann.
|
||||
- **Boot (Stationen des bemannten U-Boots, Taste 0 auf der uConsole und im Web-Client):** statt Helikopter-Flugwetter, Wolkenuntergrenze und Vereisung zeigen die Stationen des Boots, was das Wetter mit dem Boot macht. *Mast im Radar:* die Entfernung, auf der ein Überwasser-Suchradar wie das der Fregatte einen ausgefahrenen Mast oder Schnorchelkopf erfasst (bei der Hälfte aller Umläufe), bei aktuellem Seegang und Regen, neben dem Wert bei ruhiger See; Seegangsecho verdeckt das kleine Echo, der Radarhorizont begrenzt es. *Mit dem Auge:* wie weit ein Ausguck das aufgetauchte Boot bei aktuellem Licht, Mond, Sicht und Seegang sichtet (5 sm an einem klaren, ruhigen Tag); ein ausgefahrener Mast auf Sehrohrtiefe wird mit dem Auge nie gesichtet. *Umgebungsrauschen:* Wind- und Regenrauschen über ruhiger See (Seegang 1) in den vier Sonarbändern (100, 400, 1600, 6400 Hz); es tarnt das Boot vor Passivsonar und dämpft ebenso das eigene Horchen. *Schnorchel:* höchstens 6 kn, +12 dB Abstrahlpegel und Diesellinien bei 50 und 100 Hz, die ein Sonar hören kann.
|
||||
- **Meeresprofil:** erscheint erst, wenn das Sonar einen Bathythermographen genommen hat (Sonar `E`): gemessene Schallgeschwindigkeit über der Tiefe, die Schicht, eine SOFAR-Achse falls vorhanden, neun Schallstrahlen vom Bugsonar bis 20 sm und die Schattenzone unter der Schicht (rot), in der das Bugsonar wenig hört. Nach 30 min oder 10 sm gilt die Messung als veraltet.
|
||||
|
||||
## Karten-Plotwerkzeuge (Taste P) {#ref-plot}
|
||||
|
||||
@@ -73,7 +73,7 @@ Key `0` opens a full-screen analysis panel over any station (`0` or `Esc` closes
|
||||
- **Environment:** time, daylight (day, civil or nautical twilight, night), moon phase, weather and precipitation, visibility, wind with gusts and Beaufort force, sea state, barometer with its 3-hour tendency (rising, steady, falling, falling rapidly), air and sea temperature, cloud ceiling and icing. A rapidly falling glass below about 1004 hPa gives a storm warning. The weather system changes by at most one sea state per hour, so the barometer moves faster than a real one.
|
||||
- **Weather effects:** sun (strong layer), wind (deeper mixed layer) and rain or snow (fresher surface water, rain noise) light up while they act.
|
||||
- **Helicopter flight weather:** CLEAR, LIMITED (within 80 % of a limit, or light icing) or NO-GO, with wind, gusts, crosswind, visibility, ceiling, sea state, deck roll and pitch, icing and whether dipping is possible.
|
||||
- **Boat (crewed submarine stations in the web client):** instead of the helicopter flight weather, cloud ceiling and icing, the boat's stations show what the weather does to the boat. *Mast on radar:* the range at which a surface-search radar like the frigate's detects a raised mast or snorkel head (half of all sweeps) in the current sea and rain, beside the calm-sea value; sea clutter hides the small echo, and the radar horizon caps it. *By eye:* how far a ship's lookout sights the boat surfaced in the current light, moon, visibility and sea (5 NM on a clear, calm day); a raised mast at periscope depth is never sighted by eye. *Ambient noise:* wind and rain noise above a calm sea (sea state 1) in the four sonar bands (100, 400, 1600, 6400 Hz); it masks the boat from passive sonar and dampens its own listening alike. *Snorkel:* at most 6 kn, +12 dB radiated level and diesel lines at 50 and 100 Hz that a sonar can hear.
|
||||
- **Boat (crewed submarine stations, key 0 on the uConsole and the web client):** instead of the helicopter flight weather, cloud ceiling and icing, the boat's stations show what the weather does to the boat. *Mast on radar:* the range at which a surface-search radar like the frigate's detects a raised mast or snorkel head (half of all sweeps) in the current sea and rain, beside the calm-sea value; sea clutter hides the small echo, and the radar horizon caps it. *By eye:* how far a ship's lookout sights the boat surfaced in the current light, moon, visibility and sea (5 NM on a clear, calm day); a raised mast at periscope depth is never sighted by eye. *Ambient noise:* wind and rain noise above a calm sea (sea state 1) in the four sonar bands (100, 400, 1600, 6400 Hz); it masks the boat from passive sonar and dampens its own listening alike. *Snorkel:* at most 6 kn, +12 dB radiated level and diesel lines at 50 and 100 Hz that a sonar can hear.
|
||||
- **Ocean profile:** appears only after the sonar has taken a bathythermograph (Sonar `E`): measured sound speed over depth, the layer, a SOFAR axis if present, nine sound rays from the hull sonar to 20 NM and the shadow zone below the layer (red) where the hull sonar hears little. The measurement is marked stale after 30 min or 10 NM.
|
||||
|
||||
## Chart plot tools (key P) {#ref-plot}
|
||||
|
||||
@@ -1019,7 +1019,7 @@ Taste `0` öffnet über jeder Station ein Analysepanel über den ganzen Bildschi
|
||||
- **Umwelt:** Uhrzeit, Tageslicht (Tag, bürgerliche oder nautische Dämmerung, Nacht), Mondphase, Wetter und Niederschlag, Sicht, Wind mit Böen und Beaufort, Seegang, Barometer mit 3-Stunden-Tendenz (steigend, stabil, fallend, rasch fallend), Luft- und Wassertemperatur, Wolkenuntergrenze und Vereisung. Rasch fallender Luftdruck unter etwa 1004 hPa löst eine Sturmwarnung aus. Das Wetter ändert sich höchstens um eine Seegangsstufe pro Stunde, deshalb bewegt sich das Barometer schneller als ein echtes.
|
||||
- **Wettereinflüsse:** Sonne (starke Sprungschicht), Wind (tiefere Deckschicht) und Regen oder Schnee (süßeres Oberflächenwasser, Regenrauschen) leuchten, solange sie wirken.
|
||||
- **Helikopter-Flugwetter:** CLEAR, LIMITED (innerhalb von 80 % eines Grenzwerts oder leichte Vereisung) oder NO-GO, mit Wind, Böen, Seitenwind, Sicht, Wolkenuntergrenze, Seegang, Rollen und Stampfen des Decks, Vereisung und ob Tauchsonar möglich ist.
|
||||
- **Boot (Stationen des bemannten U-Boots im Web-Client):** statt Helikopter-Flugwetter, Wolkenuntergrenze und Vereisung zeigen die Stationen des Boots, was das Wetter mit dem Boot macht. *Mast im Radar:* die Entfernung, auf der ein Überwasser-Suchradar wie das der Fregatte einen ausgefahrenen Mast oder Schnorchelkopf erfasst (bei der Hälfte aller Umläufe), bei aktuellem Seegang und Regen, neben dem Wert bei ruhiger See; Seegangsecho verdeckt das kleine Echo, der Radarhorizont begrenzt es. *Mit dem Auge:* wie weit ein Ausguck das aufgetauchte Boot bei aktuellem Licht, Mond, Sicht und Seegang sichtet (5 sm an einem klaren, ruhigen Tag); ein ausgefahrener Mast auf Sehrohrtiefe wird mit dem Auge nie gesichtet. *Umgebungsrauschen:* Wind- und Regenrauschen über ruhiger See (Seegang 1) in den vier Sonarbändern (100, 400, 1600, 6400 Hz); es tarnt das Boot vor Passivsonar und dämpft ebenso das eigene Horchen. *Schnorchel:* höchstens 6 kn, +12 dB Abstrahlpegel und Diesellinien bei 50 und 100 Hz, die ein Sonar hören kann.
|
||||
- **Boot (Stationen des bemannten U-Boots, Taste 0 auf der uConsole und im Web-Client):** statt Helikopter-Flugwetter, Wolkenuntergrenze und Vereisung zeigen die Stationen des Boots, was das Wetter mit dem Boot macht. *Mast im Radar:* die Entfernung, auf der ein Überwasser-Suchradar wie das der Fregatte einen ausgefahrenen Mast oder Schnorchelkopf erfasst (bei der Hälfte aller Umläufe), bei aktuellem Seegang und Regen, neben dem Wert bei ruhiger See; Seegangsecho verdeckt das kleine Echo, der Radarhorizont begrenzt es. *Mit dem Auge:* wie weit ein Ausguck das aufgetauchte Boot bei aktuellem Licht, Mond, Sicht und Seegang sichtet (5 sm an einem klaren, ruhigen Tag); ein ausgefahrener Mast auf Sehrohrtiefe wird mit dem Auge nie gesichtet. *Umgebungsrauschen:* Wind- und Regenrauschen über ruhiger See (Seegang 1) in den vier Sonarbändern (100, 400, 1600, 6400 Hz); es tarnt das Boot vor Passivsonar und dämpft ebenso das eigene Horchen. *Schnorchel:* höchstens 6 kn, +12 dB Abstrahlpegel und Diesellinien bei 50 und 100 Hz, die ein Sonar hören kann.
|
||||
- **Meeresprofil:** erscheint erst, wenn das Sonar einen Bathythermographen genommen hat (Sonar `E`): gemessene Schallgeschwindigkeit über der Tiefe, die Schicht, eine SOFAR-Achse falls vorhanden, neun Schallstrahlen vom Bugsonar bis 20 sm und die Schattenzone unter der Schicht (rot), in der das Bugsonar wenig hört. Nach 30 min oder 10 sm gilt die Messung als veraltet.
|
||||
|
||||
### Karten-Plotwerkzeuge (Taste P)
|
||||
@@ -1092,6 +1092,7 @@ Die obere Leiste zeigt die sechs Stationen des Boots als Reiter: `1` Führung, `
|
||||
| `Eingabe` | Sehrohrseite: Stadimeter-Entfernung der Sichtung unter dem Fadenkreuz (Führung, Mast & ESM) |
|
||||
| `+ / -` | Fahrtstufe schneller / langsamer (Führung, Maschine) |
|
||||
| `Sonartasten` | Wie am Fregattensonar, ohne Schleppantenne, OPZ-Freigabe, Plot und Telegraph |
|
||||
| `0` | Wetterseite des Boots (0 oder Esc schließt) |
|
||||
| `S / L / F9` | Speichern / Laden / Remote Crew (die Fregatten-Crew) |
|
||||
|
||||
#### Nicht modelliert
|
||||
|
||||
@@ -1018,7 +1018,7 @@ Key `0` opens a full-screen analysis panel over any station (`0` or `Esc` closes
|
||||
- **Environment:** time, daylight (day, civil or nautical twilight, night), moon phase, weather and precipitation, visibility, wind with gusts and Beaufort force, sea state, barometer with its 3-hour tendency (rising, steady, falling, falling rapidly), air and sea temperature, cloud ceiling and icing. A rapidly falling glass below about 1004 hPa gives a storm warning. The weather system changes by at most one sea state per hour, so the barometer moves faster than a real one.
|
||||
- **Weather effects:** sun (strong layer), wind (deeper mixed layer) and rain or snow (fresher surface water, rain noise) light up while they act.
|
||||
- **Helicopter flight weather:** CLEAR, LIMITED (within 80 % of a limit, or light icing) or NO-GO, with wind, gusts, crosswind, visibility, ceiling, sea state, deck roll and pitch, icing and whether dipping is possible.
|
||||
- **Boat (crewed submarine stations in the web client):** instead of the helicopter flight weather, cloud ceiling and icing, the boat's stations show what the weather does to the boat. *Mast on radar:* the range at which a surface-search radar like the frigate's detects a raised mast or snorkel head (half of all sweeps) in the current sea and rain, beside the calm-sea value; sea clutter hides the small echo, and the radar horizon caps it. *By eye:* how far a ship's lookout sights the boat surfaced in the current light, moon, visibility and sea (5 NM on a clear, calm day); a raised mast at periscope depth is never sighted by eye. *Ambient noise:* wind and rain noise above a calm sea (sea state 1) in the four sonar bands (100, 400, 1600, 6400 Hz); it masks the boat from passive sonar and dampens its own listening alike. *Snorkel:* at most 6 kn, +12 dB radiated level and diesel lines at 50 and 100 Hz that a sonar can hear.
|
||||
- **Boat (crewed submarine stations, key 0 on the uConsole and the web client):** instead of the helicopter flight weather, cloud ceiling and icing, the boat's stations show what the weather does to the boat. *Mast on radar:* the range at which a surface-search radar like the frigate's detects a raised mast or snorkel head (half of all sweeps) in the current sea and rain, beside the calm-sea value; sea clutter hides the small echo, and the radar horizon caps it. *By eye:* how far a ship's lookout sights the boat surfaced in the current light, moon, visibility and sea (5 NM on a clear, calm day); a raised mast at periscope depth is never sighted by eye. *Ambient noise:* wind and rain noise above a calm sea (sea state 1) in the four sonar bands (100, 400, 1600, 6400 Hz); it masks the boat from passive sonar and dampens its own listening alike. *Snorkel:* at most 6 kn, +12 dB radiated level and diesel lines at 50 and 100 Hz that a sonar can hear.
|
||||
- **Ocean profile:** appears only after the sonar has taken a bathythermograph (Sonar `E`): measured sound speed over depth, the layer, a SOFAR axis if present, nine sound rays from the hull sonar to 20 NM and the shadow zone below the layer (red) where the hull sonar hears little. The measurement is marked stale after 30 min or 10 NM.
|
||||
|
||||
### Chart plot tools (key P)
|
||||
@@ -1091,6 +1091,7 @@ The top bar shows the boat's six stations as tabs: `1` Command, `2` Sonar, `3` W
|
||||
| `Enter` | Periscope page: stadimeter range of the sighting under the crosshair (Command, Mast & ESM) |
|
||||
| `+ / -` | Telegraph step faster / slower (Command, Engine room) |
|
||||
| `Sonar keys` | As on the frigate sonar, without towed array, OPZ release, plot and telegraph |
|
||||
| `0` | Weather panel of the boat (0 or Esc closes) |
|
||||
| `S / L / F9` | Save / load / Remote Crew (the frigate's crew) |
|
||||
|
||||
#### Not modelled
|
||||
|
||||
@@ -241,6 +241,7 @@ _UBOOT_HELP = (
|
||||
("help.key.enter", "help.uboot.stadimeter"),
|
||||
("+ / -", "help.uboot.telegraph"),
|
||||
("help.key.uboot_sonar", "help.uboot.sonar"),
|
||||
("0", "help.uboot.weather"),
|
||||
("S / L / F9", "help.uboot.admin"),
|
||||
],
|
||||
)
|
||||
|
||||
@@ -334,6 +334,13 @@ def handle_key(game, event) -> None:
|
||||
if key == pygame.K_F10:
|
||||
game._open_administration("options")
|
||||
return
|
||||
if key in (pygame.K_0, pygame.K_KP0) and current is not None:
|
||||
# The boat's weather panel (its own instruments and BT), as on the frigate.
|
||||
game._clear_station_input()
|
||||
game.pinned_tooltip = None
|
||||
game._tooltip_anchor = None
|
||||
game.weather_station_open = True
|
||||
return
|
||||
if key in (pygame.K_s, pygame.K_l) and game.station is not Station.SONAR:
|
||||
game._open_administration("save" if key == pygame.K_s else "load")
|
||||
return
|
||||
|
||||
@@ -26,6 +26,7 @@ from src.ui.stations_view import (_panel, _station_content_top,
|
||||
draw_station_page_tabs, station_page_tab_at)
|
||||
from src.ui.uboot_scope import draw_scope_page
|
||||
from src.ui.viewport import Viewport
|
||||
from src.ui.weather_station import draw_weather_station
|
||||
|
||||
UBOOT_PAGES = ("UBOOT_NAV", "UBOOT_WEAPONS", "UBOOT_SCOPE")
|
||||
# Panel pages of each boat station beside the chart (the sonar room is full screen).
|
||||
@@ -838,6 +839,15 @@ def draw(game) -> None:
|
||||
draw_top_bar(game, boat)
|
||||
previous = config.STATION_RECT
|
||||
try:
|
||||
if game.weather_station_open and boat is not None:
|
||||
# Key 0: the weather panel over the whole station area, read
|
||||
# from the boat's own instruments and bathythermograph.
|
||||
config.STATION_RECT = config.OPZ_STATION_RECT
|
||||
with layout.clip_to(game.screen, config.STATION_RECT):
|
||||
with game.sonar_perspective(boat.station):
|
||||
draw_weather_station(game)
|
||||
game.draw_navigation_input()
|
||||
return
|
||||
if game.station is Station.SONAR and boat is not None:
|
||||
config.STATION_RECT = config.FULL_STATION_RECT
|
||||
with layout.clip_to(game.screen, config.STATION_RECT):
|
||||
|
||||
+49
-10
@@ -1,7 +1,8 @@
|
||||
"""Weather & sonar analysis panel (key 0), drawn over the station area.
|
||||
|
||||
Consumes only ``Game.weather_station_data()`` (an observation-safe DTO):
|
||||
own-ship atmosphere and flight weather, and - only after a sonar
|
||||
own-ship atmosphere and flight weather (aboard the crewed boat: what the
|
||||
weather does to the boat), and - only after a sonar
|
||||
bathythermograph measurement - the measured ocean profile with its layer,
|
||||
shadow zone, SOFAR axis and a few sound rays.
|
||||
"""
|
||||
@@ -59,14 +60,20 @@ def _environment(screen, rect, data) -> None:
|
||||
tendency=f"{a['pressure_tendency_hpa_3h']:+.0f}",
|
||||
trend=message("weather.trend." + trend)),
|
||||
x, y + 3 * LINE_H, w, trend_color)
|
||||
ceiling = a["ceiling_ft"]
|
||||
_line(screen, message("weather.line.temperature", air=_fmt(a["air_temp_c"], 1),
|
||||
sea=_fmt(a["sea_temp_c"], 1),
|
||||
ceiling=(message("weather.ceiling.none") if ceiling is None
|
||||
else message("weather.ceiling.ft", ceiling=_fmt(ceiling))),
|
||||
icing=message("weather.icing." + a["icing"])),
|
||||
x, y + 4 * LINE_H, w,
|
||||
config.COLOR_WARN if a["icing"] != "none" else config.COLOR_TEXT)
|
||||
if "icing" not in a:
|
||||
# The boat's instruments: no cloud ceiling or icing (nothing flies).
|
||||
_line(screen, message("weather.line.temperature_boat", air=_fmt(a["air_temp_c"], 1),
|
||||
sea=_fmt(a["sea_temp_c"], 1)), x, y + 4 * LINE_H, w)
|
||||
else:
|
||||
ceiling = a["ceiling_ft"]
|
||||
_line(screen, message("weather.line.temperature", air=_fmt(a["air_temp_c"], 1),
|
||||
sea=_fmt(a["sea_temp_c"], 1),
|
||||
ceiling=(message("weather.ceiling.none") if ceiling is None
|
||||
else message("weather.ceiling.ft",
|
||||
ceiling=_fmt(ceiling))),
|
||||
icing=message("weather.icing." + a["icing"])),
|
||||
x, y + 4 * LINE_H, w,
|
||||
config.COLOR_WARN if a["icing"] != "none" else config.COLOR_TEXT)
|
||||
if a["storm_warning"]:
|
||||
_line(screen, "weather.storm_warning", x, y + 5 * LINE_H, w, config.COLOR_DANGER)
|
||||
|
||||
@@ -122,6 +129,34 @@ def _flight(screen, rect, data) -> None:
|
||||
config.COLOR_WARN if warn.get(index) else config.COLOR_TEXT, size=TEXT)
|
||||
|
||||
|
||||
def _boat(screen, rect, data) -> None:
|
||||
"""What the weather does to the crewed boat (instead of flight weather)."""
|
||||
x, y, w, h = layout.box(screen, rect, "weather.box.boat")
|
||||
b = data["boat"]
|
||||
bands = " ".join(str(localize(message("weather.boat.band", band=_fmt(band),
|
||||
excess=f"{excess:+.0f}")))
|
||||
for band, excess in zip(b["ambient_bands_hz"], b["ambient_excess_db"]))
|
||||
lines_hz = "/".join(_fmt(line) for line in b["snorkel_lines_hz"])
|
||||
snorkel = (message("weather.boat.snorkel_none") if not b["snorkel_available"] else
|
||||
message("weather.boat.snorkel_active" if b["snorkeling"]
|
||||
else "weather.boat.snorkel", speed=_fmt(b["snorkel_max_kn"]),
|
||||
noise=_fmt(b["snorkel_noise_db"]), lines=lines_hz))
|
||||
sighting = (message("weather.boat.sighting", range=_fmt(b["sighting_nm"], 1),
|
||||
reference=_fmt(b["sighting_ref_nm"], 1))
|
||||
if b["sighting_nm"] >= 0.05 else
|
||||
message("weather.boat.sighting_none", reference=_fmt(b["sighting_ref_nm"], 1)))
|
||||
rows = ((message("weather.boat.mast_radar", range=_fmt(b["mast_radar_nm"], 1),
|
||||
calm=_fmt(b["mast_radar_calm_nm"], 1)),
|
||||
b["mast_radar_nm"] < b["mast_radar_calm_nm"] * 0.8),
|
||||
(sighting, False),
|
||||
(message("weather.boat.ambient", bands=bands), False),
|
||||
(snorkel, b["snorkeling"]))
|
||||
row_h = max(LINE_H, (h - 4) // len(rows))
|
||||
for index, (text, warn) in enumerate(rows):
|
||||
layout.blit_block(screen, text, x, y + index * row_h, w, row_h - 2,
|
||||
config.COLOR_OK if warn else config.COLOR_TEXT, size=TEXT - 2)
|
||||
|
||||
|
||||
def _profile(screen, rect, data, mouse=None) -> None:
|
||||
x, y, w, h = layout.box(screen, rect, "weather.box.profile")
|
||||
p = data["profile"]
|
||||
@@ -254,7 +289,11 @@ def draw_weather_station(game, tr=None) -> None:
|
||||
top_h = 6 * LINE_H + 52
|
||||
left_w = int(width * 0.54)
|
||||
_environment(screen, (x, y, left_w, top_h), data)
|
||||
_flight(screen, (x + left_w + 10, y, width - left_w - 10, top_h), data)
|
||||
side = (x + left_w + 10, y, width - left_w - 10, top_h)
|
||||
if "boat" in data:
|
||||
_boat(screen, side, data)
|
||||
else:
|
||||
_flight(screen, side, data)
|
||||
_effects(screen, (x + 8, y + top_h + 6, width - 16, LINE_H), data)
|
||||
profile_y = y + top_h + LINE_H + 12
|
||||
_profile(screen, (x, profile_y, width, r[1] + r[3] - profile_y - 6), data,
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
"""Key 0 opens the weather panel aboard the crewed boat on the uConsole."""
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import pygame
|
||||
|
||||
from src.core import uboot_local
|
||||
from src.core.station import Station
|
||||
from src.ui import layout, weather_station
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent))
|
||||
from test_uboot_scope import _key, _local_boat # noqa: E402
|
||||
|
||||
|
||||
def test_zero_opens_the_boats_weather_panel_and_closes_again(monkeypatch):
|
||||
game, boat = _local_boat()
|
||||
seen = []
|
||||
original = weather_station._boat
|
||||
monkeypatch.setattr(weather_station, "_boat",
|
||||
lambda s, rect, data: (seen.append(data["boat"]),
|
||||
original(s, rect, data)))
|
||||
for station in ("uboot", "uboot_engine", "uboot_sonar"):
|
||||
uboot_local.set_local_station(game, station)
|
||||
_key(game, pygame.K_0)
|
||||
assert game.weather_station_open
|
||||
seen.clear()
|
||||
with layout.capture_geometry() as boxes:
|
||||
game.draw()
|
||||
# The boat's own block, never the frigate's flight weather.
|
||||
assert seen and seen[0]["snorkel_available"] is (boat.sub.endurance is not None)
|
||||
titles = {row["title"] for row in boxes}
|
||||
assert "weather.box.boat" in titles and "weather.box.flight" not in titles
|
||||
_key(game, pygame.K_0)
|
||||
assert not game.weather_station_open
|
||||
_key(game, pygame.K_0)
|
||||
_key(game, pygame.K_ESCAPE)
|
||||
assert not game.weather_station_open and not game.quit_confirm
|
||||
|
||||
|
||||
def test_the_boat_panel_omits_the_flight_rows():
|
||||
game, boat = _local_boat()
|
||||
with game.sonar_perspective(boat.station):
|
||||
data = game.weather_station_data()
|
||||
assert "boat" in data and "flight" not in data
|
||||
assert "icing" not in data["atmosphere"]
|
||||
game.station = Station.BRIDGE
|
||||
assert "flight" in game.weather_station_data()
|
||||
Reference in new issue
Block a user