Describe non-airport "runways" better.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/3290.
This commit is contained in:
Dan Albert 2023-12-21 16:03:23 -08:00
parent ef69275f34
commit dcf23c655d
3 changed files with 37 additions and 15 deletions

View File

@ -5,6 +5,7 @@ Saves from 9.x are not compatible with 10.0.0.
## Features/Improvements ## Features/Improvements
* **[Engine]** Support for DCS 2.9.2.49629 Open Beta. (F-15E JDAM and JSOW, F-16 AIM-9P, updated Falklands and Normandy airfields). * **[Engine]** Support for DCS 2.9.2.49629 Open Beta. (F-15E JDAM and JSOW, F-16 AIM-9P, updated Falklands and Normandy airfields).
* **[UI]** Improved the description of "runway" state for FARPs, FOBs, carriers, and off-map spawns.
## Fixes ## Fixes

View File

@ -271,15 +271,15 @@ class RunwayStatus:
def needs_repair(self) -> bool: def needs_repair(self) -> bool:
return self.damaged and self.repair_turns_remaining is None return self.damaged and self.repair_turns_remaining is None
def __str__(self) -> str: def describe(self) -> str:
if not self.damaged: if not self.damaged:
return "Runway operational" return "operational"
turns_remaining = self.repair_turns_remaining turns_remaining = self.repair_turns_remaining
if turns_remaining is None: if turns_remaining is None:
return "Runway damaged" return "damaged"
return f"Runway repairing, {turns_remaining} turns remaining" return f"repairing, {turns_remaining} turns remaining"
@total_ordering @total_ordering
@ -915,6 +915,10 @@ class ControlPoint(MissionTarget, SidcDescribable, ABC):
def runway_status(self) -> RunwayStatus: def runway_status(self) -> RunwayStatus:
... ...
@abstractmethod
def describe_runway_status(self) -> str | None:
"""Description of the runway status suitable for UI use."""
@property @property
def runway_can_be_repaired(self) -> bool: def runway_can_be_repaired(self) -> bool:
return self.runway_status.needs_repair return self.runway_status.needs_repair
@ -1157,6 +1161,9 @@ class Airfield(ControlPoint):
def runway_status(self) -> RunwayStatus: def runway_status(self) -> RunwayStatus:
return self._runway_status return self._runway_status
def describe_runway_status(self) -> str:
return f"Runway {self.runway_status.describe()}"
def damage_runway(self) -> None: def damage_runway(self) -> None:
self.runway_status.damage() self.runway_status.damage()
@ -1275,6 +1282,9 @@ class NavalControlPoint(ControlPoint, ABC):
def runway_status(self) -> RunwayStatus: def runway_status(self) -> RunwayStatus:
return RunwayStatus(damaged=not self.runway_is_operational()) return RunwayStatus(damaged=not self.runway_is_operational())
def describe_runway_status(self) -> str:
return f"Flight deck {self.runway_status.describe()}"
@property @property
def runway_can_be_repaired(self) -> bool: def runway_can_be_repaired(self) -> bool:
return False return False
@ -1428,6 +1438,9 @@ class OffMapSpawn(ControlPoint):
def runway_status(self) -> RunwayStatus: def runway_status(self) -> RunwayStatus:
return RunwayStatus() return RunwayStatus()
def describe_runway_status(self) -> str:
return f"Off-map airport {self.runway_status.describe()}"
@property @property
def can_deploy_ground_units(self) -> bool: def can_deploy_ground_units(self) -> bool:
return False return False
@ -1474,6 +1487,11 @@ class Fob(ControlPoint):
def runway_status(self) -> RunwayStatus: def runway_status(self) -> RunwayStatus:
return RunwayStatus() return RunwayStatus()
def describe_runway_status(self) -> str | None:
if not self.has_helipads:
return None
return f"FARP {self.runway_status.describe()}"
def mission_types(self, for_player: bool) -> Iterator[FlightType]: def mission_types(self, for_player: bool) -> Iterator[FlightType]:
from game.ato import FlightType from game.ato import FlightType

View File

@ -254,19 +254,22 @@ class QBaseMenu2(QDialog):
f" (Up to {ground_unit_limit} deployable, {unit_overage} reserve)" f" (Up to {ground_unit_limit} deployable, {unit_overage} reserve)"
) )
self.intel_summary.setText( intel_lines = [
"\n".join( f"{aircraft}/{parking} aircraft",
[ f"{self.cp.base.total_armor} ground units" + deployable_unit_info,
f"{aircraft}/{parking} aircraft", f"{allocated.total_transferring} more ground units en route, {allocated.total_ordered} ordered",
f"{self.cp.base.total_armor} ground units" + deployable_unit_info, ]
f"{allocated.total_transferring} more ground units en route, {allocated.total_ordered} ordered", if (runway_description := self.cp.describe_runway_status()) is not None:
str(self.cp.runway_status), intel_lines.append(runway_description)
f"{self.cp.active_ammo_depots_count}/{self.cp.total_ammo_depots_count} ammo depots", intel_lines.extend(
f"{'Factory can produce units' if self.cp.has_factory else 'Does not have a factory'}", [
] f"{self.cp.active_ammo_depots_count}/{self.cp.total_ammo_depots_count} ammo depots",
) f"{'Factory can produce units' if self.cp.has_factory else 'Does not have a factory'}",
]
) )
self.intel_summary.setText("\n".join(intel_lines))
def generate_intel_tooltip(self) -> str: def generate_intel_tooltip(self) -> str:
tooltip = ( tooltip = (
f"Deployable unit limit ({self.cp.frontline_unit_count_limit}) = {FREE_FRONTLINE_UNIT_SUPPLY} (base) + " f"Deployable unit limit ({self.cp.frontline_unit_count_limit}) = {FREE_FRONTLINE_UNIT_SUPPLY} (base) + "