mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Log error if beacon data can't be found
This would prevent mission generation otherwise...
This commit is contained in:
parent
98360c8388
commit
fd42b03d78
@ -1,6 +1,7 @@
|
|||||||
"""Runway information and selection."""
|
"""Runway information and selection."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import logging
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Iterator, Optional, TYPE_CHECKING
|
from typing import Iterator, Optional, TYPE_CHECKING
|
||||||
|
|
||||||
@ -14,6 +15,7 @@ from game.utils import Heading
|
|||||||
from game.weather.conditions import Conditions
|
from game.weather.conditions import Conditions
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
from game.dcs.beacons import Beacon
|
||||||
from game.theater import ConflictTheater
|
from game.theater import ConflictTheater
|
||||||
|
|
||||||
|
|
||||||
@ -51,13 +53,17 @@ class RunwayData:
|
|||||||
atc = atc_radio.uhf
|
atc = atc_radio.uhf
|
||||||
|
|
||||||
for beacon_data in airport.beacons:
|
for beacon_data in airport.beacons:
|
||||||
beacon = Beacons.with_id(beacon_data.id, theater)
|
beacon = cls._get_beacon(beacon_data.id, theater)
|
||||||
|
if not beacon:
|
||||||
|
continue
|
||||||
if beacon.is_tacan:
|
if beacon.is_tacan:
|
||||||
tacan = beacon.tacan_channel
|
tacan = beacon.tacan_channel
|
||||||
tacan_callsign = beacon.callsign
|
tacan_callsign = beacon.callsign
|
||||||
|
|
||||||
for beacon_data in runway.beacons:
|
for beacon_data in runway.beacons:
|
||||||
beacon = Beacons.with_id(beacon_data.id, theater)
|
beacon = cls._get_beacon(beacon_data.id, theater)
|
||||||
|
if not beacon:
|
||||||
|
continue
|
||||||
if beacon.beacon_type is BeaconType.BEACON_TYPE_ILS_GLIDESLOPE:
|
if beacon.beacon_type is BeaconType.BEACON_TYPE_ILS_GLIDESLOPE:
|
||||||
ils = beacon.frequency
|
ils = beacon.frequency
|
||||||
|
|
||||||
@ -71,6 +77,17 @@ class RunwayData:
|
|||||||
ils=ils,
|
ils=ils,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _get_beacon(beacon_id: str, theater: ConflictTheater) -> Optional[Beacon]:
|
||||||
|
try:
|
||||||
|
beacon = Beacons.with_id(beacon_id, theater)
|
||||||
|
return beacon
|
||||||
|
except KeyError:
|
||||||
|
# this means pydcs found a beacon in the "standlist"
|
||||||
|
# but isn't present in beacons.lua file, which in turn causes problems...
|
||||||
|
logging.error(f"Could not find data for '{beacon_id}', skipping beacon...")
|
||||||
|
return None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def for_pydcs_airport(
|
def for_pydcs_airport(
|
||||||
cls, theater: ConflictTheater, airport: Airport
|
cls, theater: ConflictTheater, airport: Airport
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user