mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
29 lines
833 B
Python
29 lines
833 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: Avoid threatened areas, minimize backtracking.
|
|
# https://github.com/dcs-liberation/dcs_liberation/issues/2542
|
|
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)
|