diff --git a/changelog.md b/changelog.md index ad44b641..331710ee 100644 --- a/changelog.md +++ b/changelog.md @@ -32,6 +32,7 @@ Saves from 6.x are not compatible with 7.0. * **[Modding]** Fixed decoding of campaign yaml files to use UTF-8 rather than the system locale's default. It's now possible to use "Bf 109 K-4 Kurfürst" as a preferred aircraft type. * **[Mission Generation]** Planes will no longer spawn in helipads that are not also designated for fixed wing parking. * **[Mission Generation]** Potentially an issue where ground war planning game state could become corrupted, preventing mission generation. +* **[Mission Generation]** Refueling tasks will now only be created for flights that have a tanker in their package. # 6.1.1 diff --git a/game/ato/package.py b/game/ato/package.py index d9b10906..a7a3469a 100644 --- a/game/ato/package.py +++ b/game/ato/package.py @@ -225,3 +225,7 @@ class Package: if not flight.state.is_waiting_for_start: return False return True + + def has_flight_with_task(self, task: FlightType) -> bool: + """Returns True if any flight in the package has the given task.""" + return task in (f.flight_type for f in self.flights) diff --git a/game/missiongenerator/aircraft/waypoints/refuel.py b/game/missiongenerator/aircraft/waypoints/refuel.py index c87036f8..1fbc7d5d 100644 --- a/game/missiongenerator/aircraft/waypoints/refuel.py +++ b/game/missiongenerator/aircraft/waypoints/refuel.py @@ -1,9 +1,12 @@ from dcs.point import MovingPoint from dcs.task import RefuelingTaskAction + +from game.ato import FlightType from .pydcswaypointbuilder import PydcsWaypointBuilder class RefuelPointBuilder(PydcsWaypointBuilder): def add_tasks(self, waypoint: MovingPoint) -> None: - waypoint.add_task(RefuelingTaskAction()) + if self.package.has_flight_with_task(FlightType.REFUELING): + waypoint.add_task(RefuelingTaskAction()) return super().add_tasks(waypoint)