Allow hiding IADS TGOs on MFD

This commit is contained in:
Raffson 2023-10-22 00:21:46 +02:00
parent e3dcf8e547
commit bc861380f0
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99
6 changed files with 33 additions and 2 deletions

View File

@ -21,6 +21,7 @@
* **[UI]** Improved frequency selector to support all modeled bands for every aircraft's intra-flight radio * **[UI]** Improved frequency selector to support all modeled bands for every aircraft's intra-flight radio
* **[Options]** New options in Settings: Helicopter waypoint altitude (feet AGL) for combat & cruise waypoints * **[Options]** New options in Settings: Helicopter waypoint altitude (feet AGL) for combat & cruise waypoints
* **[Options]** New options in Settings: Spawn ground power trucks at ground starts in airbases/roadbases * **[Options]** New options in Settings: Spawn ground power trucks at ground starts in airbases/roadbases
* **[Options]** Option for hiding TGOs (with IADS roles) on MFD
## Fixes ## Fixes
* **[Mission Generation]** Anti-ship strikes should use "group attack" in their attack-task * **[Mission Generation]** Anti-ship strikes should use "group attack" in their attack-task

View File

@ -223,3 +223,4 @@ class Migrator:
def _update_tgos(self) -> None: def _update_tgos(self) -> None:
for go in self.game.theater.ground_objects: for go in self.game.theater.ground_objects:
try_set_attr(go, "task", None) try_set_attr(go, "task", None)
try_set_attr(go, "hide_on_mfd", False)

View File

@ -290,9 +290,11 @@ class GroundObjectGenerator:
# All alive Ships # All alive Ships
ship_units.append(unit) ship_units.append(unit)
if vehicle_units: if vehicle_units:
self.create_vehicle_group(group.group_name, vehicle_units) vg = self.create_vehicle_group(group.group_name, vehicle_units)
vg.hidden_on_mfd = self.ground_object.hide_on_mfd
if ship_units: if ship_units:
self.create_ship_group(group.group_name, ship_units) sg = self.create_ship_group(group.group_name, ship_units)
sg.hidden_on_mfd = self.ground_object.hide_on_mfd
def create_vehicle_group( def create_vehicle_group(
self, group_name: str, units: list[TheaterUnit] self, group_name: str, units: list[TheaterUnit]

View File

@ -64,6 +64,7 @@ class TheaterGroundObject(MissionTarget, SidcDescribable, ABC):
control_point: ControlPoint, control_point: ControlPoint,
sea_object: bool, sea_object: bool,
task: Optional[GroupTask], task: Optional[GroupTask],
hide_on_mfd: bool = False,
) -> None: ) -> None:
super().__init__(name, location) super().__init__(name, location)
self.id = uuid.uuid4() self.id = uuid.uuid4()
@ -75,6 +76,7 @@ class TheaterGroundObject(MissionTarget, SidcDescribable, ABC):
self.original_name = location.original_name self.original_name = location.original_name
self._threat_poly: ThreatPoly | None = None self._threat_poly: ThreatPoly | None = None
self.task = task self.task = task
self.hide_on_mfd = hide_on_mfd
def __getstate__(self) -> dict[str, Any]: def __getstate__(self) -> dict[str, Any]:
state = self.__dict__.copy() state = self.__dict__.copy()

View File

@ -183,6 +183,7 @@ def load_icons():
) )
ICONS["heading"] = QPixmap("./resources/ui/misc/heading.png") ICONS["heading"] = QPixmap("./resources/ui/misc/heading.png")
ICONS["blue-sam"] = QPixmap("./resources/ui/misc/blue-sam.png")
EVENT_ICONS: Dict[str, QPixmap] = {} EVENT_ICONS: Dict[str, QPixmap] = {}

View File

@ -11,6 +11,7 @@ from PySide6.QtWidgets import (
QVBoxLayout, QVBoxLayout,
QSpinBox, QSpinBox,
QWidget, QWidget,
QCheckBox,
) )
from dcs import Point from dcs import Point
@ -43,6 +44,13 @@ class HeadingIndicator(QLabel):
) )
class SamIndicator(QLabel):
def __init__(self, parent: QWidget) -> None:
super().__init__(parent)
self.setFixedSize(32, 32)
self.setPixmap(ICONS["blue-sam"])
class QGroundObjectMenu(QDialog): class QGroundObjectMenu(QDialog):
def __init__( def __init__(
self, self,
@ -83,6 +91,8 @@ class QGroundObjectMenu(QDialog):
else: else:
self.mainLayout.addWidget(self.intelBox) self.mainLayout.addWidget(self.intelBox)
self.mainLayout.addWidget(self.orientationBox) self.mainLayout.addWidget(self.orientationBox)
if self.ground_object.is_iads and self.cp.is_friendly(to_player=False):
self.mainLayout.addWidget(self.hiddenBox)
self.actionLayout = QHBoxLayout() self.actionLayout = QHBoxLayout()
@ -188,11 +198,25 @@ class QGroundObjectMenu(QDialog):
else: else:
self.headingSelector.setEnabled(False) self.headingSelector.setEnabled(False)
# Hidden Box
self.hiddenBox = QGroupBox()
self.hiddenBoxLayout = QHBoxLayout()
self.hiddenBoxLayout.addWidget(SamIndicator(self))
self.hiddenBoxLayout.addWidget(QLabel("Hidden on MFD:"))
self.hiddenCheckBox = QCheckBox()
self.hiddenCheckBox.setChecked(self.ground_object.hide_on_mfd)
self.hiddenCheckBox.stateChanged.connect(self.update_hidden_on_mfd)
self.hiddenBoxLayout.addWidget(self.hiddenCheckBox)
# Set the layouts # Set the layouts
self.financesBox.setLayout(self.financesBoxLayout) self.financesBox.setLayout(self.financesBoxLayout)
self.buildingBox.setLayout(self.buildingsLayout) self.buildingBox.setLayout(self.buildingsLayout)
self.intelBox.setLayout(self.intelLayout) self.intelBox.setLayout(self.intelLayout)
self.orientationBox.setLayout(self.orientationBoxLayout) self.orientationBox.setLayout(self.orientationBoxLayout)
self.hiddenBox.setLayout(self.hiddenBoxLayout)
def update_hidden_on_mfd(self, state: bool) -> None:
self.ground_object.hide_on_mfd = bool(state)
def do_refresh_layout(self): def do_refresh_layout(self):
try: try: