Allow DEAD on EWRs.

This commit is contained in:
Dan Albert 2020-11-16 23:47:36 -08:00
parent 082e8c062c
commit 426dc69e1d
2 changed files with 10 additions and 1 deletions

View File

@ -27,6 +27,7 @@ from theater import (
SamGroundObject,
TheaterGroundObject,
)
from theater.theatergroundobject import EwrGroundObject
from .closestairfields import ObjectiveDistanceCache
from .flight import Flight, FlightType, FlightWaypoint, FlightWaypointType
from .traveltime import GroundSpeed, TravelTime
@ -919,7 +920,9 @@ class FlightPlanBuilder:
"""
location = self.package.target
if not isinstance(location, SamGroundObject):
is_ewr = isinstance(location, EwrGroundObject)
is_sam = isinstance(location, SamGroundObject)
if not is_ewr and not is_sam:
logging.exception(f"Invalid Objective Location for DEAD flight {flight=} at {location=}")
raise InvalidObjectiveLocation(flight.flight_type, location)

View File

@ -291,6 +291,12 @@ class EwrGroundObject(BaseDefenseGroundObject):
# Prefix the group names with the side color so Skynet can find them.
return f"{self.faction_color}|{super().group_name}"
def mission_types(self, for_player: bool) -> Iterator[FlightType]:
from gen.flights.flight import FlightType
if not self.is_friendly(for_player):
yield FlightType.DEAD
yield from super().mission_types(for_player)
class ShipGroundObject(NavalGroundObject):
def __init__(self, name: str, group_id: int, position: Point,