dcs-retribution/game/flightplan/refuelzonegeometry.py
SnappyComebacks 532ac261ff
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.
2021-11-12 21:37:34 -07:00

28 lines
733 B
Python

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)