Change squadrons to operate out of a single base.

https://github.com/dcs-liberation/dcs_liberation/issues/1145

Currently this is fixed at the start of the campaign. The squadron
locations are defined by the campaign file.

Follow up work:

* Track aircraft ownership per-squadron rather than per-airbase.
* UI for relocating squadrons.
* Ferry missions for squadrons that are relocating.
* Auto-relocation (probably only for retreat handling).

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1138
This commit is contained in:
Dan Albert
2021-08-07 21:51:18 -07:00
parent 51e056a765
commit 90ad1f4a61
51 changed files with 1043 additions and 652 deletions

View File

@@ -1,13 +0,0 @@
from .aircraft import *
from .armor import *
from .airsupportgen import *
from .conflictgen import *
from .visualgen import *
from .triggergen import *
from .environmentgen import *
from .groundobjectsgen import *
from .briefinggen import *
from .forcedoptionsgen import *
from .kneeboard import *
from . import naming

View File

@@ -69,7 +69,6 @@ from game.data.weapons import Pylon, WeaponType as WeaponTypeEnum
from game.dcs.aircrafttype import AircraftType
from game.factions.faction import Faction
from game.settings import Settings
from game.squadrons import Pilot
from game.theater.controlpoint import (
Airfield,
ControlPoint,
@@ -109,6 +108,7 @@ from .naming import namegen
if TYPE_CHECKING:
from game import Game
from game.squadrons import Pilot
WARM_START_HELI_ALT = meters(500)
WARM_START_ALTITUDE = meters(3000)

View File

@@ -5,7 +5,8 @@ from datetime import timedelta
from typing import Optional, TYPE_CHECKING
if TYPE_CHECKING:
from gen import RadioFrequency, TacanChannel
from gen.radios import RadioFrequency
from gen.tacan import TacanChannel
@dataclass

View File

@@ -16,8 +16,7 @@ from dcs.task import (
from dcs.unittype import UnitType
from game.utils import Heading
from . import AirSupport
from .airsupport import TankerInfo, AwacsInfo
from .airsupport import AirSupport, TankerInfo, AwacsInfo
from .callsigns import callsign_for_support_unit
from .conflictgen import Conflict
from .flights.ai_flight_planner_db import AEWC_CAPABLE

View File

@@ -2,20 +2,19 @@ from __future__ import annotations
from datetime import timedelta
from enum import Enum
from typing import List, Optional, TYPE_CHECKING, Union, Sequence, Any
from typing import List, Optional, TYPE_CHECKING, Union, Sequence
from dcs.mapping import Point
from dcs.point import MovingPoint, PointAction
from dcs.unit import Unit
from game.dcs.aircrafttype import AircraftType
from game.savecompat import has_save_compat_for
from game.squadrons import Pilot, Squadron
from game.theater.controlpoint import ControlPoint, MissionTarget
from game.utils import Distance, meters
from gen.flights.loadouts import Loadout
if TYPE_CHECKING:
from game.squadrons import Pilot, Squadron
from game.transfers import TransferOrder
from gen.ato import Package
from gen.flights.flightplan import FlightPlan
@@ -50,6 +49,8 @@ class FlightType(Enum):
strike-like missions will need more specialized control.
* ai_flight_planner.py: Use the new mission type in propose_missions so the AI will
plan the new mission type.
* FlightType.is_air_to_air and FlightType.is_air_to_ground: If the new mission type
fits either of these categories, update those methods accordingly.
"""
TARCAP = "TARCAP"
@@ -80,6 +81,30 @@ class FlightType(Enum):
return entry
raise KeyError(f"No FlightType with name {name}")
@property
def is_air_to_air(self) -> bool:
return self in {
FlightType.TARCAP,
FlightType.BARCAP,
FlightType.INTERCEPTION,
FlightType.ESCORT,
FlightType.SWEEP,
}
@property
def is_air_to_ground(self) -> bool:
return self in {
FlightType.CAS,
FlightType.STRIKE,
FlightType.ANTISHIP,
FlightType.SEAD,
FlightType.DEAD,
FlightType.BAI,
FlightType.OCA_RUNWAY,
FlightType.OCA_AIRCRAFT,
FlightType.SEAD_ESCORT,
}
class FlightWaypointType(Enum):
"""Enumeration of waypoint types.
@@ -169,12 +194,6 @@ class FlightWaypoint:
self.tot: Optional[timedelta] = None
self.departure_time: Optional[timedelta] = None
@has_save_compat_for(5)
def __setstate__(self, state: dict[str, Any]) -> None:
if "min_fuel" not in state:
state["min_fuel"] = None
self.__dict__.update(state)
@property
def position(self) -> Point:
return Point(self.x, self.y)

View File

@@ -1,12 +1,16 @@
from __future__ import annotations
import random
import time
from typing import List, Any
from typing import List, Any, TYPE_CHECKING
from dcs.country import Country
from game.dcs.aircrafttype import AircraftType
from game.dcs.unittype import UnitType
from gen.flights.flight import Flight
if TYPE_CHECKING:
from gen.flights.flight import Flight
ALPHA_MILITARY = [
"Alpha",