Adjustable OPFOR headings when OPFOR ATO is selected

This commit is contained in:
Raffson
2024-10-06 18:12:44 +02:00
parent a68bcb9ea1
commit 2b780e3d69
2 changed files with 7 additions and 6 deletions

View File

@@ -15,7 +15,6 @@ from PySide6.QtWidgets import (
)
from dcs import Point
from game import Game
from game.config import REWARDS
from game.data.building_data import FORTIFICATION_BUILDINGS
from game.server import EventStream
@@ -25,6 +24,7 @@ from game.theater.theatergroundobject import (
BuildingGroundObject,
)
from game.utils import Heading
from qt_ui.models import GameModel
from qt_ui.uiconstants import EVENT_ICONS, ICONS
from qt_ui.widgets.QBudgetBox import QBudgetBox
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
@@ -57,13 +57,14 @@ class QGroundObjectMenu(QDialog):
parent,
ground_object: TheaterGroundObject,
cp: ControlPoint,
game: Game,
gm: GameModel,
):
super().__init__(parent)
self.setMinimumWidth(350)
self.ground_object = ground_object
self.cp = cp
self.game = game
self.game_model = gm
self.game = gm.game
self.setWindowTitle(
f"Location - {self.ground_object.obj_name} ({self.cp.name})"
)
@@ -184,7 +185,6 @@ class QGroundObjectMenu(QDialog):
self.headingLabel = QLabel("Heading:")
self.orientationBoxLayout.addWidget(self.headingLabel)
self.headingSelector = QSpinBox()
self.headingSelector.setEnabled(self.cp.is_friendly(to_player=True))
self.headingSelector.setRange(0, 359)
self.headingSelector.setWrapping(True)
self.headingSelector.setSingleStep(5)
@@ -193,7 +193,8 @@ class QGroundObjectMenu(QDialog):
lambda degrees: self.rotate_tgo(Heading(degrees))
)
self.orientationBoxLayout.addWidget(self.headingSelector)
if self.cp.captured:
can_adjust_heading = self.cp.is_friendly(to_player=self.game_model.is_ownfor)
if can_adjust_heading:
self.head_to_conflict_button = QPushButton("Head to conflict")
heading = (
self.game.theater.heading_to_conflict_from(self.ground_object.position)