mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Merge remote-tracking branch 'remotes/dcs-retribution/dcs-retribution/dev' into pretense-generator
This commit is contained in:
@@ -89,8 +89,7 @@ class QFlightCreator(QDialog):
|
||||
roster = None
|
||||
else:
|
||||
roster = FlightRoster(
|
||||
squadron,
|
||||
initial_size=self.flight_size_spinner.value(),
|
||||
squadron, initial_size=self.flight_size_spinner.value()
|
||||
)
|
||||
self.roster_editor = FlightRosterEditor(squadron, roster)
|
||||
self.flight_size_spinner.valueChanged.connect(self.roster_editor.resize)
|
||||
@@ -100,10 +99,12 @@ class QFlightCreator(QDialog):
|
||||
roster_layout.addWidget(QLabel("Assigned pilots:"))
|
||||
roster_layout.addLayout(self.roster_editor)
|
||||
|
||||
self.roster_editor.pilots_changed.connect(self.on_pilot_selected)
|
||||
|
||||
# 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 = self.game.settings.default_start_type
|
||||
self.restore_start_type: Optional[str] = None
|
||||
self.start_type = QComboBox()
|
||||
for start_type in StartType:
|
||||
self.start_type.addItem(start_type.value, start_type)
|
||||
@@ -140,6 +141,8 @@ class QFlightCreator(QDialog):
|
||||
|
||||
self.setLayout(layout)
|
||||
|
||||
self.roster_editor.pilots_changed.emit()
|
||||
|
||||
def reject(self) -> None:
|
||||
super().reject()
|
||||
# Clear the roster to return pilots to the pool.
|
||||
@@ -213,6 +216,8 @@ class QFlightCreator(QDialog):
|
||||
)
|
||||
self.divert.change_aircraft(new_aircraft)
|
||||
|
||||
self.roster_editor.pilots_changed.emit()
|
||||
|
||||
def on_departure_changed(self, departure: ControlPoint) -> None:
|
||||
if isinstance(departure, OffMapSpawn):
|
||||
previous_type = self.start_type.currentData()
|
||||
@@ -245,6 +250,8 @@ class QFlightCreator(QDialog):
|
||||
)
|
||||
self.on_departure_changed(squadron.location)
|
||||
|
||||
self.roster_editor.pilots_changed.emit()
|
||||
|
||||
def update_max_size(self, available: int) -> None:
|
||||
aircraft = self.aircraft_selector.currentData()
|
||||
if aircraft is None:
|
||||
@@ -255,3 +262,23 @@ class QFlightCreator(QDialog):
|
||||
|
||||
default_size = max(2, available, aircraft.max_group_size)
|
||||
self.flight_size_spinner.setValue(default_size)
|
||||
|
||||
try:
|
||||
self.roster_editor.pilots_changed.emit()
|
||||
except AttributeError:
|
||||
return
|
||||
|
||||
def on_pilot_selected(self):
|
||||
# Pilot selection detected. If this is a player flight, set start_type
|
||||
# as configured for players in the settings.
|
||||
# Otherwise, set the start_type as configured for AI.
|
||||
# https://github.com/dcs-liberation/dcs_liberation/issues/1567
|
||||
|
||||
roster = self.roster_editor.roster
|
||||
|
||||
if roster is not None and roster.player_count > 0:
|
||||
start_type = self.game.settings.default_start_type_client
|
||||
else:
|
||||
start_type = self.game.settings.default_start_type
|
||||
|
||||
self.start_type.setCurrentText(start_type.value)
|
||||
|
||||
@@ -96,11 +96,16 @@ class PilotControls(QHBoxLayout):
|
||||
player_toggled = Signal()
|
||||
|
||||
def __init__(
|
||||
self, squadron: Optional[Squadron], roster: Optional[FlightRoster], idx: int
|
||||
self,
|
||||
squadron: Optional[Squadron],
|
||||
roster: Optional[FlightRoster],
|
||||
idx: int,
|
||||
pilots_changed: Signal,
|
||||
) -> None:
|
||||
super().__init__()
|
||||
self.roster = roster
|
||||
self.pilot_index = idx
|
||||
self.pilots_changed = pilots_changed
|
||||
|
||||
self.selector = PilotSelector(squadron, roster, idx)
|
||||
self.selector.currentIndexChanged.connect(self.on_pilot_changed)
|
||||
@@ -131,6 +136,8 @@ class PilotControls(QHBoxLayout):
|
||||
pilot.player = checked
|
||||
self.player_toggled.emit()
|
||||
|
||||
self.pilots_changed.emit()
|
||||
|
||||
def on_pilot_changed(self, index: int) -> None:
|
||||
pilot = self.selector.itemData(index)
|
||||
self.player_checkbox.blockSignals(True)
|
||||
@@ -143,6 +150,10 @@ class PilotControls(QHBoxLayout):
|
||||
if self.roster is not None:
|
||||
self.player_checkbox.setEnabled(self.roster.squadron.aircraft.flyable)
|
||||
self.player_checkbox.blockSignals(False)
|
||||
# on_pilot_changed should emit pilots_changed in its finally block,
|
||||
# otherwise the start-type isn't updated if you have a single client
|
||||
# pilot which you switch to a non-client pilot
|
||||
self.pilots_changed.emit()
|
||||
|
||||
def update_available_pilots(self) -> None:
|
||||
self.selector.rebuild()
|
||||
@@ -174,9 +185,12 @@ class PilotControls(QHBoxLayout):
|
||||
|
||||
class FlightRosterEditor(QVBoxLayout):
|
||||
MAX_PILOTS = 4
|
||||
pilots_changed = Signal()
|
||||
|
||||
def __init__(
|
||||
self, squadron: Optional[Squadron], roster: Optional[IFlightRoster]
|
||||
self,
|
||||
squadron: Optional[Squadron],
|
||||
roster: Optional[IFlightRoster],
|
||||
) -> None:
|
||||
super().__init__()
|
||||
self.roster = roster
|
||||
@@ -190,7 +204,7 @@ class FlightRosterEditor(QVBoxLayout):
|
||||
|
||||
return callback
|
||||
|
||||
controls = PilotControls(squadron, roster, pilot_idx)
|
||||
controls = PilotControls(squadron, roster, pilot_idx, self.pilots_changed)
|
||||
controls.selector.available_pilots_changed.connect(
|
||||
make_reset_callback(pilot_idx)
|
||||
)
|
||||
@@ -226,7 +240,12 @@ class FlightRosterEditor(QVBoxLayout):
|
||||
class QFlightSlotEditor(QGroupBox):
|
||||
flight_resized = Signal(int)
|
||||
|
||||
def __init__(self, package_model: PackageModel, flight: Flight, game: Game):
|
||||
def __init__(
|
||||
self,
|
||||
package_model: PackageModel,
|
||||
flight: Flight,
|
||||
game: Game,
|
||||
):
|
||||
super().__init__("Slots")
|
||||
self.package_model = package_model
|
||||
self.flight = flight
|
||||
|
||||
@@ -43,6 +43,25 @@ class QFlightStartType(QGroupBox):
|
||||
)
|
||||
self.setLayout(self.layout)
|
||||
|
||||
def on_pilot_selected(self):
|
||||
# Pilot selection detected. If this is a player flight, set start_type
|
||||
# as configured for players in the settings.
|
||||
# Otherwise, set the start_type as configured for AI.
|
||||
# https://github.com/dcs-liberation/dcs_liberation/issues/1567
|
||||
|
||||
if self.flight.roster.player_count > 0:
|
||||
self.flight.start_type = (
|
||||
self.flight.coalition.game.settings.default_start_type_client
|
||||
)
|
||||
else:
|
||||
self.flight.start_type = (
|
||||
self.flight.coalition.game.settings.default_start_type
|
||||
)
|
||||
|
||||
self.start_type.setCurrentText(self.flight.start_type.value)
|
||||
|
||||
self.package_model.update_tot()
|
||||
|
||||
def _on_start_type_selected(self):
|
||||
selected = self.start_type.currentData()
|
||||
self.flight.start_type = selected
|
||||
|
||||
@@ -38,6 +38,17 @@ class QGeneralFlightSettingsTab(QFrame):
|
||||
self.flight_slot_editor.flight_resized.connect(self.flight_size_changed)
|
||||
for pc in self.flight_slot_editor.roster_editor.pilot_controls:
|
||||
pc.player_toggled.connect(self.on_player_toggle)
|
||||
pc.player_toggled.connect(
|
||||
self.flight_slot_editor.roster_editor.pilots_changed
|
||||
)
|
||||
|
||||
start_type = QFlightStartType(
|
||||
package_model,
|
||||
flight,
|
||||
)
|
||||
|
||||
roster = self.flight_slot_editor.roster_editor
|
||||
roster.pilots_changed.connect(start_type.on_pilot_selected)
|
||||
|
||||
widgets = [
|
||||
QFlightTypeTaskInfo(flight),
|
||||
@@ -46,7 +57,7 @@ class QGeneralFlightSettingsTab(QFrame):
|
||||
game.game, package_model, flight, flight_wpt_list
|
||||
),
|
||||
self.flight_slot_editor,
|
||||
QFlightStartType(package_model, flight),
|
||||
start_type,
|
||||
QFlightCustomName(flight),
|
||||
]
|
||||
layout = QGridLayout()
|
||||
|
||||
@@ -154,34 +154,34 @@ class GeneratorOptions(QtWidgets.QWizardPage):
|
||||
modLayout_row = 1
|
||||
|
||||
mod_pairs = [
|
||||
("F9F Panther (v2.8.7.101)", self.f9f_panther),
|
||||
("A-4E Skyhawk (v2.2.0)", self.a4_skyhawk),
|
||||
("A-6A Intruder (v2.7.5.01)", self.a6a_intruder),
|
||||
("A-7E Corsair II", self.a7e_corsair2),
|
||||
("C-130J-30 Super Hercules", self.hercules),
|
||||
("F-4B/C Phantom II (2.8.7.204)", self.f4bc_phantom),
|
||||
("F-15D Baz (v1.0)", self.f15d_baz),
|
||||
("F-15I Ra'am (v1.0 by IDF Mods Project)", self.f_15_idf),
|
||||
("F-16I Sufa & F-16D (v3.6 by IDF Mods Project)", self.f_16_idf),
|
||||
("F/A-18E/F/G Super Hornet (version 2.2.5)", self.fa_18efg),
|
||||
("F/A-18E/F Super Hornet AI Tanker (version 1.4)", self.fa18ef_tanker),
|
||||
("F-22A Raptor", self.f22_raptor),
|
||||
("F-84G Thunderjet (v2.5.7.01)", self.f84g_thunderjet),
|
||||
("C-130J-30 Super Hercules (v6.8.2)", self.hercules),
|
||||
("F-100 Super Sabre (v2.7.18.30765 patch 20.10.22)", self.f100_supersabre),
|
||||
("F-104 Starfighter (v2.7.11.222.01)", self.f104_starfighter),
|
||||
("F-105 Thunderchief (v2.7.12.23x)", self.f105_thunderchief),
|
||||
("Frenchpack", self.frenchpack),
|
||||
("F-15D Baz (v1.0)", self.f15d_baz),
|
||||
("F-15I Ra'am (v1.0 by IDF Mods Project)", self.f_15_idf),
|
||||
("F-16I Sufa & F-16D (v3.6 by IDF Mods Project)", self.f_16_idf),
|
||||
("F-22A Raptor", self.f22_raptor),
|
||||
("F-4B/C Phantom II (2.8.7.204)", self.f4bc_phantom),
|
||||
("F-84G Thunderjet (v2.5.7.01)", self.f84g_thunderjet),
|
||||
("F9F Panther (v2.8.7.101)", self.f9f_panther),
|
||||
("F/A-18E/F Super Hornet AI Tanker (version 1.4)", self.fa18ef_tanker),
|
||||
("F/A-18E/F/G Super Hornet (version 2.2.5)", self.fa_18efg),
|
||||
("Frenchpack (v4.9.1)", self.frenchpack),
|
||||
("High Digit SAMs", self.high_digit_sams),
|
||||
("Swedish Military Assets pack (1.10)", self.swedishmilitaryassetspack),
|
||||
("IDF Assets Pack (v1.1 by IDF Mods Project)", self.irondome),
|
||||
("JAS 39 Gripen (v1.8.5-beta)", self.jas39_gripen),
|
||||
("OV-10A Bronco", self.ov10a_bronco),
|
||||
("Super Étendard (v2.5.5)", self.super_etendard),
|
||||
("Su-30 Flanker-H (V2.7.3 beta)", self.su30_flanker_h),
|
||||
("Su-57 Felon (build-04)", self.su57_felon),
|
||||
("UH-60L Black Hawk (v1.3.1)", self.uh_60l),
|
||||
("Star Wars Modpack 2.54+", self.SWPack),
|
||||
("Spanish Naval Assets pack (desdemicabina 3.2.0)", self.spanishnavypack),
|
||||
("IDF Assets Pack (v1.1 by IDF Mods Project)", self.irondome),
|
||||
("Star Wars Modpack 2.54+", self.SWPack),
|
||||
("Su-30 Flanker-H (V2.7.3 beta)", self.su30_flanker_h),
|
||||
("Su-57 Felon (build-04)", self.su57_felon),
|
||||
("Super Étendard (v2.5.5)", self.super_etendard),
|
||||
("Swedish Military Assets pack (1.10)", self.swedishmilitaryassetspack),
|
||||
("UH-60L Black Hawk (v1.3.1)", self.uh_60l),
|
||||
]
|
||||
|
||||
for i in range(len(mod_pairs)):
|
||||
|
||||
@@ -148,7 +148,7 @@ class QLiberationPreferences(QFrame):
|
||||
"You set an empty DCS Installation directory! "
|
||||
"<br/><br/>Without this directory, DCS Retribution can not replace the MissionScripting.lua for you and will not work properly. "
|
||||
"In this case, you need to edit the MissionScripting.lua yourself. The easiest way to do it is to replace the original file (<dcs_installation_directory>/Scripts/MissionScripting.lua) with the file in dcs-liberation distribution (<dcs_liberation_installation>/resources/scripts/MissionScripting.lua)."
|
||||
"<br/><br/>You can find more information on how to manually change this file in the Liberation Wiki (Page: Dedicated Server Guide) on GitHub.</p>"
|
||||
"<br/><br/>You can find more information on how to manually change this file in the Retribution Wiki (Page: Dedicated Server Guide) on GitHub.</p>"
|
||||
"<br/><br/>Are you sure that you want to leave the installation directory empty?"
|
||||
"<br/><br/><strong>This is only recommended for expert users!</strong>",
|
||||
QMessageBox.StandardButton.Yes,
|
||||
@@ -164,7 +164,7 @@ class QLiberationPreferences(QFrame):
|
||||
+ " is not a valid directory. DCS Retribution requires the installation directory to replace the MissionScripting.lua"
|
||||
"<br/><br/>If you ignore this Error, DCS Retribution can not work properly and needs your attention. "
|
||||
"In this case, you need to edit the MissionScripting.lua yourself. The easiest way to do it is to replace the original file (<dcs_installation_directory>/Scripts/MissionScripting.lua) with the file in dcs-liberation distribution (<dcs_liberation_installation>/resources/scripts/MissionScripting.lua)."
|
||||
"<br/><br/>You can find more information on how to manually change this file in the Liberation Wiki (Page: Dedicated Server Guide) on GitHub.</p>"
|
||||
"<br/><br/>You can find more information on how to manually change this file in the Retribution Wiki (Page: Dedicated Server Guide) on GitHub.</p>"
|
||||
"<br/><br/><strong>This is only recommended for expert users!</strong>",
|
||||
QMessageBox.StandardButton.Ignore,
|
||||
QMessageBox.StandardButton.Ok,
|
||||
|
||||
Reference in New Issue
Block a user