mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
56 lines
1.3 KiB
Python
56 lines
1.3 KiB
Python
from __future__ import annotations
|
|
|
|
from abc import ABC, abstractmethod
|
|
from typing import Any, Generic, TYPE_CHECKING, TypeVar
|
|
|
|
from .flightplan import FlightPlan, Layout
|
|
|
|
if TYPE_CHECKING:
|
|
from game.coalition import Coalition
|
|
from game.data.doctrine import Doctrine
|
|
from game.theater import ConflictTheater
|
|
from game.threatzones import ThreatZones
|
|
from ..flight import Flight
|
|
from ..package import Package
|
|
|
|
|
|
FlightPlanT = TypeVar("FlightPlanT", bound=FlightPlan[Any])
|
|
LayoutT = TypeVar("LayoutT", bound=Layout)
|
|
|
|
|
|
class IBuilder(ABC, Generic[FlightPlanT, LayoutT]):
|
|
def __init__(self, flight: Flight) -> None:
|
|
self.flight = flight
|
|
|
|
@property
|
|
def theater(self) -> ConflictTheater:
|
|
return self.flight.departure.theater
|
|
|
|
@abstractmethod
|
|
def layout(self) -> LayoutT:
|
|
...
|
|
|
|
@abstractmethod
|
|
def build(self) -> FlightPlanT:
|
|
...
|
|
|
|
@property
|
|
def package(self) -> Package:
|
|
return self.flight.package
|
|
|
|
@property
|
|
def coalition(self) -> Coalition:
|
|
return self.flight.coalition
|
|
|
|
@property
|
|
def is_player(self) -> bool:
|
|
return self.coalition.player
|
|
|
|
@property
|
|
def doctrine(self) -> Doctrine:
|
|
return self.coalition.doctrine
|
|
|
|
@property
|
|
def threat_zones(self) -> ThreatZones:
|
|
return self.coalition.opponent.threat_zone
|