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,32 +86,20 @@ class Builder(FormationAttackBuilder[EscortFlightPlan, FormationAttackLayout]):
|
||||
else ingress_alt,
|
||||
)
|
||||
|
||||
refuel = None
|
||||
if not self.flight.is_helo:
|
||||
refuel = builder.refuel(self.package.waypoints.refuel)
|
||||
refuel = self._build_refuel(builder)
|
||||
|
||||
departure = builder.takeoff(self.flight.departure)
|
||||
if hold:
|
||||
nav_to = builder.nav_path(
|
||||
hold.position, join.position, self.doctrine.ingress_altitude
|
||||
)
|
||||
else:
|
||||
nav_to = builder.nav_path(
|
||||
departure.position, join.position, self.doctrine.ingress_altitude
|
||||
)
|
||||
nav_to = builder.nav_path(
|
||||
hold.position if hold else 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,
|
||||
)
|
||||
else:
|
||||
nav_from = builder.nav_path(
|
||||
split.position,
|
||||
self.flight.arrival.position,
|
||||
self.doctrine.ingress_altitude,
|
||||
)
|
||||
nav_from = builder.nav_path(
|
||||
refuel.position if refuel else split.position,
|
||||
self.flight.arrival.position,
|
||||
self.doctrine.ingress_altitude,
|
||||
)
|
||||
|
||||
return FormationAttackLayout(
|
||||
departure=departure,
|
||||
|
||||
@ -191,7 +191,7 @@ class FormationAttackBuilder(IBuilder[FlightPlanT, LayoutT], ABC):
|
||||
hold = builder.hold(self._hold_point())
|
||||
join = builder.join(self.package.waypoints.join)
|
||||
split = builder.split(self.package.waypoints.split)
|
||||
refuel = builder.refuel(self.package.waypoints.refuel)
|
||||
refuel = self._build_refuel(builder)
|
||||
|
||||
ingress = builder.ingress(
|
||||
ingress_type, self.package.waypoints.ingress, self.package.target
|
||||
@ -225,7 +225,7 @@ class FormationAttackBuilder(IBuilder[FlightPlanT, LayoutT], ABC):
|
||||
split=split,
|
||||
refuel=refuel,
|
||||
nav_from=builder.nav_path(
|
||||
refuel.position,
|
||||
refuel.position if refuel else split.position,
|
||||
self.flight.arrival.position,
|
||||
self.doctrine.ingress_altitude,
|
||||
),
|
||||
@ -234,6 +234,13 @@ class FormationAttackBuilder(IBuilder[FlightPlanT, LayoutT], ABC):
|
||||
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
|
||||
def primary_flight_is_air_assault(self) -> bool:
|
||||
if self.flight is self.package.primary_flight:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user