mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Move unit purchase off find_unittype.
This commit is contained in:
@@ -1332,7 +1332,7 @@ def upgrade_to_supercarrier(unit, name: str):
|
||||
|
||||
|
||||
def find_unittype(for_task: Type[MainTask], country_name: str) -> List[Type[UnitType]]:
|
||||
return [x for x in UNIT_BY_TASK[for_task] if x in FACTIONS[country_name].units]
|
||||
return [x for x in UNIT_BY_TASK[for_task] if x in FACTIONS[country_name].all_units]
|
||||
|
||||
|
||||
MANPADS: List[Type[VehicleType]] = [
|
||||
|
||||
@@ -3,7 +3,7 @@ from game.data.groundunitclass import GroundUnitClass
|
||||
|
||||
import logging
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Optional, Dict, Type, List, Any, cast
|
||||
from typing import Optional, Dict, Type, List, Any, cast, Iterator
|
||||
|
||||
import dcs
|
||||
from dcs.countries import country_dict
|
||||
@@ -240,7 +240,7 @@ class Faction:
|
||||
return faction
|
||||
|
||||
@property
|
||||
def units(self) -> List[Type[UnitType]]:
|
||||
def all_units(self) -> List[Type[UnitType]]:
|
||||
return (
|
||||
self.infantry_units
|
||||
+ self.aircrafts
|
||||
@@ -251,6 +251,12 @@ class Faction:
|
||||
+ self.logistics_units
|
||||
)
|
||||
|
||||
@property
|
||||
def ground_units(self) -> Iterator[Type[VehicleType]]:
|
||||
yield from self.artillery_units
|
||||
yield from self.frontline_units
|
||||
yield from self.logistics_units
|
||||
|
||||
|
||||
def unit_loader(unit: str, class_repository: List[Any]) -> Optional[Type[UnitType]]:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user