Include positions of dead aircraft for the UI.

This commit is contained in:
Dan Albert 2022-03-07 19:43:06 -08:00
parent 895a4eb0dc
commit 453f6ac74a

View File

@ -6,6 +6,7 @@ from uuid import UUID
from pydantic import BaseModel from pydantic import BaseModel
from game.ato.flightstate import InFlight from game.ato.flightstate import InFlight
from game.ato.flightstate.killed import Killed
from game.server.leaflet import LeafletPoint from game.server.leaflet import LeafletPoint
from game.server.waypoints.models import FlightWaypointJs from game.server.waypoints.models import FlightWaypointJs
from game.server.waypoints.routes import waypoints_for_flight from game.server.waypoints.routes import waypoints_for_flight
@ -29,10 +30,13 @@ class FlightJs(BaseModel):
def for_flight(flight: Flight, with_waypoints: bool) -> FlightJs: def for_flight(flight: Flight, with_waypoints: bool) -> FlightJs:
# Don't provide a location for aircraft that aren't in the air. Later we can # Don't provide a location for aircraft that aren't in the air. Later we can
# expand the model to include the state data for the UI so that it can make its # expand the model to include the state data for the UI so that it can make its
# own decisions about whether or not to draw the aircraft, but for now we'll # own decisions about whether to draw the aircraft, but for now we'll filter
# filter here. # here.
#
# We also draw dead aircraft so the player has some feedback about what's being
# lost.
position = None position = None
if isinstance(flight.state, InFlight): if isinstance(flight.state, InFlight) or isinstance(flight.state, Killed):
position = flight.position().latlng() position = flight.position().latlng()
waypoints = None waypoints = None
if with_waypoints: if with_waypoints: