From cdde75b5171ce711786bb07b84fa8124db438b2a Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Sun, 1 Nov 2020 14:13:06 -0800 Subject: [PATCH] Add option to avoid delaying player flights. Fixes https://github.com/Khopa/dcs_liberation/issues/227 --- game/settings.py | 3 ++- gen/aircraft.py | 19 ++++++++++--------- qt_ui/windows/settings/QSettingsWindow.py | 16 +++++++++++++++- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/game/settings.py b/game/settings.py index 11ba0753..97626940 100644 --- a/game/settings.py +++ b/game/settings.py @@ -44,10 +44,11 @@ class Settings: for plugin in LuaPluginManager().getPlugins(): plugin.setSettings(self) - # Cheating self.show_red_ato = False + self.never_delay_player_flights = False + def __setstate__(self, state) -> None: # __setstate__ is called with the dict of the object being unpickled. We # can provide save compatibility for new settings options (which diff --git a/gen/aircraft.py b/gen/aircraft.py index 55ad44ce..fd472e1a 100644 --- a/gen/aircraft.py +++ b/gen/aircraft.py @@ -1066,15 +1066,16 @@ class AircraftConflictGenerator: estimator = TotEstimator(package) start_time = estimator.mission_start_time(flight) - if start_time.total_seconds() > 0: - if self.should_activate_late(flight): - # Late activation causes the aircraft to not be spawned until - # triggered. - self.set_activation_time(flight, group, start_time) - elif flight.start_type == "Cold": - # Setting the start time causes the AI to wait until the - # specified time to begin their startup sequence. - self.set_startup_time(flight, group, start_time) + if flight.client_count and not self.settings.never_delay_player_flights: + if start_time.total_seconds() > 0: + if self.should_activate_late(flight): + # Late activation causes the aircraft to not be spawned + # until triggered. + self.set_activation_time(flight, group, start_time) + elif flight.start_type == "Cold": + # Setting the start time causes the AI to wait until the + # specified time to begin their startup sequence. + self.set_startup_time(flight, group, start_time) # And setting *our* waypoint TOT causes the takeoff time to show up in # the player's kneeboard. diff --git a/qt_ui/windows/settings/QSettingsWindow.py b/qt_ui/windows/settings/QSettingsWindow.py index 1f1053ed..3597a179 100644 --- a/qt_ui/windows/settings/QSettingsWindow.py +++ b/qt_ui/windows/settings/QSettingsWindow.py @@ -205,7 +205,7 @@ class QSettingsWindow(QDialog): self.generatorPage.setLayout(self.generatorLayout) self.gameplay = QGroupBox("Gameplay") - self.gameplayLayout = QGridLayout(); + self.gameplayLayout = QGridLayout() self.gameplayLayout.setAlignment(Qt.AlignTop) self.gameplay.setLayout(self.gameplayLayout) @@ -217,10 +217,23 @@ class QSettingsWindow(QDialog): self.generate_marks.setChecked(self.game.settings.generate_marks) self.generate_marks.toggled.connect(self.applySettings) + self.never_delay_players = QCheckBox() + self.never_delay_players.setChecked( + self.game.settings.never_delay_player_flights) + self.never_delay_players.toggled.connect(self.applySettings) + self.never_delay_players.setToolTip( + "When checked, player flights with a delayed start time will be " + "spawned immediately. AI wingmen may begin startup immediately." + ) + self.gameplayLayout.addWidget(QLabel("Use Supercarrier Module"), 0, 0) self.gameplayLayout.addWidget(self.supercarrier, 0, 1, Qt.AlignRight) self.gameplayLayout.addWidget(QLabel("Put Objective Markers on Map"), 1, 0) self.gameplayLayout.addWidget(self.generate_marks, 1, 1, Qt.AlignRight) + self.gameplayLayout.addWidget( + QLabel("Never delay player flights"), 2, 0) + self.gameplayLayout.addWidget(self.never_delay_players, 2, 1, + Qt.AlignRight) self.performance = QGroupBox("Performance") self.performanceLayout = QGridLayout() @@ -366,6 +379,7 @@ class QSettingsWindow(QDialog): self.game.settings.map_coalition_visibility = self.mapVisibiitySelection.currentData() self.game.settings.external_views_allowed = self.ext_views.isChecked() self.game.settings.generate_marks = self.generate_marks.isChecked() + self.game.settings.never_delay_player_flights = self.never_delay_players.isChecked() self.game.settings.supercarrier = self.supercarrier.isChecked()