Revert "Remove dead code."

Not used by python, but is used by jinja templates.

This reverts commit 1f3eee90f148c7a7fdc442e1b403b3c9c2bcfac9.
This commit is contained in:
Dan Albert 2023-08-10 00:43:32 -07:00
parent 723b96cd51
commit c4358daccc

View File

@ -25,6 +25,7 @@ from game.data.doctrine import (
MODERN_DOCTRINE,
WWII_DOCTRINE,
)
from game.data.groups import GroupRole
from game.data.units import UnitClass
from game.dcs.aircrafttype import AircraftType
from game.dcs.groundunittype import GroundUnitType
@ -154,6 +155,20 @@ class Faction:
)
return list(set(all_units))
@property
def air_defenses(self) -> list[str]:
"""Returns the Air Defense types"""
# This is used for the faction overview in NewGameWizard
air_defenses = [a.display_name for a in self.air_defense_units]
air_defenses.extend(
[
pg.name
for pg in self.preset_groups
if any(task.role == GroupRole.AIR_DEFENSE for task in pg.tasks)
]
)
return sorted(air_defenses)
@classmethod
def from_dict(cls: Type[Faction], json: Dict[str, Any]) -> Faction:
faction = Faction(