Add a CLI tool for viewing default loadouts.

This commit is contained in:
Dan Albert
2022-05-29 15:23:21 -07:00
parent c5efc908de
commit 22c3d4ebc5
6 changed files with 165 additions and 18 deletions

View File

@@ -4,7 +4,7 @@ import logging
from dataclasses import dataclass
from functools import cached_property
from pathlib import Path
from typing import Any, Iterator, Optional, TYPE_CHECKING, Type, Dict
from typing import Any, Dict, Iterator, Optional, TYPE_CHECKING, Type
import yaml
from dcs.helicopters import helicopter_map
@@ -315,7 +315,7 @@ class AircraftType(UnitType[Type[FlyingType]]):
yield unit
@staticmethod
def _each_unit_type() -> Iterator[Type[FlyingType]]:
def each_dcs_type() -> Iterator[Type[FlyingType]]:
yield from helicopter_map.values()
yield from plane_map.values()

View File

@@ -3,7 +3,7 @@ from __future__ import annotations
import logging
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Optional, Type, Iterator
from typing import Any, Iterator, Optional, Type
import yaml
from dcs.unittype import VehicleType
@@ -76,7 +76,7 @@ class GroundUnitType(UnitType[Type[VehicleType]]):
yield unit
@staticmethod
def _each_unit_type() -> Iterator[Type[VehicleType]]:
def each_dcs_type() -> Iterator[Type[VehicleType]]:
yield from vehicle_map.values()
@classmethod

View File

@@ -3,7 +3,7 @@ from __future__ import annotations
import logging
from dataclasses import dataclass
from pathlib import Path
from typing import Type, Iterator
from typing import Iterator, Type
import yaml
from dcs.ships import ship_map
@@ -32,7 +32,7 @@ class ShipUnitType(UnitType[Type[ShipType]]):
yield unit
@staticmethod
def _each_unit_type() -> Iterator[Type[ShipType]]:
def each_dcs_type() -> Iterator[Type[ShipType]]:
yield from ship_map.values()
@classmethod

View File

@@ -4,7 +4,7 @@ from abc import ABC
from collections import defaultdict
from dataclasses import dataclass
from functools import cached_property
from typing import TypeVar, Generic, Type, ClassVar, Any, Iterator
from typing import Any, ClassVar, Generic, Iterator, Type, TypeVar
from dcs.unittype import UnitType as DcsUnitType
@@ -52,7 +52,7 @@ class UnitType(ABC, Generic[DcsUnitTypeT]):
raise NotImplementedError
@staticmethod
def _each_unit_type() -> Iterator[DcsUnitTypeT]:
def each_dcs_type() -> Iterator[DcsUnitTypeT]:
raise NotImplementedError
@classmethod
@@ -61,7 +61,7 @@ class UnitType(ABC, Generic[DcsUnitTypeT]):
@classmethod
def _load_all(cls) -> None:
for unit_type in cls._each_unit_type():
for unit_type in cls.each_dcs_type():
for data in cls._each_variant_of(unit_type):
cls.register(data)
cls._loaded = True