From 2a79e4a4e5e45f62cc2ffc509cdf61e0de8c59a4 Mon Sep 17 00:00:00 2001 From: MetalStormGhost <89945461+MetalStormGhost@users.noreply.github.com> Date: Thu, 14 Oct 2021 03:10:17 +0300 Subject: [PATCH] Force carrier planes to start at +1s (#1600) Forces carrier planes with original start_time of zero seconds to have a start time of 1 second. This will prevent them from spawning on the 'sixpack' and functions as a workaround for a DCS problem (deadlock / traffic jam). Fixes #1309. --- gen/flights/flightplan.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/gen/flights/flightplan.py b/gen/flights/flightplan.py index e471e44c..475442d0 100644 --- a/gen/flights/flightplan.py +++ b/gen/flights/flightplan.py @@ -245,19 +245,30 @@ class FlightPlan: if takeoff_time is None: return None - start_time = takeoff_time - self.estimate_startup() - self.estimate_ground_ops() + start_time: timedelta = ( + takeoff_time - self.estimate_startup() - self.estimate_ground_ops() + ) # In case FP math has given us some barely below zero time, round to # zero. if math.isclose(start_time.total_seconds(), 0): - return timedelta() + start_time = timedelta() # Trim microseconds. DCS doesn't handle sub-second resolution for tasks, # and they're not interesting from a mission planning perspective so we # don't want them in the UI. # # Round down so *barely* above zero start times are just zero. - return timedelta(seconds=math.floor(start_time.total_seconds())) + start_time = timedelta(seconds=math.floor(start_time.total_seconds())) + + # Feature request #1309: Carrier planes should start at +1s + # This is a workaround to a DCS problem: some AI planes spawn on + # the 'sixpack' when start_time is zero and cause a deadlock. + # Workaround: force the start_time to 1 second for these planes. + if self.flight.from_cp.is_fleet and start_time.total_seconds() == 0: + start_time = timedelta(seconds=1) + + return start_time def estimate_startup(self) -> timedelta: if self.flight.start_type == "Cold":