mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Allow selecting start type when creating flights.
This commit is contained in:
parent
88f7d1d572
commit
944a8e9cd6
@ -32,6 +32,7 @@ Saves from 2.3 are not compatible with 2.4.
|
|||||||
* **[UI]** Docs for time-on-target and creating new theaters/factions/loadouts are now linked in the UI at the appropriate places.
|
* **[UI]** Docs for time-on-target and creating new theaters/factions/loadouts are now linked in the UI at the appropriate places.
|
||||||
* **[UI]** ASAP is now a checkbox rather than a button. Enabling this will disable the TOT selector but changes to the package structure will automatically re-ASAP the package.
|
* **[UI]** ASAP is now a checkbox rather than a button. Enabling this will disable the TOT selector but changes to the package structure will automatically re-ASAP the package.
|
||||||
* **[UI]** Arrival airfield is now shown in the flight list if it differs from the departure airfield.
|
* **[UI]** Arrival airfield is now shown in the flight list if it differs from the departure airfield.
|
||||||
|
* **[UI]** Start type can now be selected when creating a flight.
|
||||||
* **[Factions]** Added option for date-based loadout restriction. Active radar homing missiles are handled, patches welcome for the other thousand weapons.
|
* **[Factions]** Added option for date-based loadout restriction. Active radar homing missiles are handled, patches welcome for the other thousand weapons.
|
||||||
* **[Factions]** Added Poland 2010 faction.
|
* **[Factions]** Added Poland 2010 faction.
|
||||||
* **[Factions]** Added Greece 2005 faction.
|
* **[Factions]** Added Greece 2005 faction.
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
from re import L
|
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from PySide2.QtCore import Qt, Signal
|
from PySide2.QtCore import Qt, Signal
|
||||||
from PySide2.QtWidgets import (
|
from PySide2.QtWidgets import (
|
||||||
|
QComboBox,
|
||||||
QDialog,
|
QDialog,
|
||||||
|
QLabel,
|
||||||
QMessageBox,
|
QMessageBox,
|
||||||
QPushButton,
|
QPushButton,
|
||||||
QVBoxLayout,
|
QVBoxLayout,
|
||||||
@ -63,6 +64,7 @@ class QFlightCreator(QDialog):
|
|||||||
self.aircraft_selector.currentData()
|
self.aircraft_selector.currentData()
|
||||||
)
|
)
|
||||||
self.departure.availability_changed.connect(self.update_max_size)
|
self.departure.availability_changed.connect(self.update_max_size)
|
||||||
|
self.departure.currentIndexChanged.connect(self.on_departure_changed)
|
||||||
layout.addLayout(QLabeledWidget("Departure:", self.departure))
|
layout.addLayout(QLabeledWidget("Departure:", self.departure))
|
||||||
|
|
||||||
self.arrival = QArrivalAirfieldSelector(
|
self.arrival = QArrivalAirfieldSelector(
|
||||||
@ -94,6 +96,22 @@ class QFlightCreator(QDialog):
|
|||||||
layout.addLayout(
|
layout.addLayout(
|
||||||
QLabeledWidget("Client Slots:", self.client_slots_spinner))
|
QLabeledWidget("Client Slots:", self.client_slots_spinner))
|
||||||
|
|
||||||
|
# When an off-map spawn overrides the start type to in-flight, we save
|
||||||
|
# the selected type into this value. If a non-off-map spawn is selected
|
||||||
|
# we restore the previous choice.
|
||||||
|
self.restore_start_type: Optional[str] = None
|
||||||
|
self.start_type = QComboBox()
|
||||||
|
self.start_type.addItems(["Cold", "Warm", "Runway", "In Flight"])
|
||||||
|
self.start_type.setCurrentText(self.game.settings.default_start_type)
|
||||||
|
layout.addLayout(QLabeledWidget(
|
||||||
|
"Start type:", self.start_type,
|
||||||
|
tooltip="Selects the start type for this flight."))
|
||||||
|
layout.addWidget(QLabel(
|
||||||
|
"Any option other than Cold will make this flight " +
|
||||||
|
"non-targetable<br />by OCA/Aircraft missions. This will affect " +
|
||||||
|
"game balance."
|
||||||
|
))
|
||||||
|
|
||||||
self.custom_name = QLineEdit()
|
self.custom_name = QLineEdit()
|
||||||
self.custom_name.textChanged.connect(self.set_custom_name_text)
|
self.custom_name.textChanged.connect(self.set_custom_name_text)
|
||||||
layout.addLayout(
|
layout.addLayout(
|
||||||
@ -108,6 +126,8 @@ class QFlightCreator(QDialog):
|
|||||||
|
|
||||||
self.setLayout(layout)
|
self.setLayout(layout)
|
||||||
|
|
||||||
|
self.on_departure_changed(self.departure.currentIndex())
|
||||||
|
|
||||||
def set_custom_name_text(self, text: str):
|
def set_custom_name_text(self, text: str):
|
||||||
self.custom_name_text = text
|
self.custom_name_text = text
|
||||||
|
|
||||||
@ -117,7 +137,7 @@ class QFlightCreator(QDialog):
|
|||||||
arrival: ControlPoint = self.arrival.currentData()
|
arrival: ControlPoint = self.arrival.currentData()
|
||||||
divert: ControlPoint = self.divert.currentData()
|
divert: ControlPoint = self.divert.currentData()
|
||||||
size: int = self.flight_size_spinner.value()
|
size: int = self.flight_size_spinner.value()
|
||||||
if aircraft == None:
|
if aircraft is None:
|
||||||
return "You must select an aircraft type."
|
return "You must select an aircraft type."
|
||||||
if not origin.captured:
|
if not origin.captured:
|
||||||
return f"{origin.name} is not owned by your coalition."
|
return f"{origin.name} is not owned by your coalition."
|
||||||
@ -153,12 +173,8 @@ class QFlightCreator(QDialog):
|
|||||||
if arrival is None:
|
if arrival is None:
|
||||||
arrival = origin
|
arrival = origin
|
||||||
|
|
||||||
if isinstance(origin, OffMapSpawn):
|
|
||||||
start_type = "In Flight"
|
|
||||||
else:
|
|
||||||
start_type = self.game.settings.default_start_type
|
|
||||||
flight = Flight(self.package, self.country, aircraft, size, task,
|
flight = Flight(self.package, self.country, aircraft, size, task,
|
||||||
start_type, origin, arrival, divert,
|
self.start_type.currentText(), origin, arrival, divert,
|
||||||
custom_name=self.custom_name_text)
|
custom_name=self.custom_name_text)
|
||||||
flight.client_count = self.client_slots_spinner.value()
|
flight.client_count = self.client_slots_spinner.value()
|
||||||
|
|
||||||
@ -172,6 +188,20 @@ class QFlightCreator(QDialog):
|
|||||||
self.arrival.change_aircraft(new_aircraft)
|
self.arrival.change_aircraft(new_aircraft)
|
||||||
self.divert.change_aircraft(new_aircraft)
|
self.divert.change_aircraft(new_aircraft)
|
||||||
|
|
||||||
|
def on_departure_changed(self, index: int) -> None:
|
||||||
|
departure = self.departure.itemData(index)
|
||||||
|
if isinstance(departure, OffMapSpawn):
|
||||||
|
previous_type = self.start_type.currentText()
|
||||||
|
if previous_type != "In Flight":
|
||||||
|
self.restore_start_type = previous_type
|
||||||
|
self.start_type.setCurrentText("In Flight")
|
||||||
|
self.start_type.setEnabled(False)
|
||||||
|
else:
|
||||||
|
self.start_type.setEnabled(True)
|
||||||
|
if self.restore_start_type is not None:
|
||||||
|
self.start_type.setCurrentText(self.restore_start_type)
|
||||||
|
self.restore_start_type = None
|
||||||
|
|
||||||
def on_task_changed(self) -> None:
|
def on_task_changed(self) -> None:
|
||||||
self.aircraft_selector.updateItems(self.task_selector.currentData(), self.game.aircraft_inventory.available_types_for_player)
|
self.aircraft_selector.updateItems(self.task_selector.currentData(), self.game.aircraft_inventory.available_types_for_player)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user