mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
A lot of the dependency versions we have pinned don't have wheels for Python 3.12. Update almost all of them so we can upgrade Python. The few that weren't upgraded here are black and mypy, since those will be a bit invasive, and Pillow, which has an API change I don't want to deal with right now (I've got a commit on another machine that has already done the migration, so I'll do it later).
52 lines
1.8 KiB
Python
52 lines
1.8 KiB
Python
from __future__ import annotations
|
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
from pydantic import BaseModel
|
|
|
|
from game.server.controlpoints.models import ControlPointJs
|
|
from game.server.flights.models import FlightJs
|
|
from game.server.frontlines.models import FrontLineJs
|
|
from game.server.iadsnetwork.models import IadsNetworkJs
|
|
from game.server.leaflet import LeafletPoint
|
|
from game.server.mapzones.models import ThreatZoneContainerJs, UnculledZoneJs
|
|
from game.server.navmesh.models import NavMeshesJs
|
|
from game.server.supplyroutes.models import SupplyRouteJs
|
|
from game.server.tgos.models import TgoJs
|
|
|
|
if TYPE_CHECKING:
|
|
from game import Game
|
|
|
|
|
|
class GameJs(BaseModel):
|
|
control_points: list[ControlPointJs]
|
|
tgos: list[TgoJs]
|
|
supply_routes: list[SupplyRouteJs]
|
|
front_lines: list[FrontLineJs]
|
|
flights: list[FlightJs]
|
|
iads_network: IadsNetworkJs
|
|
threat_zones: ThreatZoneContainerJs
|
|
navmeshes: NavMeshesJs
|
|
map_center: LeafletPoint | None
|
|
unculled_zones: list[UnculledZoneJs]
|
|
|
|
class Config:
|
|
title = "Game"
|
|
|
|
@staticmethod
|
|
def from_game(game: Game) -> GameJs:
|
|
return GameJs(
|
|
control_points=ControlPointJs.all_in_game(game),
|
|
tgos=TgoJs.all_in_game(game),
|
|
supply_routes=SupplyRouteJs.all_in_game(game),
|
|
front_lines=FrontLineJs.all_in_game(game),
|
|
flights=FlightJs.all_in_game(game, with_waypoints=True),
|
|
iads_network=IadsNetworkJs.from_network(game.theater.iads_network),
|
|
threat_zones=ThreatZoneContainerJs.for_game(game),
|
|
navmeshes=NavMeshesJs.from_game(game),
|
|
map_center=LeafletPoint.from_pydcs(
|
|
game.theater.terrain.map_view_default.position
|
|
),
|
|
unculled_zones=UnculledZoneJs.from_game(game),
|
|
)
|