Track airlift cargo kills.

https://github.com/Khopa/dcs_liberation/issues/825
This commit is contained in:
Dan Albert
2021-04-22 19:22:41 -07:00
parent e474748f4d
commit 29b70b3247
6 changed files with 120 additions and 8 deletions

View File

@@ -172,6 +172,23 @@ class Event:
logging.info(f"{unit_type} destroyed in {convoy_name}")
convoy.kill_unit(unit_type)
@staticmethod
def commit_airlift_losses(debriefing: Debriefing) -> None:
for loss in debriefing.airlift_losses:
unit_type = loss.unit_type
transfer = loss.transfer
available = loss.transfer.units.get(unit_type, 0)
airlift_name = f"airlift from {transfer.origin} to {transfer.destination}"
if available <= 0:
logging.error(
f"Found killed {unit_type} in {airlift_name} but that airlift has "
"none available."
)
continue
logging.info(f"{unit_type} destroyed in {airlift_name}")
transfer.kill_unit(unit_type)
@staticmethod
def commit_ground_object_losses(debriefing: Debriefing) -> None:
for loss in debriefing.ground_object_losses:
@@ -205,6 +222,7 @@ class Event:
self.commit_air_losses(debriefing)
self.commit_front_line_losses(debriefing)
self.commit_convoy_losses(debriefing)
self.commit_airlift_losses(debriefing)
self.commit_ground_object_losses(debriefing)
self.commit_building_losses(debriefing)
self.commit_damaged_runways(debriefing)