Update pydcs, adapt to new Point APIs.

This is briefly moving us over to my fork of pydcs while we wait for
https://github.com/pydcs/dcs/pull/206 to be merged. The adaptation is
invasive enough that I don't want it lingering for long.
This commit is contained in:
Dan Albert
2022-02-21 18:14:49 -08:00
parent ff12b37431
commit 9e2e4ffa74
29 changed files with 155 additions and 186 deletions

View File

@@ -5,10 +5,10 @@ from typing import TYPE_CHECKING
import shapely.ops
from dcs import Point
from shapely.geometry import (
MultiLineString,
MultiPolygon,
Point as ShapelyPoint,
Polygon,
MultiPolygon,
MultiLineString,
)
from game.utils import nautical_miles
@@ -27,6 +27,7 @@ class JoinZoneGeometry:
def __init__(
self, target: Point, home: Point, ip: Point, coalition: Coalition
) -> None:
self._target = target
# Normal join placement is based on the path from home to the IP. If no path is
# found it means that the target is on a direct path. In that case we instead
# want to enforce that the join point is:
@@ -100,4 +101,4 @@ class JoinZoneGeometry:
join, _ = shapely.ops.nearest_points(self.permissible_zones, self.ip)
else:
join, _ = shapely.ops.nearest_points(self.preferred_lines, self.home)
return Point(join.x, join.y)
return self._target.new_in_same_map(join.x, join.y)