Don't generate runway data for heliports.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2710.
This commit is contained in:
Dan Albert
2023-02-05 13:11:31 -08:00
committed by Raffson
parent 3fc82af3ac
commit 86672d882e
2 changed files with 24 additions and 7 deletions

View File

@@ -877,6 +877,11 @@ class ControlPoint(MissionTarget, SidcDescribable, ABC):
) -> RunwayData:
...
def stub_runway_data(self) -> RunwayData:
return RunwayData(
self.full_name, runway_heading=Heading.from_degrees(0), runway_name=""
)
@property
def airdrome_id_for_landing(self) -> Optional[int]:
return None
@@ -1140,6 +1145,14 @@ class Airfield(ControlPoint, CTLD):
conditions: Conditions,
dynamic_runways: Dict[str, RunwayData],
) -> RunwayData:
if not self.airport.runways:
# Some airfields are heliports and don't have any runways. This isn't really
# the best fix, since we should still try to generate partial data for TACAN
# beacons, but it'll do for a bug fix, and the proper fix probably involves
# making heliports their own CP type.
# https://github.com/dcs-liberation/dcs_liberation/issues/2710
return self.stub_runway_data()
assigner = RunwayAssigner(conditions)
return assigner.get_preferred_runway(theater, self.airport)
@@ -1278,7 +1291,7 @@ class Carrier(NavalControlPoint):
return SymbolSet.SEA_SURFACE, SeaSurfaceEntity.CARRIER
def mission_types(self, for_player: bool) -> Iterator[FlightType]:
from game.ato import FlightType
from game.ato.flighttype import FlightType
yield from super().mission_types(for_player)
if self.is_friendly(for_player):
@@ -1385,9 +1398,7 @@ class OffMapSpawn(ControlPoint):
dynamic_runways: Dict[str, RunwayData],
) -> RunwayData:
logging.warning("TODO: Off map spawns have no runways.")
return RunwayData(
self.full_name, runway_heading=Heading.from_degrees(0), runway_name=""
)
return self.stub_runway_data()
@property
def runway_status(self) -> RunwayStatus:
@@ -1435,9 +1446,7 @@ class Fob(ControlPoint, RadioFrequencyContainer, CTLD):
dynamic_runways: Dict[str, RunwayData],
) -> RunwayData:
logging.warning("TODO: FOBs have no runways.")
return RunwayData(
self.full_name, runway_heading=Heading.from_degrees(0), runway_name=""
)
return self.stub_runway_data()
@property
def runway_status(self) -> RunwayStatus: