mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Allow deleting waypoints.
In almost every case this leaves us with a flight plan we can't reason about, so it gets degraded to `CustomFlightPlan`. The exception is when deleting a target point when there are other target points remaining. This probably gets people using this feature back to what they want though, which is essentially the 2.1 behavior. Fixes https://github.com/Khopa/dcs_liberation/issues/393
This commit is contained in:
@@ -96,6 +96,11 @@ class TotEstimator:
|
||||
|
||||
def mission_start_time(self, flight: Flight) -> timedelta:
|
||||
takeoff_time = self.takeoff_time_for_flight(flight)
|
||||
if takeoff_time is None:
|
||||
# Could not determine takeoff time, probably due to a custom flight
|
||||
# plan. Start immediately.
|
||||
return timedelta()
|
||||
|
||||
startup_time = self.estimate_startup(flight)
|
||||
ground_ops_time = self.estimate_ground_ops(flight)
|
||||
start_time = takeoff_time - startup_time - ground_ops_time
|
||||
@@ -110,13 +115,12 @@ class TotEstimator:
|
||||
# Round down so *barely* above zero start times are just zero.
|
||||
return timedelta(seconds=math.floor(start_time.total_seconds()))
|
||||
|
||||
def takeoff_time_for_flight(self, flight: Flight) -> timedelta:
|
||||
def takeoff_time_for_flight(self, flight: Flight) -> Optional[timedelta]:
|
||||
travel_time = self.travel_time_to_rendezvous_or_target(flight)
|
||||
if travel_time is None:
|
||||
logging.warning("Found no join point or patrol point. Cannot "
|
||||
logging.warning("Found no rendezvous or target point. Cannot "
|
||||
f"estimate takeoff time takeoff time for {flight}")
|
||||
# Takeoff immediately.
|
||||
return timedelta()
|
||||
return None
|
||||
|
||||
from gen.flights.flightplan import FormationFlightPlan
|
||||
if isinstance(flight.flight_plan, FormationFlightPlan):
|
||||
@@ -126,7 +130,7 @@ class TotEstimator:
|
||||
logging.warning(
|
||||
"Could not determine the TOT of the join point. Takeoff "
|
||||
f"time for {flight} will be immediate.")
|
||||
return timedelta()
|
||||
return None
|
||||
else:
|
||||
tot = self.package.time_over_target
|
||||
return tot - travel_time - self.HOLD_TIME
|
||||
|
||||
Reference in New Issue
Block a user