mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Track missions flown for each pilot.
https://github.com/dcs-liberation/dcs_liberation/issues/276
This commit is contained in:
parent
cd6de191d1
commit
8b8d1e87e7
@ -137,6 +137,23 @@ class Event:
|
||||
logging.info(f"{aircraft} destroyed from {cp}")
|
||||
cp.base.aircraft[aircraft] -= 1
|
||||
|
||||
@staticmethod
|
||||
def _commit_pilot_experience(ato: AirTaskingOrder) -> None:
|
||||
for package in ato.packages:
|
||||
for flight in package.flights:
|
||||
for idx, pilot in enumerate(flight.pilots):
|
||||
if pilot is None:
|
||||
logging.error(
|
||||
f"Cannot award experience to pilot #{idx} of {flight} "
|
||||
"because no pilot is assigned"
|
||||
)
|
||||
continue
|
||||
pilot.record.missions_flown += 1
|
||||
|
||||
def commit_pilot_experience(self) -> None:
|
||||
self._commit_pilot_experience(self.game.blue_ato)
|
||||
self._commit_pilot_experience(self.game.red_ato)
|
||||
|
||||
@staticmethod
|
||||
def commit_front_line_losses(debriefing: Debriefing) -> None:
|
||||
for loss in debriefing.front_line_losses:
|
||||
@ -250,6 +267,7 @@ class Event:
|
||||
logging.info("Committing mission results")
|
||||
|
||||
self.commit_air_losses(debriefing)
|
||||
self.commit_pilot_experience()
|
||||
self.commit_front_line_losses(debriefing)
|
||||
self.commit_convoy_losses(debriefing)
|
||||
self.commit_airlift_losses(debriefing)
|
||||
|
||||
@ -17,7 +17,7 @@ from qt_ui.models import SquadronModel
|
||||
|
||||
class PilotDelegate(TwoColumnRowDelegate):
|
||||
def __init__(self, squadron_model: SquadronModel) -> None:
|
||||
super().__init__(rows=2, columns=1, font_size=12)
|
||||
super().__init__(rows=2, columns=2, font_size=12)
|
||||
self.squadron_model = squadron_model
|
||||
|
||||
@staticmethod
|
||||
@ -25,9 +25,13 @@ class PilotDelegate(TwoColumnRowDelegate):
|
||||
return index.data(SquadronModel.PilotRole)
|
||||
|
||||
def text_for(self, index: QModelIndex, row: int, column: int) -> str:
|
||||
if row == 0:
|
||||
if (row, column) == (0, 0):
|
||||
return self.squadron_model.data(index, Qt.DisplayRole)
|
||||
elif row == 1:
|
||||
elif (row, column) == (0, 1):
|
||||
flown = self.pilot(index).record.missions_flown
|
||||
missions = "missions" if flown != 1 else "mission"
|
||||
return f"{flown} {missions} flown"
|
||||
elif (row, column) == (1, 0):
|
||||
return "Alive" if self.pilot(index).alive else "Dead"
|
||||
return ""
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user