Base menu UI : Added ammo depots & factory information (WIP UX)

This commit is contained in:
Khopa 2021-05-30 17:49:15 +02:00
parent a43e926dd2
commit 1af95955b6
2 changed files with 19 additions and 8 deletions

View File

@ -791,18 +791,27 @@ class ControlPoint(MissionTarget, ABC):
@property
def frontline_unit_count_limit(self) -> int:
tally_connected_ammo_depots = 0
for cp_objective in self.connected_objectives:
if cp_objective.category == "ammo" and not cp_objective.is_dead:
tally_connected_ammo_depots += 1
return (
FREE_FRONTLINE_UNIT_SUPPLY
+ tally_connected_ammo_depots * AMMO_DEPOT_FRONTLINE_UNIT_CONTRIBUTION
+ self.active_ammo_depots_count * AMMO_DEPOT_FRONTLINE_UNIT_CONTRIBUTION
)
@property
def active_ammo_depots_count(self) -> int:
"""Return the number of available ammo depots"""
return sum(
[
1
for obj in self.connected_objectives
if obj.category == "ammo" and not obj.is_dead
]
)
@property
def total_ammo_depots_count(self) -> int:
"""Return the number of ammo depots, including dead ones"""
return sum([1 for obj in self.connected_objectives if obj.category == "ammo"])
@property
def strike_targets(self) -> List[Union[MissionTarget, Unit]]:
return []

View File

@ -201,6 +201,8 @@ class QBaseMenu2(QDialog):
f"{aircraft}/{parking} aircraft",
f"{self.cp.base.total_armor} ground units",
str(self.cp.runway_status),
f"{self.cp.active_ammo_depots_count}/{self.cp.total_ammo_depots_count} ammo depots",
f"{'Factory can produce units' if self.cp.has_factory else 'Does not have a factory'}",
]
)
)