mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Ability to plan tanker recovery for strike like flights (#1729)
* Initial refueling definitions. * Adding refuel definitions. * Initial functionality changes * Regenerate package when adding refueling flight. * Recursively change package waypoint. * Fix mypy errors. * Regenerate flight plans when tanker is added to package. * Give tanker better starting position on package recovery. * Add TOT calculation for refueling waypoint. * Timing changes to Strike split point and Refueling start time. * Add correct waypoint builder for refuel in tarcap and sweep. Remove restrict afterburner on refuel point. * Always generate a refuel point for a package. * Less arbitrary altitude in Refuel track start time calculation. * Refueling waypoint no longer optional. * Fix mypy gen error. * Better discrimination of which tanker flight plan to make. * Remove refuel tot calculations. * Remove package regeneration on tanker flight addition.
This commit is contained in:
@@ -45,3 +45,4 @@ class FlightWaypointType(Enum):
|
||||
PICKUP = 26
|
||||
DROP_OFF = 27
|
||||
BULLSEYE = 28
|
||||
REFUEL = 29 # Should look for nearby tanker to refuel from.
|
||||
|
||||
@@ -48,7 +48,7 @@ class Package:
|
||||
"""The speed of the package when in formation.
|
||||
|
||||
If none of the flights in the package will join a formation, this
|
||||
returns None. This is nto uncommon, since only strike-like (strike,
|
||||
returns None. This is not uncommon, since only strike-like (strike,
|
||||
DEAD, anti-ship, BAI, etc.) flights and their escorts fly in formation.
|
||||
Others (CAP and CAS, currently) will coordinate in target timing but
|
||||
fly their own path to the target.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional
|
||||
|
||||
from dcs import Point
|
||||
|
||||
@@ -8,3 +9,4 @@ class PackageWaypoints:
|
||||
join: Point
|
||||
ingress: Point
|
||||
split: Point
|
||||
refuel: Point
|
||||
|
||||
27
game/flightplan/refuelzonegeometry.py
Normal file
27
game/flightplan/refuelzonegeometry.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from dcs import Point
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from game.coalition import Coalition
|
||||
|
||||
|
||||
class RefuelZoneGeometry:
|
||||
def __init__(
|
||||
self,
|
||||
package_home: Point,
|
||||
join: Point,
|
||||
coalition: Coalition,
|
||||
) -> None:
|
||||
self.package_home = package_home
|
||||
self.join = join
|
||||
self.coalition = coalition
|
||||
|
||||
def find_best_refuel_point(self) -> Point:
|
||||
# Do simple at first.
|
||||
# TODO: Consider threats.
|
||||
distance = 0.75 * self.package_home.distance_to_point(self.join)
|
||||
heading = self.package_home.heading_between_point(self.join)
|
||||
return self.package_home.point_from_heading(heading, distance)
|
||||
9
game/missiongenerator/aircraft/waypoints/refuel.py
Normal file
9
game/missiongenerator/aircraft/waypoints/refuel.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from dcs.point import MovingPoint
|
||||
from dcs.task import RefuelingTaskAction
|
||||
from .pydcswaypointbuilder import PydcsWaypointBuilder
|
||||
|
||||
|
||||
class RefuelPointBuilder(PydcsWaypointBuilder):
|
||||
def add_tasks(self, waypoint: MovingPoint) -> None:
|
||||
waypoint.add_task(RefuelingTaskAction())
|
||||
return super().add_tasks(waypoint)
|
||||
@@ -32,6 +32,7 @@ from .ocarunwayingress import OcaRunwayIngressBuilder
|
||||
from .pydcswaypointbuilder import PydcsWaypointBuilder, TARGET_WAYPOINTS
|
||||
from .racetrack import RaceTrackBuilder
|
||||
from .racetrackend import RaceTrackEndBuilder
|
||||
from .refuel import RefuelPointBuilder
|
||||
from .seadingress import SeadIngressBuilder
|
||||
from .strikeingress import StrikeIngressBuilder
|
||||
from .sweepingress import SweepIngressBuilder
|
||||
@@ -130,6 +131,7 @@ class WaypointGenerator:
|
||||
FlightWaypointType.PATROL: RaceTrackEndBuilder,
|
||||
FlightWaypointType.PATROL_TRACK: RaceTrackBuilder,
|
||||
FlightWaypointType.PICKUP: CargoStopBuilder,
|
||||
FlightWaypointType.REFUEL: RefuelPointBuilder,
|
||||
}
|
||||
builder = builders.get(waypoint.waypoint_type, DefaultWaypointBuilder)
|
||||
return builder(
|
||||
|
||||
@@ -906,11 +906,12 @@ class Airfield(ControlPoint):
|
||||
if self.is_friendly(for_player):
|
||||
yield from [
|
||||
FlightType.AEWC,
|
||||
FlightType.REFUELING,
|
||||
# TODO: FlightType.INTERCEPTION
|
||||
# TODO: FlightType.LOGISTICS
|
||||
]
|
||||
|
||||
yield FlightType.REFUELING
|
||||
|
||||
@property
|
||||
def total_aircraft_parking(self) -> int:
|
||||
"""
|
||||
|
||||
@@ -132,6 +132,7 @@ class TheaterGroundObject(MissionTarget, Generic[GroupT]):
|
||||
yield from [
|
||||
FlightType.STRIKE,
|
||||
FlightType.BAI,
|
||||
FlightType.REFUELING,
|
||||
]
|
||||
yield from super().mission_types(for_player)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user