mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Show ground unit supply info in the base menu.
Update the base UI to have a hint about ground unit deployment limits and a matching tooltip for how it is calculated.
This commit is contained in:
parent
d440dc00f1
commit
7b2bb4a128
@ -26,6 +26,7 @@ Saves from 2.5 are not compatible with 3.0.
|
||||
* **[UI]** Added new web based map UI. This is mostly functional but many of the old display options are a WIP. Revert to the old map with --old-map.
|
||||
* **[UI]** Campaigns generated for an older or newer version of the game will now be marked as incompatible. They can still be played, but bugs may be present.
|
||||
* **[UI]** DCS loadouts are now selectable in the loadout setup menu.
|
||||
* **[UI]** Base menu now shows information about ground unit deployment limits.
|
||||
* **[Modding]** Campaigns now choose locations for factories to spawn.
|
||||
* **[Modding]** Campaigns now use map structures as strike targets.
|
||||
* **[Modding]** Campaigns may now set *any* objective type to be a required spawn rather than random chance.
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
from __future__ import annotations
|
||||
from game.data.groundunitclass import GroundUnitClass
|
||||
|
||||
import heapq
|
||||
import itertools
|
||||
@ -802,9 +801,9 @@ class ControlPoint(MissionTarget, ABC):
|
||||
@property
|
||||
def active_ammo_depots_count(self) -> int:
|
||||
"""Return the number of available ammo depots"""
|
||||
return sum(
|
||||
return len(
|
||||
[
|
||||
1
|
||||
obj
|
||||
for obj in self.connected_objectives
|
||||
if obj.category == "ammo" and not obj.is_dead
|
||||
]
|
||||
@ -813,7 +812,7 @@ class ControlPoint(MissionTarget, ABC):
|
||||
@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"])
|
||||
return len([obj for obj in self.connected_objectives if obj.category == "ammo"])
|
||||
|
||||
@property
|
||||
def strike_targets(self) -> List[Union[MissionTarget, Unit]]:
|
||||
|
||||
@ -11,7 +11,12 @@ from PySide2.QtWidgets import (
|
||||
)
|
||||
|
||||
from game import Game, db
|
||||
from game.theater import ControlPoint, ControlPointType
|
||||
from game.theater import (
|
||||
ControlPoint,
|
||||
ControlPointType,
|
||||
FREE_FRONTLINE_UNIT_SUPPLY,
|
||||
AMMO_DEPOT_FRONTLINE_UNIT_CONTRIBUTION,
|
||||
)
|
||||
from gen.flights.flight import FlightType
|
||||
from qt_ui.dialogs import Dialog
|
||||
from qt_ui.models import GameModel
|
||||
@ -62,6 +67,7 @@ class QBaseMenu2(QDialog):
|
||||
title.setAlignment(Qt.AlignLeft | Qt.AlignTop)
|
||||
title.setProperty("style", "base-title")
|
||||
self.intel_summary = QLabel()
|
||||
self.intel_summary.setToolTip(self.generate_intel_tooltip())
|
||||
self.update_intel_summary()
|
||||
top_layout.addWidget(title)
|
||||
top_layout.addWidget(self.intel_summary)
|
||||
@ -195,11 +201,20 @@ class QBaseMenu2(QDialog):
|
||||
def update_intel_summary(self) -> None:
|
||||
aircraft = self.cp.base.total_aircraft
|
||||
parking = self.cp.total_aircraft_parking
|
||||
ground_unit_limit = self.cp.frontline_unit_count_limit
|
||||
deployable_unit_info = ""
|
||||
unit_overage = max(
|
||||
self.cp.base.total_armor - self.cp.frontline_unit_count_limit, 0
|
||||
)
|
||||
if self.cp.has_active_frontline:
|
||||
deployable_unit_info = (
|
||||
f" (Up to {ground_unit_limit} deployable, {unit_overage} reserve)"
|
||||
)
|
||||
self.intel_summary.setText(
|
||||
"\n".join(
|
||||
[
|
||||
f"{aircraft}/{parking} aircraft",
|
||||
f"{self.cp.base.total_armor} ground units",
|
||||
f"{self.cp.base.total_armor} ground units" + deployable_unit_info,
|
||||
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'}",
|
||||
@ -207,6 +222,24 @@ class QBaseMenu2(QDialog):
|
||||
)
|
||||
)
|
||||
|
||||
def generate_intel_tooltip(self) -> str:
|
||||
tooltip = (
|
||||
f"Deployable unit limit ({self.cp.frontline_unit_count_limit}) = {FREE_FRONTLINE_UNIT_SUPPLY} (base) + "
|
||||
f" {AMMO_DEPOT_FRONTLINE_UNIT_CONTRIBUTION} (per connected ammo depot) * {self.cp.total_ammo_depots_count} "
|
||||
f"(depots)"
|
||||
)
|
||||
|
||||
if self.cp.has_active_frontline:
|
||||
unit_overage = max(
|
||||
self.cp.base.total_armor - self.cp.frontline_unit_count_limit, 0
|
||||
)
|
||||
tooltip += (
|
||||
f"\n{unit_overage} units will be held in reserve and will not be deployed to "
|
||||
f"connected frontlines for this turn"
|
||||
)
|
||||
|
||||
return tooltip
|
||||
|
||||
def closeEvent(self, close_event: QCloseEvent):
|
||||
GameUpdateSignal.get_instance().updateGame(self.game_model.game)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user