Move a type out of game.db.

This commit is contained in:
Dan Albert 2022-02-18 13:00:42 -08:00
parent e3ee988225
commit c1cb32de21
2 changed files with 6 additions and 7 deletions

View File

@ -1,13 +1,12 @@
from datetime import datetime from datetime import datetime
from enum import Enum from enum import Enum
from typing import Optional, Type, Union from typing import Optional, Type
from dcs.countries import country_dict from dcs.countries import country_dict
from dcs.helicopters import ( from dcs.helicopters import (
OH_58D, OH_58D,
helicopter_map, helicopter_map,
) )
from dcs.mapping import Point
# mypy can't resolve these if they're wildcard imports for some reason. # mypy can't resolve these if they're wildcard imports for some reason.
from dcs.planes import ( from dcs.planes import (
@ -29,8 +28,6 @@ from dcs.ships import (
Stennis, Stennis,
ship_map, ship_map,
) )
from dcs.terrain.terrain import Airport
from dcs.unitgroup import ShipGroup, StaticGroup
from dcs.unittype import FlyingType, ShipType, UnitType, VehicleType from dcs.unittype import FlyingType, ShipType, UnitType, VehicleType
from dcs.vehicles import ( from dcs.vehicles import (
vehicle_map, vehicle_map,
@ -150,8 +147,6 @@ REWARDS = {
---------- END OF CONFIGURATION SECTION ---------- END OF CONFIGURATION SECTION
""" """
StartingPosition = Union[ShipGroup, StaticGroup, Airport, Point]
def upgrade_to_supercarrier(unit: Type[ShipType], name: str) -> Type[ShipType]: def upgrade_to_supercarrier(unit: Type[ShipType], name: str) -> Type[ShipType]:
if unit == Stennis: if unit == Stennis:

View File

@ -27,6 +27,7 @@ from dcs.mapping import Point
from dcs.ships import Forrestal, KUZNECOW, LHA_Tarawa, Stennis, Type_071 from dcs.ships import Forrestal, KUZNECOW, LHA_Tarawa, Stennis, Type_071
from dcs.terrain.terrain import Airport, ParkingSlot from dcs.terrain.terrain import Airport, ParkingSlot
from dcs.unit import Unit from dcs.unit import Unit
from dcs.unitgroup import ShipGroup, StaticGroup
from game import db from game import db
from game.point_with_heading import PointWithHeading from game.point_with_heading import PointWithHeading
@ -271,6 +272,9 @@ class ControlPointStatus(IntEnum):
Destroyed = auto() Destroyed = auto()
StartingPosition = ShipGroup | StaticGroup | Airport | Point
class ControlPoint(MissionTarget, ABC): class ControlPoint(MissionTarget, ABC):
# Not sure what distance DCS uses, but assuming it's about 2NM since that's roughly # Not sure what distance DCS uses, but assuming it's about 2NM since that's roughly
# the distance of the circle on the map. # the distance of the circle on the map.
@ -291,7 +295,7 @@ class ControlPoint(MissionTarget, ABC):
cp_id: int, cp_id: int,
name: str, name: str,
position: Point, position: Point,
at: db.StartingPosition, at: StartingPosition,
starts_blue: bool, starts_blue: bool,
has_frontline: bool = True, has_frontline: bool = True,
cptype: ControlPointType = ControlPointType.AIRBASE, cptype: ControlPointType = ControlPointType.AIRBASE,