mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Setting this up as part of the game makes it possible for us to show in the UI. https://github.com/dcs-liberation/dcs_liberation/issues/136
27 lines
626 B
Python
27 lines
626 B
Python
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass
|
|
from typing import Dict, TYPE_CHECKING
|
|
|
|
from dcs import Point
|
|
|
|
from game.theater import LatLon
|
|
|
|
if TYPE_CHECKING:
|
|
from game.theater import ConflictTheater
|
|
|
|
|
|
@dataclass
|
|
class Bullseye:
|
|
position: Point
|
|
|
|
@classmethod
|
|
def from_pydcs(cls, bulls: Dict[str, float]) -> Bullseye:
|
|
return cls(Point(bulls["x"], bulls["y"]))
|
|
|
|
def to_pydcs(self) -> Dict[str, float]:
|
|
return {"x": self.position.x, "y": self.position.y}
|
|
|
|
def to_lat_lon(self, theater: ConflictTheater) -> LatLon:
|
|
return theater.point_to_ll(self.position)
|