mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Add an option for default start type.
Changing this completely breaks OCA/Aircraft missions, but if the player doesn't care about those this can reduce airfield congestion. The UI warns about this. This also makes the AI start type selectable in the flight UI. Fixes https://github.com/Khopa/dcs_liberation/issues/387 Fixes https://github.com/Khopa/dcs_liberation/issues/729
This commit is contained in:
@@ -155,12 +155,11 @@ class QFlightCreator(QDialog):
|
||||
|
||||
if isinstance(origin, OffMapSpawn):
|
||||
start_type = "In Flight"
|
||||
elif self.game.settings.perf_ai_parking_start:
|
||||
start_type = "Cold"
|
||||
else:
|
||||
start_type = "Warm"
|
||||
flight = Flight(self.package, self.country, aircraft, size, task, start_type, origin,
|
||||
arrival, divert, custom_name=self.custom_name_text)
|
||||
start_type = self.game.settings.default_start_type
|
||||
flight = Flight(self.package, self.country, aircraft, size, task,
|
||||
start_type, origin, arrival, divert,
|
||||
custom_name=self.custom_name_text)
|
||||
flight.client_count = self.client_slots_spinner.value()
|
||||
|
||||
# noinspection PyUnresolvedReferences
|
||||
|
||||
@@ -27,14 +27,14 @@ class QFlightSlotEditor(QGroupBox):
|
||||
|
||||
layout = QGridLayout()
|
||||
|
||||
self.aircraft_count = QLabel("Aircraft count :")
|
||||
self.aircraft_count = QLabel("Aircraft count:")
|
||||
self.aircraft_count_spinner = QSpinBox()
|
||||
self.aircraft_count_spinner.setMinimum(1)
|
||||
self.aircraft_count_spinner.setMaximum(max_count)
|
||||
self.aircraft_count_spinner.setValue(flight.count)
|
||||
self.aircraft_count_spinner.valueChanged.connect(self._changed_aircraft_count)
|
||||
|
||||
self.client_count = QLabel("Client slots count :")
|
||||
self.client_count = QLabel("Client slots count:")
|
||||
self.client_count_spinner = QSpinBox()
|
||||
self.client_count_spinner.setMinimum(0)
|
||||
self.client_count_spinner.setMaximum(max_count)
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
from PySide2.QtWidgets import QComboBox, QGroupBox, QHBoxLayout, QLabel
|
||||
from PySide2.QtWidgets import (
|
||||
QComboBox,
|
||||
QGroupBox,
|
||||
QHBoxLayout,
|
||||
QLabel,
|
||||
QVBoxLayout,
|
||||
)
|
||||
|
||||
from gen.flights.flight import Flight
|
||||
from qt_ui.models import PackageModel
|
||||
@@ -11,8 +17,9 @@ class QFlightStartType(QGroupBox):
|
||||
self.package_model = package_model
|
||||
self.flight = flight
|
||||
|
||||
self.layout = QHBoxLayout()
|
||||
self.start_type_label = QLabel("Start type : ")
|
||||
self.layout = QVBoxLayout()
|
||||
self.main_row = QHBoxLayout()
|
||||
self.start_type_label = QLabel("Start type:")
|
||||
self.start_type = QComboBox()
|
||||
|
||||
for i, st in enumerate([b for b in ["Cold", "Warm", "Runway", "In Flight"]]):
|
||||
@@ -21,11 +28,17 @@ class QFlightStartType(QGroupBox):
|
||||
self.start_type.setCurrentIndex(i)
|
||||
|
||||
self.start_type.currentTextChanged.connect(self._on_start_type_selected)
|
||||
self.layout.addWidget(self.start_type_label)
|
||||
self.layout.addWidget(self.start_type)
|
||||
self.main_row.addWidget(self.start_type_label)
|
||||
self.main_row.addWidget(self.start_type)
|
||||
|
||||
self.layout.addLayout(self.main_row)
|
||||
self.layout.addWidget(QLabel(
|
||||
"Any option other than Cold will make this flight non-targetable " +
|
||||
"by OCA/Aircraft missions. This will affect game balance."
|
||||
))
|
||||
self.setLayout(self.layout)
|
||||
|
||||
def _on_start_type_selected(self):
|
||||
selected = self.start_type.currentData()
|
||||
self.flight.start_type = selected
|
||||
self.package_model.update_tot()
|
||||
self.package_model.update_tot()
|
||||
|
||||
@@ -2,7 +2,6 @@ from PySide2.QtCore import Signal
|
||||
from PySide2.QtWidgets import QFrame, QGridLayout, QVBoxLayout
|
||||
|
||||
from game import Game
|
||||
from gen.ato import Package
|
||||
from gen.flights.flight import Flight
|
||||
from qt_ui.models import PackageModel
|
||||
from qt_ui.windows.mission.flight.settings.QFlightDepartureDisplay import \
|
||||
@@ -24,21 +23,12 @@ class QGeneralFlightSettingsTab(QFrame):
|
||||
super().__init__()
|
||||
|
||||
layout = QGridLayout()
|
||||
flight_info = QFlightTypeTaskInfo(flight)
|
||||
flight_departure = QFlightDepartureDisplay(package_model, flight)
|
||||
flight_slots = QFlightSlotEditor(package_model, flight, game)
|
||||
flight_start_type = QFlightStartType(package_model, flight)
|
||||
flight_custom_name = QFlightCustomName(flight)
|
||||
layout.addWidget(flight_info, 0, 0)
|
||||
layout.addWidget(flight_departure, 1, 0)
|
||||
layout.addWidget(flight_slots, 2, 0)
|
||||
layout.addWidget(flight_start_type, 3, 0)
|
||||
layout.addWidget(flight_custom_name, 4, 0)
|
||||
layout.addWidget(QFlightTypeTaskInfo(flight), 0, 0)
|
||||
layout.addWidget(QFlightDepartureDisplay(package_model, flight), 1, 0)
|
||||
layout.addWidget(QFlightSlotEditor(package_model, flight, game), 2, 0)
|
||||
layout.addWidget(QFlightStartType(package_model, flight), 3, 0)
|
||||
layout.addWidget(QFlightCustomName(flight), 4, 0)
|
||||
vstretch = QVBoxLayout()
|
||||
vstretch.addStretch()
|
||||
layout.addLayout(vstretch, 3, 0)
|
||||
layout.addLayout(vstretch, 5, 0)
|
||||
self.setLayout(layout)
|
||||
|
||||
flight_start_type.setEnabled(flight.client_count > 0)
|
||||
flight_slots.changed.connect(
|
||||
lambda: flight_start_type.setEnabled(flight.client_count > 0))
|
||||
|
||||
@@ -23,6 +23,7 @@ from dcs.forcedoptions import ForcedOptions
|
||||
import qt_ui.uiconstants as CONST
|
||||
from game.game import Game
|
||||
from game.infos.information import Information
|
||||
from game.settings import Settings
|
||||
from qt_ui.widgets.QLabeledWidget import QLabeledWidget
|
||||
from qt_ui.widgets.spinsliders import TenthsSpinSlider
|
||||
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
|
||||
@@ -68,6 +69,21 @@ class CheatSettingsBox(QGroupBox):
|
||||
return self.base_capture_cheat_checkbox.isChecked()
|
||||
|
||||
|
||||
START_TYPE_TOOLTIP = "Selects the start type used for AI aircraft."
|
||||
|
||||
|
||||
class StartTypeComboBox(QComboBox):
|
||||
def __init__(self, settings: Settings) -> None:
|
||||
super().__init__()
|
||||
self.settings = settings
|
||||
self.addItems(["Cold", "Warm", "Runway", "In Flight"])
|
||||
self.currentTextChanged.connect(self.on_change)
|
||||
self.setToolTip(START_TYPE_TOOLTIP)
|
||||
|
||||
def on_change(self, value: str) -> None:
|
||||
self.settings.default_start_type = value
|
||||
|
||||
|
||||
class QSettingsWindow(QDialog):
|
||||
|
||||
def __init__(self, game: Game):
|
||||
@@ -370,6 +386,17 @@ class QSettingsWindow(QDialog):
|
||||
self.gameplayLayout.addWidget(self.never_delay_players, 2, 1,
|
||||
Qt.AlignRight)
|
||||
|
||||
start_type_label = QLabel(
|
||||
"Default start type for AI aircraft:<br /><strong>Warning: " +
|
||||
"Any option other than Cold breaks OCA/Aircraft missions.</strong>"
|
||||
)
|
||||
start_type_label.setToolTip(START_TYPE_TOOLTIP)
|
||||
start_type = StartTypeComboBox(self.game.settings)
|
||||
start_type.setCurrentText(self.game.settings.default_start_type)
|
||||
|
||||
self.gameplayLayout.addWidget(start_type_label, 3, 0)
|
||||
self.gameplayLayout.addWidget(start_type, 3, 1)
|
||||
|
||||
self.performance = QGroupBox("Performance")
|
||||
self.performanceLayout = QGridLayout()
|
||||
self.performanceLayout.setAlignment(Qt.AlignTop)
|
||||
@@ -395,10 +422,6 @@ class QSettingsWindow(QDialog):
|
||||
self.infantry.setChecked(self.game.settings.perf_infantry)
|
||||
self.infantry.toggled.connect(self.applySettings)
|
||||
|
||||
self.ai_parking_start = QCheckBox()
|
||||
self.ai_parking_start.setChecked(self.game.settings.perf_ai_parking_start)
|
||||
self.ai_parking_start.toggled.connect(self.applySettings)
|
||||
|
||||
self.destroyed_units = QCheckBox()
|
||||
self.destroyed_units.setChecked(self.game.settings.perf_destroyed_units)
|
||||
self.destroyed_units.toggled.connect(self.applySettings)
|
||||
@@ -427,8 +450,6 @@ class QSettingsWindow(QDialog):
|
||||
self.performanceLayout.addWidget(self.moving_units, 3, 1, alignment=Qt.AlignRight)
|
||||
self.performanceLayout.addWidget(QLabel("Generate infantry squads along vehicles"), 4, 0)
|
||||
self.performanceLayout.addWidget(self.infantry, 4, 1, alignment=Qt.AlignRight)
|
||||
self.performanceLayout.addWidget(QLabel("AI planes parking start (AI starts in flight if disabled)"), 5, 0)
|
||||
self.performanceLayout.addWidget(self.ai_parking_start, 5, 1, alignment=Qt.AlignRight)
|
||||
self.performanceLayout.addWidget(QLabel("Include destroyed units carcass"), 6, 0)
|
||||
self.performanceLayout.addWidget(self.destroyed_units, 6, 1, alignment=Qt.AlignRight)
|
||||
|
||||
@@ -504,7 +525,6 @@ class QSettingsWindow(QDialog):
|
||||
self.game.settings.perf_artillery = self.arti.isChecked()
|
||||
self.game.settings.perf_moving_units = self.moving_units.isChecked()
|
||||
self.game.settings.perf_infantry = self.infantry.isChecked()
|
||||
self.game.settings.perf_ai_parking_start = self.ai_parking_start.isChecked()
|
||||
self.game.settings.perf_destroyed_units = self.destroyed_units.isChecked()
|
||||
|
||||
self.game.settings.perf_culling = self.culling.isChecked()
|
||||
|
||||
Reference in New Issue
Block a user