diff --git a/changelog.md b/changelog.md index fb4c0d8d..cee916e4 100644 --- a/changelog.md +++ b/changelog.md @@ -26,6 +26,7 @@ * **[Plugins]** EW Script - Fix radar detection routine. * **[Campaign]** Fixed a bug where sinking a destroyer in a carrier group would cause squadrons to be removed from the carrier * **[Engine]** Fixed a bug with transfers to Helipads +* **[Engine]** Fixed a bug with parking allocation # Retribution v1.4.1 (hotfix) diff --git a/game/missiongenerator/aircraft/aircraftgenerator.py b/game/missiongenerator/aircraft/aircraftgenerator.py index 5974b87f..6f4cc57c 100644 --- a/game/missiongenerator/aircraft/aircraftgenerator.py +++ b/game/missiongenerator/aircraft/aircraftgenerator.py @@ -104,6 +104,23 @@ class AircraftGenerator: for parking_slot in cp.parking_slots: parking_slot.unit_id = None + def _prioritized_packages(self, ato: AirTaskingOrder) -> List[Package]: + """Returns the packages in the order they should be generated.""" + return sorted( + ato.packages, + key=lambda p: ( + ( + 1 + if any( + f.flight_type in [FlightType.AEWC, FlightType.REFUELING] + for f in p.flights + ) + else 0 + ), + p.time_over_target, + ), + ) + def generate_flights( self, country: Country, @@ -124,7 +141,7 @@ class AircraftGenerator: self._reserve_frequencies_and_tacan(ato) self.mission_data.packages.clear() - for package in reversed(sorted(ato.packages, key=lambda x: x.time_over_target)): + for package in reversed(self._prioritized_packages(ato)): logging.info(f"Generating package for target: {package.target.name}") if not package.flights: continue diff --git a/requirements.txt b/requirements.txt index 4113b9d8..948a7098 100644 --- a/requirements.txt +++ b/requirements.txt @@ -33,7 +33,7 @@ pluggy==1.5.0 pre-commit==4.2.0 pydantic==2.11.0b2 pydantic-settings==2.8.1 -pydcs @ git+https://github.com/dcs-retribution/pydcs@f50627d79c1b24786139eed3a35329d55a03cef5 +pydcs @ git+https://github.com/dcs-retribution/pydcs@60cddd944d454f59f5c866a2ec2ae3e91526da25 pyinstaller==5.13.2 pyinstaller-hooks-contrib==2024.0 pyparsing==3.2.1