mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Draw flight plan paths in the react UI.
https://github.com/dcs-liberation/dcs_liberation/issues/2039
This commit is contained in:
@@ -5,6 +5,7 @@ from dcs.mapping import LatLng, Point
|
||||
from fastapi import APIRouter, Depends, HTTPException, status
|
||||
|
||||
from game import Game
|
||||
from game.ato import Flight
|
||||
from game.ato.flightwaypoint import FlightWaypoint
|
||||
from game.ato.flightwaypointtype import FlightWaypointType
|
||||
from game.server import GameContext
|
||||
@@ -15,11 +16,7 @@ from game.utils import meters
|
||||
router: APIRouter = APIRouter(prefix="/waypoints")
|
||||
|
||||
|
||||
@router.get("/{flight_id}", response_model=list[FlightWaypointJs])
|
||||
def all_waypoints_for_flight(
|
||||
flight_id: UUID, game: Game = Depends(GameContext.get)
|
||||
) -> list[FlightWaypointJs]:
|
||||
flight = game.db.flights.get(flight_id)
|
||||
def waypoints_for_flight(flight: Flight) -> list[FlightWaypointJs]:
|
||||
departure = FlightWaypointJs.for_waypoint(
|
||||
FlightWaypoint(
|
||||
"TAKEOFF",
|
||||
@@ -34,6 +31,13 @@ def all_waypoints_for_flight(
|
||||
]
|
||||
|
||||
|
||||
@router.get("/{flight_id}", response_model=list[FlightWaypointJs])
|
||||
def all_waypoints_for_flight(
|
||||
flight_id: UUID, game: Game = Depends(GameContext.get)
|
||||
) -> list[FlightWaypointJs]:
|
||||
return waypoints_for_flight(game.db.flights.get(flight_id))
|
||||
|
||||
|
||||
@router.post("/{flight_id}/{waypoint_idx}/position")
|
||||
def set_position(
|
||||
flight_id: UUID,
|
||||
|
||||
Reference in New Issue
Block a user