mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Avoid refuel waypoint if air wing can't plan refuel flight
This commit is contained in:
parent
b870198281
commit
ea74471307
@ -86,29 +86,17 @@ class Builder(FormationAttackBuilder[EscortFlightPlan, FormationAttackLayout]):
|
|||||||
else ingress_alt,
|
else ingress_alt,
|
||||||
)
|
)
|
||||||
|
|
||||||
refuel = None
|
refuel = self._build_refuel(builder)
|
||||||
if not self.flight.is_helo:
|
|
||||||
refuel = builder.refuel(self.package.waypoints.refuel)
|
|
||||||
|
|
||||||
departure = builder.takeoff(self.flight.departure)
|
departure = builder.takeoff(self.flight.departure)
|
||||||
if hold:
|
|
||||||
nav_to = builder.nav_path(
|
nav_to = builder.nav_path(
|
||||||
hold.position, join.position, self.doctrine.ingress_altitude
|
hold.position if hold else departure.position,
|
||||||
)
|
join.position,
|
||||||
else:
|
|
||||||
nav_to = builder.nav_path(
|
|
||||||
departure.position, join.position, self.doctrine.ingress_altitude
|
|
||||||
)
|
|
||||||
|
|
||||||
if refuel:
|
|
||||||
nav_from = builder.nav_path(
|
|
||||||
refuel.position,
|
|
||||||
self.flight.arrival.position,
|
|
||||||
self.doctrine.ingress_altitude,
|
self.doctrine.ingress_altitude,
|
||||||
)
|
)
|
||||||
else:
|
|
||||||
nav_from = builder.nav_path(
|
nav_from = builder.nav_path(
|
||||||
split.position,
|
refuel.position if refuel else split.position,
|
||||||
self.flight.arrival.position,
|
self.flight.arrival.position,
|
||||||
self.doctrine.ingress_altitude,
|
self.doctrine.ingress_altitude,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -191,7 +191,7 @@ class FormationAttackBuilder(IBuilder[FlightPlanT, LayoutT], ABC):
|
|||||||
hold = builder.hold(self._hold_point())
|
hold = builder.hold(self._hold_point())
|
||||||
join = builder.join(self.package.waypoints.join)
|
join = builder.join(self.package.waypoints.join)
|
||||||
split = builder.split(self.package.waypoints.split)
|
split = builder.split(self.package.waypoints.split)
|
||||||
refuel = builder.refuel(self.package.waypoints.refuel)
|
refuel = self._build_refuel(builder)
|
||||||
|
|
||||||
ingress = builder.ingress(
|
ingress = builder.ingress(
|
||||||
ingress_type, self.package.waypoints.ingress, self.package.target
|
ingress_type, self.package.waypoints.ingress, self.package.target
|
||||||
@ -225,7 +225,7 @@ class FormationAttackBuilder(IBuilder[FlightPlanT, LayoutT], ABC):
|
|||||||
split=split,
|
split=split,
|
||||||
refuel=refuel,
|
refuel=refuel,
|
||||||
nav_from=builder.nav_path(
|
nav_from=builder.nav_path(
|
||||||
refuel.position,
|
refuel.position if refuel else split.position,
|
||||||
self.flight.arrival.position,
|
self.flight.arrival.position,
|
||||||
self.doctrine.ingress_altitude,
|
self.doctrine.ingress_altitude,
|
||||||
),
|
),
|
||||||
@ -234,6 +234,13 @@ class FormationAttackBuilder(IBuilder[FlightPlanT, LayoutT], ABC):
|
|||||||
bullseye=builder.bullseye(),
|
bullseye=builder.bullseye(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def _build_refuel(self, builder: WaypointBuilder) -> Optional[FlightWaypoint]:
|
||||||
|
refuel: Optional[FlightWaypoint] = None
|
||||||
|
can_plan = self.flight.coalition.air_wing.can_auto_plan(FlightType.REFUELING)
|
||||||
|
if not self.flight.is_helo and can_plan and self.package.waypoints:
|
||||||
|
refuel = builder.refuel(self.package.waypoints.refuel)
|
||||||
|
return refuel
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def primary_flight_is_air_assault(self) -> bool:
|
def primary_flight_is_air_assault(self) -> bool:
|
||||||
if self.flight is self.package.primary_flight:
|
if self.flight is self.package.primary_flight:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user