Show active and available pilots in air wing view.

https://github.com/dcs-liberation/dcs_liberation/issues/276
This commit is contained in:
Dan Albert 2021-05-26 18:18:22 -07:00
parent 57a2457050
commit 5277beede3
2 changed files with 9 additions and 1 deletions

View File

@ -84,9 +84,13 @@ class Squadron:
def faker(self) -> Faker:
return self.game.faker_for(self.player)
@property
def active_pilots(self) -> list[Pilot]:
return [p for p in self.pilots if p.alive]
@property
def size(self) -> int:
return len(self.pilots)
return len(self.active_pilots)
def pilot_at_index(self, index: int) -> Pilot:
return self.pilots[index]

View File

@ -39,6 +39,10 @@ class SquadronDelegate(TwoColumnRowDelegate):
)
elif (row, column) == (1, 0):
return self.squadron(index).nickname
elif (row, column) == (1, 1):
squadron = self.squadron(index)
available = len(squadron.available_pilots)
return f"{squadron.size} active pilots, {available} available"
return ""