mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Add a package kneeboard page.
The package page shows each flight member in the whole package. The data shown for now is the callsign, task, radio frequency, and laser code. The STN for each flight will be added once that's done. This does generate one package page per flight. That means that packages where multiple flights have players and use the same aircraft type will have some duplicated pages, but the alternative is that some players would need to skip past all their flight members' pages to find their package page instead of having it grouped with their own.
This commit is contained in:
parent
e9133bffab
commit
256c9ce73d
@ -14,6 +14,7 @@ Saves from 8.x are not compatible with 9.0.0.
|
||||
* **[Flight Planning]** Loadouts and aircraft properties can now be set per-flight member. Warning: AI flights should not use mixed loadouts.
|
||||
* **[Flight Planning]** Laser codes that are pre-assigned to weapons at mission start can now be chosen from a list in the loadout UI. This does not affect the aircraft's TGP, just the weapons. Currently only implemented for the F-15E S4+ and F-16C.
|
||||
* **[Mission Generation]** Configured target and initial points for F-15E S4+.
|
||||
* **[Mission Generation]** Added a package kneeboard page that shows the radio frequencies, tasks, and laser codes for each member of your package.
|
||||
* **[Modding]** Factions can now specify the ship type to be used for cargo shipping. The Handy Wind will be used by default, but WW2 factions can pick something more appropriate.
|
||||
* **[Modding]** Unit variants can now set a display name separate from their ID.
|
||||
* **[UI]** An error will be displayed when invalid fast-forward options are selected rather than beginning a never ending simulation.
|
||||
|
||||
@ -48,6 +48,7 @@ from game.weather.weather import Weather
|
||||
from .aircraft.flightdata import FlightData
|
||||
from .airsupportgenerator import AwacsInfo, TankerInfo
|
||||
from .briefinggenerator import CommInfo, JtacInfo, MissionInfoGenerator
|
||||
from ..ato import Package
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from game import Game
|
||||
@ -691,6 +692,46 @@ class NotesPage(KneeboardPage):
|
||||
writer.write(path)
|
||||
|
||||
|
||||
class PackagePage(KneeboardPage):
|
||||
"""A kneeboard page showing information about the flight's package."""
|
||||
|
||||
def __init__(
|
||||
self, package: Package, flights: list[FlightData], dark_kneeboard: bool
|
||||
) -> None:
|
||||
self.package = package
|
||||
self.flights = flights
|
||||
self.dark_kneeboard = dark_kneeboard
|
||||
|
||||
def write(self, path: Path) -> None:
|
||||
writer = KneeboardPageWriter(dark_theme=self.dark_kneeboard)
|
||||
writer.title(
|
||||
f"Package {self.package.package_description} {self.package.target.name}"
|
||||
)
|
||||
|
||||
table = []
|
||||
for flight in self.flights:
|
||||
for idx, laser_code in enumerate(flight.laser_codes, 1):
|
||||
# Blank the flight-wide properties to make the table easier to scan.
|
||||
if idx > 1:
|
||||
task = ""
|
||||
radio = ""
|
||||
else:
|
||||
task = str(flight.flight_type)
|
||||
radio = str(flight.intra_flight_channel)
|
||||
|
||||
table.append(
|
||||
[
|
||||
f"{flight.callsign}-{idx}",
|
||||
task,
|
||||
radio,
|
||||
"" if laser_code is None else str(laser_code),
|
||||
]
|
||||
)
|
||||
writer.table(table, ["Aircraft", "Task", "Radio", "Laser code"])
|
||||
|
||||
writer.write(path)
|
||||
|
||||
|
||||
class KneeboardGenerator(MissionInfoGenerator):
|
||||
"""Creates kneeboard pages for each client flight in the mission."""
|
||||
|
||||
@ -729,7 +770,7 @@ class KneeboardGenerator(MissionInfoGenerator):
|
||||
if not flight.client_units:
|
||||
continue
|
||||
all_flights[flight.aircraft_type].extend(
|
||||
self.generate_flight_kneeboard(flight)
|
||||
self.generate_flight_kneeboard(flight, flights)
|
||||
)
|
||||
return all_flights
|
||||
|
||||
@ -740,7 +781,9 @@ class KneeboardGenerator(MissionInfoGenerator):
|
||||
return StrikeTaskPage(flight, self.dark_kneeboard)
|
||||
return None
|
||||
|
||||
def generate_flight_kneeboard(self, flight: FlightData) -> List[KneeboardPage]:
|
||||
def generate_flight_kneeboard(
|
||||
self, flight: FlightData, flights: list[FlightData]
|
||||
) -> List[KneeboardPage]:
|
||||
"""Returns a list of kneeboard pages for the given flight."""
|
||||
|
||||
if flight.aircraft_type.utc_kneeboard:
|
||||
@ -767,6 +810,7 @@ class KneeboardGenerator(MissionInfoGenerator):
|
||||
zoned_time,
|
||||
self.dark_kneeboard,
|
||||
),
|
||||
PackagePage(flight.package, flights, self.dark_kneeboard),
|
||||
]
|
||||
|
||||
# Only create the notes page if there are notes to show.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user