mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
The check for whether or not the escort is actually needed happens later, and thus the mission can still be scrubbed if it's too dangerous. However, missions should not be scrubbed when a particular escort type is unplannable, yet not needed. Only if the primary flight type is not plannable should the mission immediately be scrubbed
60 lines
1.7 KiB
Python
60 lines
1.7 KiB
Python
from dataclasses import field, dataclass
|
|
from enum import Enum, auto
|
|
from typing import Optional
|
|
|
|
from game.ato.flighttype import FlightType
|
|
from game.theater import MissionTarget
|
|
|
|
|
|
class EscortType(Enum):
|
|
AirToAir = auto()
|
|
Sead = auto()
|
|
Refuel = auto()
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class ProposedFlight:
|
|
"""A flight outline proposed by the mission planner.
|
|
|
|
Proposed flights haven't been assigned specific aircraft yet. They have only
|
|
a task, a required number of aircraft, and a maximum distance allowed
|
|
between the objective and the departure airfield.
|
|
"""
|
|
|
|
#: The flight's role.
|
|
task: FlightType
|
|
|
|
#: The number of aircraft required.
|
|
num_aircraft: int
|
|
|
|
#: The type of threat this flight defends against if it is an escort. Escort
|
|
#: flights will be pruned if the rest of the package is not threatened by
|
|
#: the threat they defend against. If this flight is not an escort, this
|
|
#: field is None.
|
|
escort_type: Optional[EscortType] = field(default=None)
|
|
|
|
def __str__(self) -> str:
|
|
return f"{self.task} {self.num_aircraft} ship"
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class ProposedMission:
|
|
"""A mission outline proposed by the mission planner.
|
|
|
|
Proposed missions haven't been assigned aircraft yet. They have only an
|
|
objective location and a list of proposed flights that are required for the
|
|
mission.
|
|
"""
|
|
|
|
#: The mission objective.
|
|
location: MissionTarget
|
|
|
|
#: The proposed flights that are required for the mission.
|
|
flights: list[ProposedFlight]
|
|
|
|
asap: bool = field(default=False)
|
|
|
|
def __str__(self) -> str:
|
|
flights = ", ".join([str(f) for f in self.flights])
|
|
return f"{self.location.name}: {flights}"
|