mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Improve AI SEAD capabilities
This commit is contained in:
@@ -190,6 +190,10 @@ class FormationAttackBuilder(IBuilder[FlightPlanT, LayoutT], ABC):
|
||||
ingress_type, self.package.waypoints.ingress, self.package.target
|
||||
)
|
||||
|
||||
initial = None
|
||||
if ingress_type == FlightWaypointType.INGRESS_SEAD:
|
||||
initial = builder.sead_search(self.package.target)
|
||||
|
||||
return FormationAttackLayout(
|
||||
departure=builder.takeoff(self.flight.departure),
|
||||
hold=hold,
|
||||
@@ -198,6 +202,7 @@ class FormationAttackBuilder(IBuilder[FlightPlanT, LayoutT], ABC):
|
||||
),
|
||||
join=join,
|
||||
ingress=ingress,
|
||||
initial=initial,
|
||||
targets=target_waypoints,
|
||||
split=split,
|
||||
refuel=refuel,
|
||||
|
||||
@@ -290,12 +290,9 @@ class WaypointBuilder:
|
||||
return self._target_area(f"STRIKE {target.name}", target)
|
||||
|
||||
def sead_area(self, target: MissionTarget) -> FlightWaypoint:
|
||||
# Set flyover with ingress altitude to allow the flight to search and engage
|
||||
# the target group at the ingress alt without suicide dive
|
||||
return self._target_area(
|
||||
f"SEAD on {target.name}",
|
||||
target,
|
||||
flyover=True,
|
||||
altitude=self.doctrine.ingress_altitude,
|
||||
alt_type="BARO",
|
||||
)
|
||||
@@ -316,8 +313,8 @@ class WaypointBuilder:
|
||||
# plan.
|
||||
return self._target_area(f"ASSAULT {target.name}", target)
|
||||
|
||||
@staticmethod
|
||||
def _target_area(
|
||||
self,
|
||||
name: str,
|
||||
location: MissionTarget,
|
||||
flyover: bool = False,
|
||||
@@ -425,6 +422,29 @@ class WaypointBuilder:
|
||||
pretty_name="Orbit",
|
||||
)
|
||||
|
||||
def sead_search(self, target: MissionTarget) -> FlightWaypoint:
|
||||
"""Creates custom waypoint for AI SEAD flights
|
||||
to avoid having them fly all the way to the SAM site.
|
||||
Args:
|
||||
target: Target information.
|
||||
"""
|
||||
# Use the threat range as offset distance to avoid flying all the way to the SAM site
|
||||
assert self.flight.package.waypoints
|
||||
ingress = self.flight.package.waypoints.ingress
|
||||
threat_range = 1.1 * max([x.threat_range for x in target.strike_targets]).meters
|
||||
hdg = target.position.heading_between_point(ingress)
|
||||
hold = target.position.point_from_heading(hdg, threat_range)
|
||||
|
||||
return FlightWaypoint(
|
||||
"SEAD Search",
|
||||
FlightWaypointType.CUSTOM,
|
||||
hold,
|
||||
self.doctrine.ingress_altitude,
|
||||
alt_type="BARO",
|
||||
description="Anchor and search from this point",
|
||||
pretty_name="SEAD Search",
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def escort_hold(start: Point, altitude: Distance) -> FlightWaypoint:
|
||||
"""Creates custom waypoint for escort flights that need to hold.
|
||||
|
||||
Reference in New Issue
Block a user