diff --git a/changelog.md b/changelog.md index 4a2c6557..0331f686 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,7 @@ ## Features/Improvements * **[Mission Generation]** Given a CAS flight was planned, delay ground force attack until first CAS flight is on station +* **[Mission Generation]** Add option to switch ATFLIR to LITENING automatically for ground based F-18C flights ## Fixes * **[UI]** Removed deprecated options diff --git a/game/ato/flight.py b/game/ato/flight.py index db1b5418..ee8625b5 100644 --- a/game/ato/flight.py +++ b/game/ato/flight.py @@ -5,12 +5,12 @@ from datetime import datetime, timedelta from typing import Any, List, Optional, TYPE_CHECKING from dcs import Point -from dcs.planes import C_101CC, C_101EB, Su_33 +from dcs.planes import C_101CC, C_101EB, Su_33, FA_18C_hornet from .flightroster import FlightRoster from .flightstate import FlightState, Navigating, Uninitialized from .flightstate.killed import Killed -from .loadouts import Loadout +from .loadouts import Loadout, Weapon from ..sidc import ( Entity, SidcDescribable, @@ -32,6 +32,8 @@ if TYPE_CHECKING: from .package import Package from .starttype import StartType +F18_TGP_PYLON: int = 4 + class Flight(SidcDescribable): def __init__( @@ -87,6 +89,15 @@ class Flight(SidcDescribable): self._flight_plan_builder = FlightPlanBuilderTypes.for_flight(self)(self) + is_f18 = self.squadron.aircraft.dcs_unit_type.id == FA_18C_hornet.id + on_land = not self.squadron.location.is_fleet + if on_land and is_f18 and self.coalition.game.settings.atflir_autoswap: + self.loadout.pylons[F18_TGP_PYLON] = Weapon.with_clsid( + str( + FA_18C_hornet.Pylon4.AN_AAQ_28_LITENING___Targeting_Pod_[1]["clsid"] + ) + ) + @property def flight_plan(self) -> FlightPlan[Any]: return self._flight_plan_builder.get_or_build() diff --git a/game/ato/loadouts.py b/game/ato/loadouts.py index ace075d1..2cf9ae2d 100644 --- a/game/ato/loadouts.py +++ b/game/ato/loadouts.py @@ -3,7 +3,7 @@ from __future__ import annotations import datetime import logging from collections.abc import Iterable -from typing import Iterator, Mapping, Optional, TYPE_CHECKING, Type, Dict +from typing import Iterator, Optional, TYPE_CHECKING, Type, Dict from dcs.unittype import FlyingType @@ -19,14 +19,14 @@ class Loadout: def __init__( self, name: str, - pylons: Mapping[int, Optional[Weapon]], + pylons: Dict[int, Optional[Weapon]], date: Optional[datetime.date], is_custom: bool = False, ) -> None: self.name = name # We clear unused pylon entries on initialization, but UI actions can still # cause a pylon to be emptied, so make the optional type explicit. - self.pylons: Mapping[int, Optional[Weapon]] = { + self.pylons: Dict[int, Optional[Weapon]] = { k: v for k, v in pylons.items() if v is not None } self.date = date diff --git a/game/settings/settings.py b/game/settings/settings.py index c6642994..9b6fede1 100644 --- a/game/settings/settings.py +++ b/game/settings/settings.py @@ -173,30 +173,6 @@ class Settings: "extremely incomplete so does not affect all weapons." ), ) - disable_legacy_aewc: bool = boolean_option( - "Spawn invulnerable, always-available AEW&C aircraft (deprecated)", - page=CAMPAIGN_MANAGEMENT_PAGE, - section=GENERAL_SECTION, - default=True, - invert=True, - detail=( - "If checked, an invulnerable friendly AEW&C aircraft that begins the " - "mission on station will be be spawned. This behavior will be removed in a " - "future release." - ), - ) - disable_legacy_tanker: bool = boolean_option( - "Spawn invulnerable, always-available tanker aircraft (deprecated)", - page=CAMPAIGN_MANAGEMENT_PAGE, - section=GENERAL_SECTION, - default=True, - invert=True, - detail=( - "If checked, an invulnerable friendly tanker aircraft that begins the " - "mission on station will be be spawned. This behavior will be removed in a " - "future release." - ), - ) # Pilots and Squadrons ai_pilot_levelling: bool = boolean_option( "Allow AI pilot leveling", @@ -379,6 +355,16 @@ class Settings: "option only allows the player to wait on the ground." ), ) + atflir_autoswap: bool = boolean_option( + "Auto-swap ATFLIR to LITENING", + MISSION_GENERATOR_PAGE, + GAMEPLAY_SECTION, + default=True, + detail=( + "Automatically swaps ATFLIR to LITENING pod for newly generated land-based F-18 flights " + "without having to change the payload. Takes effect after current turn!" + ), + ) default_start_type: StartType = choices_option( "Default start type for AI aircraft", page=MISSION_GENERATOR_PAGE,