From 6ff3a34c14c05b7ae58e9299845d54bc0b872999 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 88d0625b..8a81ade9 100644 --- a/game/ato/flightplans/escort.py +++ b/game/ato/flightplans/escort.py @@ -31,9 +31,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) initial = None if self.package.primary_task == FlightType.STRIKE: initial = builder.escort_hold( @@ -53,7 +51,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 82bc6d31..773dc4c6 100644 --- a/game/ato/flightplans/formationattack.py +++ b/game/ato/flightplans/formationattack.py @@ -184,9 +184,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) ingress = builder.ingress( ingress_type, self.package.waypoints.ingress, self.package.target @@ -213,7 +211,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,