From 37f2e5bf3aa241ba3defe1198274a6a4e41e0eda Mon Sep 17 00:00:00 2001 From: Raffson Date: Sun, 1 Jan 2023 16:53:18 +0100 Subject: [PATCH] Use stacking algorithm in "_generate_over_departure" Resolves #57 "_generate_over_departure" is the method used to generate flights in the air when no more parking spots are available. Pydcs changes were required as it turned out aircraft were trying to spawn on helicopter parking spots, which forces them to start in the air by DCS itself. --- game/missiongenerator/aircraft/flightgroupspawner.py | 7 +++++-- requirements.txt | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/game/missiongenerator/aircraft/flightgroupspawner.py b/game/missiongenerator/aircraft/flightgroupspawner.py index b76022fd..0360f7ab 100644 --- a/game/missiongenerator/aircraft/flightgroupspawner.py +++ b/game/missiongenerator/aircraft/flightgroupspawner.py @@ -135,7 +135,6 @@ class FlightGroupSpawner: "No room on runway or parking slots. Starting from the air." ) group = self._generate_over_departure(name, cp) - group.points[0].alt = 1500 return group def generate_mid_mission(self) -> FlyingGroup[Any]: @@ -208,7 +207,11 @@ class FlightGroupSpawner: elif self.flight.unit_type.helicopter: alt = WARM_START_HELI_ALT else: - alt = WARM_START_ALTITUDE + if origin.id not in self.mission_data.cp_stack: + min_alt = MINIMUM_MID_MISSION_SPAWN_ALTITUDE_AGL + self.mission_data.cp_stack[origin.id] = min_alt + alt = self.mission_data.cp_stack[origin.id] + self.mission_data.cp_stack[origin.id] += STACK_SEPARATION speed = GroundSpeed.for_flight(self.flight, alt) pos = at + Vector2(random.randint(100, 1000), random.randint(100, 1000)) diff --git a/requirements.txt b/requirements.txt index 0dd5d4d2..8c084db3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -31,7 +31,7 @@ platformdirs==2.5.4 pluggy==1.0.0 pre-commit==2.20.0 pydantic==1.10.2 --e git+https://github.com/dcs-retribution/pydcs@fb1fefcb32fbab82ac36b8519b87bae32326784e#egg=pydcs +-e git+https://github.com/dcs-retribution/pydcs@1016e803396f676471286f928577d97d717352a4#egg=pydcs pyinstaller==5.6.2 pyinstaller-hooks-contrib==2022.13 pyparsing==3.0.9