mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Fixed a FrontLine import bug in flightplanbuilder.py (#72)
Restored the default patrol duration handling in PackageRefuelingFlightPlan. Desired tanker on-station time will now only apply to TheaterRefuelingFlightPlan.
This commit is contained in:
parent
3f570cce5e
commit
48ba8ff255
@ -26,12 +26,13 @@ from .theaterrefueling import TheaterRefuelingFlightPlan
|
|||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from game.ato import Flight
|
from game.ato import Flight
|
||||||
from game.theater import FrontLine
|
|
||||||
|
|
||||||
|
|
||||||
class FlightPlanBuilderTypes:
|
class FlightPlanBuilderTypes:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def for_flight(flight: Flight) -> Type[IBuilder[Any, Any]]:
|
def for_flight(flight: Flight) -> Type[IBuilder[Any, Any]]:
|
||||||
|
from game.theater import FrontLine
|
||||||
|
|
||||||
if flight.flight_type is FlightType.REFUELING:
|
if flight.flight_type is FlightType.REFUELING:
|
||||||
if flight.package.target.is_friendly(flight.squadron.player) or isinstance(
|
if flight.package.target.is_friendly(flight.squadron.player) or isinstance(
|
||||||
flight.package.target, FrontLine
|
flight.package.target, FrontLine
|
||||||
|
|||||||
@ -23,17 +23,9 @@ class PackageRefuelingFlightPlan(RefuelingFlightPlan):
|
|||||||
def patrol_duration(self) -> timedelta:
|
def patrol_duration(self) -> timedelta:
|
||||||
# TODO: Only consider aircraft that can refuel with this tanker type.
|
# TODO: Only consider aircraft that can refuel with this tanker type.
|
||||||
refuel_time_minutes = 5
|
refuel_time_minutes = 5
|
||||||
min_patrol_duration = refuel_time_minutes
|
|
||||||
|
|
||||||
for self.flight in self.package.flights:
|
for self.flight in self.package.flights:
|
||||||
flight_size = self.flight.roster.max_size
|
flight_size = self.flight.roster.max_size
|
||||||
refuel_time_minutes = refuel_time_minutes + 4 * flight_size + 1
|
refuel_time_minutes = refuel_time_minutes + 4 * flight_size + 1
|
||||||
min_patrol_duration = (
|
|
||||||
self.flight.coalition.game.settings.desired_tanker_on_station_time.seconds
|
|
||||||
// 60
|
|
||||||
)
|
|
||||||
if refuel_time_minutes < min_patrol_duration:
|
|
||||||
refuel_time_minutes = min_patrol_duration
|
|
||||||
|
|
||||||
return timedelta(minutes=refuel_time_minutes)
|
return timedelta(minutes=refuel_time_minutes)
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ class TheaterRefuelingFlightPlan(RefuelingFlightPlan):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def patrol_duration(self) -> timedelta:
|
def patrol_duration(self) -> timedelta:
|
||||||
return timedelta(hours=1)
|
return self.flight.coalition.game.settings.desired_tanker_on_station_time
|
||||||
|
|
||||||
|
|
||||||
class Builder(IBuilder[TheaterRefuelingFlightPlan, PatrollingLayout]):
|
class Builder(IBuilder[TheaterRefuelingFlightPlan, PatrollingLayout]):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user