Improve Layout System and adopt to review

- adopted to review comments
- removed the role from layouts
- reworked the Groups within the layouts
- added more documentation
- rebased to latest changes
This commit is contained in:
RndName
2022-02-15 17:02:52 +01:00
parent 2c17a9a52e
commit 54e24dff39
93 changed files with 1606 additions and 1710 deletions

View File

@@ -1,4 +1,4 @@
from .faction import Faction
from .faction_loader import FactionLoader
from .factionloader import FactionLoader
FACTIONS = FactionLoader()

View File

@@ -150,7 +150,7 @@ class Faction:
for unit in preset_group.units
),
)
return list(all_units)
return list(set(all_units))
@property
def air_defenses(self) -> list[str]:
@@ -158,7 +158,11 @@ class Faction:
# This is used for the faction overview in NewGameWizard
air_defenses = [a.name for a in self.air_defense_units]
air_defenses.extend(
[pg.name for pg in self.preset_groups if pg.role == GroupRole.AIR_DEFENSE]
[
pg.name
for pg in self.preset_groups
if any(task.role == GroupRole.AIR_DEFENSE for task in pg.tasks)
]
)
return sorted(air_defenses)