Refactor patrol_duration for refueling flight-plans

This commit is contained in:
Raffson 2024-12-24 05:10:18 +01:00
parent 15e6f81bb5
commit ef77637c9a
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99
3 changed files with 6 additions and 11 deletions

View File

@ -1,10 +1,15 @@
from abc import ABC from abc import ABC
from datetime import timedelta
from game.utils import Distance, Speed, knots, meters from game.utils import Speed, knots, Distance, meters
from .patrolling import PatrollingFlightPlan, PatrollingLayout from .patrolling import PatrollingFlightPlan, PatrollingLayout
class RefuelingFlightPlan(PatrollingFlightPlan[PatrollingLayout], ABC): class RefuelingFlightPlan(PatrollingFlightPlan[PatrollingLayout], ABC):
@property
def patrol_duration(self) -> timedelta:
return self.flight.coalition.game.settings.desired_tanker_on_station_time
@property @property
def patrol_speed(self) -> Speed: def patrol_speed(self) -> Speed:
# TODO: Could use self.flight.unit_type.preferred_patrol_speed(altitude). # TODO: Could use self.flight.unit_type.preferred_patrol_speed(altitude).

View File

@ -1,6 +1,5 @@
from __future__ import annotations from __future__ import annotations
from datetime import timedelta
from typing import Type from typing import Type
from game.ato.flightplans.ibuilder import IBuilder from game.ato.flightplans.ibuilder import IBuilder
@ -16,10 +15,6 @@ class RecoveryTankerFlightPlan(RefuelingFlightPlan):
def builder_type() -> Type[Builder]: def builder_type() -> Type[Builder]:
return Builder return Builder
@property
def patrol_duration(self) -> timedelta:
return self.flight.coalition.game.settings.desired_tanker_on_station_time
@property @property
def tot_waypoint(self) -> FlightWaypoint: def tot_waypoint(self) -> FlightWaypoint:
return self.layout.departure return self.layout.departure

View File

@ -1,6 +1,5 @@
from __future__ import annotations from __future__ import annotations
from datetime import timedelta
from typing import Type from typing import Type
from game.utils import Heading, meters, nautical_miles from game.utils import Heading, meters, nautical_miles
@ -15,10 +14,6 @@ class TheaterRefuelingFlightPlan(RefuelingFlightPlan):
def builder_type() -> Type[Builder]: def builder_type() -> Type[Builder]:
return Builder return Builder
@property
def patrol_duration(self) -> timedelta:
return self.flight.coalition.game.settings.desired_tanker_on_station_time
class Builder(IBuilder[TheaterRefuelingFlightPlan, PatrollingLayout]): class Builder(IBuilder[TheaterRefuelingFlightPlan, PatrollingLayout]):
def layout(self) -> PatrollingLayout: def layout(self) -> PatrollingLayout: