mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Allow hiding IADS TGOs on MFD
This commit is contained in:
parent
e3dcf8e547
commit
bc861380f0
@ -21,6 +21,7 @@
|
||||
* **[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: Spawn ground power trucks at ground starts in airbases/roadbases
|
||||
* **[Options]** Option for hiding TGOs (with IADS roles) on MFD
|
||||
|
||||
## Fixes
|
||||
* **[Mission Generation]** Anti-ship strikes should use "group attack" in their attack-task
|
||||
|
||||
@ -223,3 +223,4 @@ class Migrator:
|
||||
def _update_tgos(self) -> None:
|
||||
for go in self.game.theater.ground_objects:
|
||||
try_set_attr(go, "task", None)
|
||||
try_set_attr(go, "hide_on_mfd", False)
|
||||
|
||||
@ -290,9 +290,11 @@ class GroundObjectGenerator:
|
||||
# All alive Ships
|
||||
ship_units.append(unit)
|
||||
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:
|
||||
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(
|
||||
self, group_name: str, units: list[TheaterUnit]
|
||||
|
||||
@ -64,6 +64,7 @@ class TheaterGroundObject(MissionTarget, SidcDescribable, ABC):
|
||||
control_point: ControlPoint,
|
||||
sea_object: bool,
|
||||
task: Optional[GroupTask],
|
||||
hide_on_mfd: bool = False,
|
||||
) -> None:
|
||||
super().__init__(name, location)
|
||||
self.id = uuid.uuid4()
|
||||
@ -75,6 +76,7 @@ class TheaterGroundObject(MissionTarget, SidcDescribable, ABC):
|
||||
self.original_name = location.original_name
|
||||
self._threat_poly: ThreatPoly | None = None
|
||||
self.task = task
|
||||
self.hide_on_mfd = hide_on_mfd
|
||||
|
||||
def __getstate__(self) -> dict[str, Any]:
|
||||
state = self.__dict__.copy()
|
||||
|
||||
@ -183,6 +183,7 @@ def load_icons():
|
||||
)
|
||||
|
||||
ICONS["heading"] = QPixmap("./resources/ui/misc/heading.png")
|
||||
ICONS["blue-sam"] = QPixmap("./resources/ui/misc/blue-sam.png")
|
||||
|
||||
|
||||
EVENT_ICONS: Dict[str, QPixmap] = {}
|
||||
|
||||
@ -11,6 +11,7 @@ from PySide6.QtWidgets import (
|
||||
QVBoxLayout,
|
||||
QSpinBox,
|
||||
QWidget,
|
||||
QCheckBox,
|
||||
)
|
||||
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):
|
||||
def __init__(
|
||||
self,
|
||||
@ -83,6 +91,8 @@ class QGroundObjectMenu(QDialog):
|
||||
else:
|
||||
self.mainLayout.addWidget(self.intelBox)
|
||||
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()
|
||||
|
||||
@ -188,11 +198,25 @@ class QGroundObjectMenu(QDialog):
|
||||
else:
|
||||
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
|
||||
self.financesBox.setLayout(self.financesBoxLayout)
|
||||
self.buildingBox.setLayout(self.buildingsLayout)
|
||||
self.intelBox.setLayout(self.intelLayout)
|
||||
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):
|
||||
try:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user