From 93f3e81cfc4875a658b0108400ba839914a06d24 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Sat, 19 Nov 2022 13:01:43 -0800 Subject: [PATCH] Fix layout for TARCAP, Escort, and strike-like. If there's a refuel point, nav from that, not from the patrol end/split. Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1749. --- game/ato/flightplans/escort.py | 6 ++---- game/ato/flightplans/formationattack.py | 6 ++---- game/ato/flightplans/tarcap.py | 4 +++- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/game/ato/flightplans/escort.py b/game/ato/flightplans/escort.py index f07d3e63..a176fd40 100644 --- a/game/ato/flightplans/escort.py +++ b/game/ato/flightplans/escort.py @@ -27,9 +27,7 @@ class Builder(FormationAttackBuilder[EscortFlightPlan, FormationAttackLayout]): hold = builder.hold(self._hold_point()) join = builder.join(self.package.waypoints.join) split = builder.split(self.package.waypoints.split) - refuel = None - if self.package.waypoints.refuel is not None: - refuel = builder.refuel(self.package.waypoints.refuel) + refuel = builder.refuel(self.package.waypoints.refuel) return FormationAttackLayout( departure=builder.takeoff(self.flight.departure), @@ -43,7 +41,7 @@ class Builder(FormationAttackBuilder[EscortFlightPlan, FormationAttackLayout]): split=split, refuel=refuel, nav_from=builder.nav_path( - split.position, + refuel.position, self.flight.arrival.position, self.doctrine.ingress_altitude, ), diff --git a/game/ato/flightplans/formationattack.py b/game/ato/flightplans/formationattack.py index 9a0c6ed3..9c55fcac 100644 --- a/game/ato/flightplans/formationattack.py +++ b/game/ato/flightplans/formationattack.py @@ -181,9 +181,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 = None - if self.package.waypoints.refuel is not None: - refuel = builder.refuel(self.package.waypoints.refuel) + refuel = builder.refuel(self.package.waypoints.refuel) return FormationAttackLayout( departure=builder.takeoff(self.flight.departure), @@ -199,7 +197,7 @@ class FormationAttackBuilder(IBuilder[FlightPlanT, LayoutT], ABC): split=split, refuel=refuel, nav_from=builder.nav_path( - split.position, + refuel.position, self.flight.arrival.position, self.doctrine.ingress_altitude, ), diff --git a/game/ato/flightplans/tarcap.py b/game/ato/flightplans/tarcap.py index 1ae46967..560ef0d7 100644 --- a/game/ato/flightplans/tarcap.py +++ b/game/ato/flightplans/tarcap.py @@ -105,9 +105,11 @@ class Builder(CapBuilder[TarCapFlightPlan, TarCapLayout]): start, end = builder.race_track(orbit0p, orbit1p, patrol_alt) refuel = None + nav_from_origin = orbit1p if self.package.waypoints is not None: refuel = builder.refuel(self.package.waypoints.refuel) + nav_from_origin = refuel.position return TarCapLayout( departure=builder.takeoff(self.flight.departure), @@ -115,7 +117,7 @@ class Builder(CapBuilder[TarCapFlightPlan, TarCapLayout]): self.flight.departure.position, orbit0p, patrol_alt ), nav_from=builder.nav_path( - orbit1p, self.flight.arrival.position, patrol_alt + nav_from_origin, self.flight.arrival.position, patrol_alt ), patrol_start=start, patrol_end=end,