mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
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.
This commit is contained in:
parent
7f948465a4
commit
2a79e4a4e5
@ -245,19 +245,30 @@ class FlightPlan:
|
|||||||
if takeoff_time is None:
|
if takeoff_time is None:
|
||||||
return 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
|
# In case FP math has given us some barely below zero time, round to
|
||||||
# zero.
|
# zero.
|
||||||
if math.isclose(start_time.total_seconds(), 0):
|
if math.isclose(start_time.total_seconds(), 0):
|
||||||
return timedelta()
|
start_time = timedelta()
|
||||||
|
|
||||||
# Trim microseconds. DCS doesn't handle sub-second resolution for tasks,
|
# Trim microseconds. DCS doesn't handle sub-second resolution for tasks,
|
||||||
# and they're not interesting from a mission planning perspective so we
|
# and they're not interesting from a mission planning perspective so we
|
||||||
# don't want them in the UI.
|
# don't want them in the UI.
|
||||||
#
|
#
|
||||||
# Round down so *barely* above zero start times are just zero.
|
# 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:
|
def estimate_startup(self) -> timedelta:
|
||||||
if self.flight.start_type == "Cold":
|
if self.flight.start_type == "Cold":
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user