From 07de598aec2841dcc54f2105c11431debdf79444 Mon Sep 17 00:00:00 2001 From: MetalStormGhost Date: Sun, 4 Sep 2022 14:40:18 +0300 Subject: [PATCH] Enabled SEAD Escort missions to be tasked on Naval targets and OCA/Aircraft missions on FARPs. When SEAD Escorts are tasked on Naval groups, they will also target ships. --- .../aircraft/waypoints/joinpoint.py | 16 +++++++++++++--- game/theater/controlpoint.py | 6 +++++- game/theater/theatergroundobject.py | 5 ++++- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/game/missiongenerator/aircraft/waypoints/joinpoint.py b/game/missiongenerator/aircraft/waypoints/joinpoint.py index 59fe56ab..a30f426d 100644 --- a/game/missiongenerator/aircraft/waypoints/joinpoint.py +++ b/game/missiongenerator/aircraft/waypoints/joinpoint.py @@ -11,6 +11,7 @@ from dcs.task import ( ) from game.ato import FlightType +from game.theater import NavalControlPoint from game.utils import nautical_miles from .pydcswaypointbuilder import PydcsWaypointBuilder @@ -32,9 +33,18 @@ class JoinPointBuilder(PydcsWaypointBuilder): waypoint.tasks.append(OptFormation.spread_four_open()) elif self.flight.flight_type == FlightType.SEAD_ESCORT: - self.configure_escort_tasks( - waypoint, [Targets.All.GroundUnits.AirDefence.AAA.SAMRelated] - ) + if isinstance(self.flight.package.target, NavalControlPoint): + self.configure_escort_tasks( + waypoint, + [ + Targets.All.Naval, + Targets.All.GroundUnits.AirDefence.AAA.SAMRelated, + ], + ) + else: + self.configure_escort_tasks( + waypoint, [Targets.All.GroundUnits.AirDefence.AAA.SAMRelated] + ) # Let the AI use ECM to preemptively defend themselves. ecm_option = OptECMUsing(value=OptECMUsing.Values.UseIfDetectedLockByRadar) diff --git a/game/theater/controlpoint.py b/game/theater/controlpoint.py index 8a3bdcdd..c23f158b 100644 --- a/game/theater/controlpoint.py +++ b/game/theater/controlpoint.py @@ -1176,7 +1176,10 @@ class NavalControlPoint(ControlPoint, ABC): # TODO: Inter-ship logistics? ] else: - yield FlightType.ANTISHIP + yield from [ + FlightType.ANTISHIP, + FlightType.SEAD_ESCORT, + ] yield from super().mission_types(for_player) @property @@ -1424,6 +1427,7 @@ class Fob(ControlPoint): if not self.is_friendly(for_player): yield FlightType.STRIKE yield FlightType.AIR_ASSAULT + yield FlightType.OCA_AIRCRAFT yield from super().mission_types(for_player) diff --git a/game/theater/theatergroundobject.py b/game/theater/theatergroundobject.py index 9a0a2013..479a8144 100644 --- a/game/theater/theatergroundobject.py +++ b/game/theater/theatergroundobject.py @@ -350,7 +350,10 @@ class NavalGroundObject(TheaterGroundObject, ABC): from game.ato import FlightType if not self.is_friendly(for_player): - yield FlightType.ANTISHIP + yield from [ + FlightType.ANTISHIP, + FlightType.SEAD_ESCORT, + ] yield from super().mission_types(for_player) @property