From 626740366bec594f6ee441bf63b43d4d6aeacbbe Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Thu, 21 Oct 2021 19:54:58 -0700 Subject: [PATCH] Port the mission generator settings to auto. Done now. Not porting the cheat menu because it contains non-settings elements as well. --- game/settings/__init__.py | 1 + game/settings/booleanoption.py | 5 +- game/settings/boundedfloatoption.py | 3 +- game/settings/boundedintoption.py | 3 +- game/settings/choicesoption.py | 2 + game/settings/minutesoption.py | 33 ++ game/settings/optiondescription.py | 1 + game/settings/settings.py | 156 ++++++++- game/settings/skilloption.py | 2 + qt_ui/uiconstants.py | 1 + qt_ui/widgets/spinsliders.py | 17 +- qt_ui/windows/newgame/QNewGameWizard.py | 5 +- qt_ui/windows/settings/QSettingsWindow.py | 401 +--------------------- 13 files changed, 214 insertions(+), 416 deletions(-) create mode 100644 game/settings/minutesoption.py diff --git a/game/settings/__init__.py b/game/settings/__init__.py index 21fb5f7e..5fffc6d3 100644 --- a/game/settings/__init__.py +++ b/game/settings/__init__.py @@ -2,5 +2,6 @@ from .booleanoption import BooleanOption from .boundedfloatoption import BoundedFloatOption from .boundedintoption import BoundedIntOption from .choicesoption import ChoicesOption +from .minutesoption import MinutesOption from .optiondescription import OptionDescription from .settings import AutoAtoBehavior, Settings diff --git a/game/settings/booleanoption.py b/game/settings/booleanoption.py index 7f1ed4e1..07686547 100644 --- a/game/settings/booleanoption.py +++ b/game/settings/booleanoption.py @@ -16,11 +16,14 @@ def boolean_option( default: bool, invert: bool = False, detail: Optional[str] = None, + tooltip: Optional[str] = None, **kwargs: Any, ) -> bool: return field( metadata={ - SETTING_DESCRIPTION_KEY: BooleanOption(page, section, text, detail, invert) + SETTING_DESCRIPTION_KEY: BooleanOption( + page, section, text, detail, tooltip, invert + ) }, default=default, **kwargs, diff --git a/game/settings/boundedfloatoption.py b/game/settings/boundedfloatoption.py index d2e15de7..45f336d6 100644 --- a/game/settings/boundedfloatoption.py +++ b/game/settings/boundedfloatoption.py @@ -20,12 +20,13 @@ def bounded_float_option( max: float, divisor: int, detail: Optional[str] = None, + tooltip: Optional[str] = None, **kwargs: Any, ) -> float: return field( metadata={ SETTING_DESCRIPTION_KEY: BoundedFloatOption( - page, section, text, detail, min, max, divisor + page, section, text, detail, tooltip, min, max, divisor ) }, default=default, diff --git a/game/settings/boundedintoption.py b/game/settings/boundedintoption.py index 4cc9901b..770b3b70 100644 --- a/game/settings/boundedintoption.py +++ b/game/settings/boundedintoption.py @@ -18,12 +18,13 @@ def bounded_int_option( min: int, max: int, detail: Optional[str] = None, + tooltip: Optional[str] = None, **kwargs: Any, ) -> int: return field( metadata={ SETTING_DESCRIPTION_KEY: BoundedIntOption( - page, section, text, detail, min, max + page, section, text, detail, tooltip, min, max ) }, default=default, diff --git a/game/settings/choicesoption.py b/game/settings/choicesoption.py index 737ae265..463fae95 100644 --- a/game/settings/choicesoption.py +++ b/game/settings/choicesoption.py @@ -24,6 +24,7 @@ def choices_option( default: ValueT, choices: Union[Iterable[str], Mapping[str, ValueT]], detail: Optional[str] = None, + tooltip: Optional[str] = None, **kwargs: Any, ) -> ValueT: if not isinstance(choices, Mapping): @@ -35,6 +36,7 @@ def choices_option( section, text, detail, + tooltip, dict(choices), ) }, diff --git a/game/settings/minutesoption.py b/game/settings/minutesoption.py new file mode 100644 index 00000000..c03c20a6 --- /dev/null +++ b/game/settings/minutesoption.py @@ -0,0 +1,33 @@ +from dataclasses import dataclass, field +from datetime import timedelta +from typing import Any, Optional + +from .optiondescription import OptionDescription, SETTING_DESCRIPTION_KEY + + +@dataclass(frozen=True) +class MinutesOption(OptionDescription): + min: int + max: int + + +def minutes_option( + text: str, + page: str, + section: str, + default: timedelta, + min: int, + max: int, + detail: Optional[str] = None, + tooltip: Optional[str] = None, + **kwargs: Any, +) -> timedelta: + return field( + metadata={ + SETTING_DESCRIPTION_KEY: MinutesOption( + page, section, text, detail, tooltip, min, max + ) + }, + default=default, + **kwargs, + ) diff --git a/game/settings/optiondescription.py b/game/settings/optiondescription.py index edd3a78b..e960b730 100644 --- a/game/settings/optiondescription.py +++ b/game/settings/optiondescription.py @@ -11,3 +11,4 @@ class OptionDescription: section: str text: str detail: Optional[str] + tooltip: Optional[str] diff --git a/game/settings/settings.py b/game/settings/settings.py index 40050cad..53f48c8d 100644 --- a/game/settings/settings.py +++ b/game/settings/settings.py @@ -10,6 +10,7 @@ from .booleanoption import boolean_option from .boundedfloatoption import bounded_float_option from .boundedintoption import bounded_int_option from .choicesoption import choices_option +from .minutesoption import minutes_option from .optiondescription import OptionDescription, SETTING_DESCRIPTION_KEY from .skilloption import skill_option @@ -34,6 +35,15 @@ GENERAL_SECTION = "General" PILOTS_AND_SQUADRONS_SECTION = "Pilots and Squadrons" HQ_AUTOMATION_SECTION = "HQ Automation" +MISSION_GENERATOR_PAGE = "Mission Generator" + +GAMEPLAY_SECTION = "Gameplay" + +# TODO: Make sections a type and add headers. +# This section had the header: "Disabling settings below may improve performance, but +# will impact the overall quality of the experience." +PERFORMANCE_SECTION = "Performance" + @dataclass class Settings: @@ -275,27 +285,135 @@ class Settings: # Mission Generator # Gameplay - supercarrier: bool = False - generate_marks: bool = True - generate_dark_kneeboard: bool = False - never_delay_player_flights: bool = False - default_start_type: str = "Cold" + supercarrier: bool = boolean_option( + "Use supercarrier module", + MISSION_GENERATOR_PAGE, + GAMEPLAY_SECTION, + default=False, + ) + generate_marks: bool = boolean_option( + "Put objective markers on the map", + MISSION_GENERATOR_PAGE, + GAMEPLAY_SECTION, + default=True, + ) + generate_dark_kneeboard: bool = boolean_option( + "Generate dark kneeboard", + MISSION_GENERATOR_PAGE, + GAMEPLAY_SECTION, + default=False, + detail=( + "Dark kneeboard for night missions. This will likely make the kneeboard on " + "the pilot leg unreadable." + ), + ) + never_delay_player_flights: bool = boolean_option( + "Player flights ignore TOT and spawn immediately", + MISSION_GENERATOR_PAGE, + GAMEPLAY_SECTION, + default=False, + detail=( + "Does not adjust package waypoint times. Should not be used if players " + "have runway or in-air starts." + ), + tooltip=( + "Always spawns player aircraft immediately, even if their start time is " + "more than 10 minutes after the start of the mission. This does " + "not alter the timing of your mission. Your TOT will not change. This " + "option only allows the player to wait on the ground." + ), + ) + default_start_type: str = choices_option( + "Default start type for AI aircraft", + page=MISSION_GENERATOR_PAGE, + section=GAMEPLAY_SECTION, + choices=["Cold", "Warm", "Runway", "In Flight"], + default="Cold", + detail=( + "Warning: Options other than Cold will significantly reduce the number of " + "targets available for OCA/Aircraft missions, and OCA/Aircraft flights " + "will not be included in automatically planned OCA packages." + ), + ) # Mission specific - desired_player_mission_duration: timedelta = timedelta(minutes=60) - # Performance - perf_smoke_gen: bool = True - perf_smoke_spacing = 1600 - perf_red_alert_state: bool = True - perf_artillery: bool = True - perf_moving_units: bool = True - perf_infantry: bool = True - perf_destroyed_units: bool = True - # Performance culling - perf_culling: bool = False - perf_culling_distance: int = 100 - perf_do_not_cull_carrier = True + desired_player_mission_duration: timedelta = minutes_option( + "Desired mission duration", + page=MISSION_GENERATOR_PAGE, + section=GAMEPLAY_SECTION, + default=timedelta(minutes=60), + min=30, + max=150, + ) - # Cheating + # Performance + perf_smoke_gen: bool = boolean_option( + "Smoke visual effect on the front line", + page=MISSION_GENERATOR_PAGE, + section=PERFORMANCE_SECTION, + default=True, + ) + perf_smoke_spacing: int = bounded_int_option( + "Smoke generator spacing (higher means less smoke)", + page=MISSION_GENERATOR_PAGE, + section=PERFORMANCE_SECTION, + default=1600, + min=800, + max=24000, + ) + perf_red_alert_state: bool = boolean_option( + "SAM starts in red alert mode", + page=MISSION_GENERATOR_PAGE, + section=PERFORMANCE_SECTION, + default=True, + ) + perf_artillery: bool = boolean_option( + "Artillery strikes", + page=MISSION_GENERATOR_PAGE, + section=PERFORMANCE_SECTION, + default=True, + ) + perf_moving_units: bool = boolean_option( + "Moving ground units", + page=MISSION_GENERATOR_PAGE, + section=PERFORMANCE_SECTION, + default=True, + ) + perf_infantry: bool = boolean_option( + "Generate infantry squads alongside vehicles", + page=MISSION_GENERATOR_PAGE, + section=PERFORMANCE_SECTION, + default=True, + ) + perf_destroyed_units: bool = boolean_option( + "Generate carcasses for units destroyed in previous turns", + page=MISSION_GENERATOR_PAGE, + section=PERFORMANCE_SECTION, + default=True, + ) + # Performance culling + perf_culling: bool = boolean_option( + "Culling of distant units enabled", + page=MISSION_GENERATOR_PAGE, + section=PERFORMANCE_SECTION, + default=False, + ) + perf_culling_distance: int = bounded_int_option( + "Culling distance (km)", + page=MISSION_GENERATOR_PAGE, + section=PERFORMANCE_SECTION, + default=100, + min=10, + max=10000, + ) + perf_do_not_cull_carrier: bool = boolean_option( + "Do not cull carrier's surroundings", + page=MISSION_GENERATOR_PAGE, + section=PERFORMANCE_SECTION, + default=True, + ) + + # Cheating. Not using auto settings because the same page also has buttons which do + # not alter settings. show_red_ato: bool = False enable_frontline_cheats: bool = False enable_base_capture_cheat: bool = False diff --git a/game/settings/skilloption.py b/game/settings/skilloption.py index 59d26611..4f6b582e 100644 --- a/game/settings/skilloption.py +++ b/game/settings/skilloption.py @@ -9,6 +9,7 @@ def skill_option( section: str, default: str, detail: Optional[str] = None, + tooltip: Optional[str] = None, **kwargs: Any, ) -> str: return choices_option( @@ -18,5 +19,6 @@ def skill_option( default, ["Average", "Good", "High", "Excellent"], detail=detail, + tooltip=tooltip, **kwargs, ) diff --git a/qt_ui/uiconstants.py b/qt_ui/uiconstants.py index b935538f..ceab4893 100644 --- a/qt_ui/uiconstants.py +++ b/qt_ui/uiconstants.py @@ -98,6 +98,7 @@ def load_icons(): ICONS["Generator"] = QPixmap( "./resources/ui/misc/" + get_theme_icons() + "/generator.png" ) + ICONS["Mission Generation"] = ICONS["Generator"] ICONS["Missile"] = QPixmap( "./resources/ui/misc/" + get_theme_icons() + "/missile.png" ) diff --git a/qt_ui/widgets/spinsliders.py b/qt_ui/widgets/spinsliders.py index 0b85f6da..1f808f2a 100644 --- a/qt_ui/widgets/spinsliders.py +++ b/qt_ui/widgets/spinsliders.py @@ -30,25 +30,22 @@ class FloatSpinSlider(QHBoxLayout): return self.spinner.real_value -class TimeInputs(QtWidgets.QGridLayout): - def __init__(self, label: str, initial: timedelta) -> None: +class TimeInputs(QtWidgets.QHBoxLayout): + def __init__(self, initial: timedelta, minimum: int, maximum: int) -> None: super().__init__() - self.addWidget(QtWidgets.QLabel(label), 0, 0) - minimum_minutes = 30 - maximum_minutes = 150 initial_minutes = int(initial.total_seconds() / 60) slider = QtWidgets.QSlider(Qt.Horizontal) - slider.setMinimum(minimum_minutes) - slider.setMaximum(maximum_minutes) + slider.setMinimum(minimum) + slider.setMaximum(maximum) slider.setValue(initial_minutes) - self.spinner = TimeSpinner(minimum_minutes, maximum_minutes, initial_minutes) + self.spinner = TimeSpinner(minimum, maximum, initial_minutes) slider.valueChanged.connect(lambda x: self.spinner.setValue(x)) self.spinner.valueChanged.connect(lambda x: slider.setValue(x)) - self.addWidget(slider, 1, 0) - self.addWidget(self.spinner, 1, 1) + self.addWidget(slider) + self.addWidget(self.spinner) @property def value(self) -> timedelta: diff --git a/qt_ui/windows/newgame/QNewGameWizard.py b/qt_ui/windows/newgame/QNewGameWizard.py index 7be0cc76..222ef1e3 100644 --- a/qt_ui/windows/newgame/QNewGameWizard.py +++ b/qt_ui/windows/newgame/QNewGameWizard.py @@ -535,7 +535,7 @@ class GeneratorOptions(QtWidgets.QWizardPage): no_enemy_navy = QtWidgets.QCheckBox() self.registerField("no_enemy_navy", no_enemy_navy) desired_player_mission_duration = TimeInputs( - "Desired mission duration", DEFAULT_MISSION_LENGTH + DEFAULT_MISSION_LENGTH, minimum=30, maximum=150 ) self.registerField( "desired_player_mission_duration", desired_player_mission_duration.spinner @@ -552,7 +552,8 @@ class GeneratorOptions(QtWidgets.QWizardPage): generatorLayout.addWidget(no_player_navy, 4, 1) generatorLayout.addWidget(QtWidgets.QLabel("No Enemy Navy"), 5, 0) generatorLayout.addWidget(no_enemy_navy, 5, 1) - generatorLayout.addLayout(desired_player_mission_duration, 6, 0) + generatorLayout.addWidget(QtWidgets.QLabel("Desired mission duration"), 6, 0) + generatorLayout.addLayout(desired_player_mission_duration, 7, 0) generatorSettingsGroup.setLayout(generatorLayout) modSettingsGroup = QtWidgets.QGroupBox("Mod Settings") diff --git a/qt_ui/windows/settings/QSettingsWindow.py b/qt_ui/windows/settings/QSettingsWindow.py index 7adce5f7..c431211d 100644 --- a/qt_ui/windows/settings/QSettingsWindow.py +++ b/qt_ui/windows/settings/QSettingsWindow.py @@ -27,13 +27,13 @@ from game.settings import ( BoundedFloatOption, BoundedIntOption, ChoicesOption, + MinutesOption, OptionDescription, Settings, ) from qt_ui.widgets.QLabeledWidget import QLabeledWidget from qt_ui.widgets.spinsliders import FloatSpinSlider, TimeInputs from qt_ui.windows.GameUpdateSignal import GameUpdateSignal -from qt_ui.windows.finances.QFinancesMenu import QHorizontalSeparationLine from qt_ui.windows.settings.plugins import PluginOptionsPage, PluginsPage @@ -81,131 +81,6 @@ class CheatSettingsBox(QGroupBox): return self.base_capture_cheat_checkbox.isChecked() -class PilotSettingsBox(QGroupBox): - def __init__(self, game: Game) -> None: - super().__init__("Pilots and Squadrons") - self.game = game - - layout = QGridLayout() - self.setLayout(layout) - - self.ai_pilot_levelling = QCheckBox() - self.ai_pilot_levelling.setChecked(self.game.settings.ai_pilot_levelling) - self.ai_pilot_levelling.toggled.connect(self.set_ai_pilot_leveling) - - ai_pilot_levelling_info = ( - "Set whether or not AI pilots will level up after completing a number of" - " sorties. Since pilot level affects the AI skill, you may wish to disable" - " this, lest you face an Ace!" - ) - - self.ai_pilot_levelling.setToolTip(ai_pilot_levelling_info) - ai_pilot_levelling_label = QLabel("Allow AI pilot levelling") - ai_pilot_levelling_label.setToolTip(ai_pilot_levelling_info) - - layout.addWidget(ai_pilot_levelling_label, 0, 0) - layout.addWidget(self.ai_pilot_levelling, 0, 1, Qt.AlignRight) - - enable_squadron_pilot_limits_info = ( - "If set, squadrons will be limited to a maximum number of pilots and dead " - "pilots will replenish at a fixed rate, each defined with the settings" - "below. Auto-purchase may buy aircraft for which there are no pilots" - "available, so this feature is still a work-in-progress." - ) - - enable_squadron_pilot_limits_label = QLabel( - "Enable per-squadron pilot limits (WIP)" - ) - enable_squadron_pilot_limits_label.setToolTip(enable_squadron_pilot_limits_info) - enable_squadron_pilot_limits = QCheckBox() - enable_squadron_pilot_limits.setToolTip(enable_squadron_pilot_limits_info) - enable_squadron_pilot_limits.setChecked( - self.game.settings.enable_squadron_pilot_limits - ) - enable_squadron_pilot_limits.toggled.connect( - self.set_enable_squadron_pilot_limits - ) - - layout.addWidget(enable_squadron_pilot_limits_label, 1, 0) - layout.addWidget(enable_squadron_pilot_limits, 1, 1, Qt.AlignRight) - - self.pilot_limit = QSpinBox() - self.pilot_limit.setMinimum(12) - self.pilot_limit.setMaximum(72) - self.pilot_limit.setValue(self.game.settings.squadron_pilot_limit) - self.pilot_limit.setEnabled(self.game.settings.enable_squadron_pilot_limits) - self.pilot_limit.valueChanged.connect(self.set_squadron_pilot_limit) - - pilot_limit_info = ( - "Sets the maximum number of pilots a squadron may have active. " - "Changing this value will not have an immediate effect, but will alter " - "replenishment for future turns." - ) - - self.pilot_limit.setToolTip(pilot_limit_info) - pilot_limit_label = QLabel("Maximum number of pilots per squadron") - pilot_limit_label.setToolTip(pilot_limit_info) - - layout.addWidget(pilot_limit_label, 2, 0) - layout.addWidget(self.pilot_limit, 2, 1, Qt.AlignRight) - - self.squadron_replenishment_rate = QSpinBox() - self.squadron_replenishment_rate.setMinimum(1) - self.squadron_replenishment_rate.setMaximum(20) - self.squadron_replenishment_rate.setValue( - self.game.settings.squadron_replenishment_rate - ) - self.squadron_replenishment_rate.setEnabled( - self.game.settings.enable_squadron_pilot_limits - ) - self.squadron_replenishment_rate.valueChanged.connect( - self.set_squadron_replenishment_rate - ) - - squadron_replenishment_rate_info = ( - "Sets the maximum number of pilots that will be recruited to each squadron " - "at the end of each turn. Squadrons will not recruit new pilots beyond the " - "pilot limit, but each squadron with room for more pilots will recruit " - "this many pilots each turn up to the limit." - ) - - self.squadron_replenishment_rate.setToolTip(squadron_replenishment_rate_info) - squadron_replenishment_rate_label = QLabel("Squadron pilot replenishment rate") - squadron_replenishment_rate_label.setToolTip(squadron_replenishment_rate_info) - - layout.addWidget(squadron_replenishment_rate_label, 3, 0) - layout.addWidget(self.squadron_replenishment_rate, 3, 1, Qt.AlignRight) - - def set_enable_squadron_pilot_limits(self, checked: bool) -> None: - self.game.settings.enable_squadron_pilot_limits = checked - self.pilot_limit.setEnabled(checked) - self.squadron_replenishment_rate.setEnabled(checked) - - def set_squadron_pilot_limit(self, value: int) -> None: - self.game.settings.squadron_pilot_limit = value - - def set_squadron_replenishment_rate(self, value: int) -> None: - self.game.settings.squadron_replenishment_rate = value - - def set_ai_pilot_leveling(self, checked: bool) -> None: - self.game.settings.ai_pilot_levelling = checked - - -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 AutoSettingsLayout(QGridLayout): def __init__(self, page: str, section: str, settings: Settings) -> None: super().__init__() @@ -221,6 +96,8 @@ class AutoSettingsLayout(QGridLayout): self.add_float_spin_slider_for(row, name, description) elif isinstance(description, BoundedIntOption): self.add_spinner_for(row, name, description) + elif isinstance(description, MinutesOption): + self.add_duration_controls_for(row, name, description) else: raise TypeError(f"Unhandled option type: {description}") @@ -230,6 +107,8 @@ class AutoSettingsLayout(QGridLayout): wrapped = "
".join(textwrap.wrap(description.detail, width=55)) text += f"
{wrapped}" label = QLabel(text) + if description.tooltip is not None: + label.setToolTip(description.tooltip) self.addWidget(label, row, 0) def add_checkbox_for(self, row: int, name: str, description: BooleanOption) -> None: @@ -290,6 +169,19 @@ class AutoSettingsLayout(QGridLayout): spinner.valueChanged.connect(on_changed) self.addWidget(spinner, row, 1, Qt.AlignRight) + def add_duration_controls_for( + self, row: int, name: str, description: MinutesOption + ) -> None: + inputs = TimeInputs( + self.settings.__dict__[name], description.min, description.max + ) + + def on_changed() -> None: + self.settings.__dict__[name] = inputs.value + + inputs.spinner.valueChanged.connect(on_changed) + self.addLayout(inputs, row, 1, Qt.AlignRight) + class AutoSettingsGroup(QGroupBox): def __init__(self, page: str, section: str, settings: Settings) -> None: @@ -354,14 +246,6 @@ class QSettingsWindow(QDialog): self.categoryModel.appendRow(page_item) self.right_layout.addWidget(page) - self.initGeneratorLayout() - generator = QStandardItem("Mission Generator") - generator.setIcon(CONST.ICONS["Generator"]) - generator.setEditable(False) - generator.setSelectable(True) - self.categoryModel.appendRow(generator) - self.right_layout.addWidget(self.generatorPage) - self.initCheatLayout() cheat = QStandardItem("Cheat Menu") cheat.setIcon(CONST.ICONS["Cheat"]) @@ -401,202 +285,7 @@ class QSettingsWindow(QDialog): self.setLayout(self.layout) def init(self): - pass - - def initGeneratorLayout(self): - self.generatorPage = QWidget() - self.generatorLayout = QVBoxLayout() - self.generatorLayout.setAlignment(Qt.AlignTop) - self.generatorPage.setLayout(self.generatorLayout) - - self.gameplay = QGroupBox("Gameplay") - self.gameplayLayout = QGridLayout() - self.gameplayLayout.setAlignment(Qt.AlignTop) - self.gameplay.setLayout(self.gameplayLayout) - - self.supercarrier = QCheckBox() - self.supercarrier.setChecked(self.game.settings.supercarrier) - self.supercarrier.toggled.connect(self.applySettings) - - self.generate_marks = QCheckBox() - self.generate_marks.setChecked(self.game.settings.generate_marks) - self.generate_marks.toggled.connect(self.applySettings) - - self.generate_dark_kneeboard = QCheckBox() - self.generate_dark_kneeboard.setChecked( - self.game.settings.generate_dark_kneeboard - ) - self.generate_dark_kneeboard.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.desired_player_mission_duration = TimeInputs( - "Desired mission duration", - self.game.settings.desired_player_mission_duration, - ) - self.desired_player_mission_duration.spinner.valueChanged.connect( - self.applySettings - ) - - 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) - - dark_kneeboard_label = QLabel( - "Generate Dark Kneeboard
" - "Dark kneeboard for night missions.
" - "This will likely make the kneeboard on the pilot leg unreadable.
" - ) - self.gameplayLayout.addWidget(dark_kneeboard_label, 2, 0) - self.gameplayLayout.addWidget(self.generate_dark_kneeboard, 2, 1, Qt.AlignRight) - self.gameplayLayout.addLayout( - self.desired_player_mission_duration, 5, 0, Qt.AlignRight - ) - - spawn_players_immediately_tooltip = ( - "Always spawns player aircraft immediately, even if their start time is " - "more than 10 minutes after the start of the mission. This does " - "not alter the timing of your mission. Your TOT will not change. This " - "option only allows the player to wait on the ground." - ) - spawn_immediately_label = QLabel( - "Player flights ignore TOT and spawn immediately
" - "Does not adjust package waypoint times.
" - "Should not be used if players have runway or in-air starts.
" - ) - spawn_immediately_label.setToolTip(spawn_players_immediately_tooltip) - self.gameplayLayout.addWidget(spawn_immediately_label, 3, 0) - self.gameplayLayout.addWidget(self.never_delay_players, 3, 1, Qt.AlignRight) - - start_type_label = QLabel( - "Default start type for AI aircraft
Warning: " - "Options other than Cold will significantly reduce the
" - "number of targets available for OCA/Aircraft missions,
" - "and OCA/Aircraft flights will not be included in
" - "automatically planned OCA packages.
" - ) - 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, 4, 0) - self.gameplayLayout.addWidget(start_type, 4, 1) - - self.performance = QGroupBox("Performance") - self.performanceLayout = QGridLayout() - self.performanceLayout.setAlignment(Qt.AlignTop) - self.performance.setLayout(self.performanceLayout) - - self.smoke = QCheckBox() - self.smoke.setChecked(self.game.settings.perf_smoke_gen) - self.smoke.toggled.connect(self.applySettings) - - self.smoke_spacing = QSpinBox() - self.smoke_spacing.setMinimum(800) - self.smoke_spacing.setMaximum(24000) - self.smoke_spacing.setValue(self.game.settings.perf_smoke_spacing) - self.smoke_spacing.valueChanged.connect(self.applySettings) - - self.red_alert = QCheckBox() - self.red_alert.setChecked(self.game.settings.perf_red_alert_state) - self.red_alert.toggled.connect(self.applySettings) - - self.arti = QCheckBox() - self.arti.setChecked(self.game.settings.perf_artillery) - self.arti.toggled.connect(self.applySettings) - - self.moving_units = QCheckBox() - self.moving_units.setChecked(self.game.settings.perf_moving_units) - self.moving_units.toggled.connect(self.applySettings) - - self.infantry = QCheckBox() - self.infantry.setChecked(self.game.settings.perf_infantry) - self.infantry.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) - - self.culling = QCheckBox() - self.culling.setChecked(self.game.settings.perf_culling) - self.culling.toggled.connect(self.applySettings) - - self.culling_distance = QSpinBox() - self.culling_distance.setMinimum(10) - self.culling_distance.setMaximum(10000) - self.culling_distance.setValue(self.game.settings.perf_culling_distance) - self.culling_distance.valueChanged.connect(self.applySettings) - - self.culling_do_not_cull_carrier = QCheckBox() - self.culling_do_not_cull_carrier.setChecked( - self.game.settings.perf_do_not_cull_carrier - ) - self.culling_do_not_cull_carrier.toggled.connect(self.applySettings) - - self.performanceLayout.addWidget( - QLabel("Smoke visual effect on frontline"), 0, 0 - ) - self.performanceLayout.addWidget(self.smoke, 0, 1, alignment=Qt.AlignRight) - self.performanceLayout.addWidget( - QLabel("Smoke generator spacing (higher means less smoke)"), - 1, - 0, - alignment=Qt.AlignRight, - ) - self.performanceLayout.addWidget( - self.smoke_spacing, 1, 1, alignment=Qt.AlignRight - ) - self.performanceLayout.addWidget(QLabel("SAM starts in RED alert mode"), 2, 0) - self.performanceLayout.addWidget(self.red_alert, 2, 1, alignment=Qt.AlignRight) - self.performanceLayout.addWidget(QLabel("Artillery strikes"), 3, 0) - self.performanceLayout.addWidget(self.arti, 3, 1, alignment=Qt.AlignRight) - self.performanceLayout.addWidget(QLabel("Moving ground units"), 4, 0) - self.performanceLayout.addWidget( - self.moving_units, 4, 1, alignment=Qt.AlignRight - ) - self.performanceLayout.addWidget( - QLabel("Generate infantry squads along vehicles"), 5, 0 - ) - self.performanceLayout.addWidget(self.infantry, 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 - ) - - self.performanceLayout.addWidget(QHorizontalSeparationLine(), 7, 0, 1, 2) - self.performanceLayout.addWidget( - QLabel("Culling of distant units enabled"), 8, 0 - ) - self.performanceLayout.addWidget(self.culling, 8, 1, alignment=Qt.AlignRight) - self.performanceLayout.addWidget(QLabel("Culling distance (km)"), 9, 0) - self.performanceLayout.addWidget( - self.culling_distance, 9, 1, alignment=Qt.AlignRight - ) - self.performanceLayout.addWidget( - QLabel("Do not cull carrier's surroundings"), 10, 0 - ) - self.performanceLayout.addWidget( - self.culling_do_not_cull_carrier, 10, 1, alignment=Qt.AlignRight - ) - - self.generatorLayout.addWidget(self.gameplay) - self.generatorLayout.addWidget( - QLabel( - "Disabling settings below may improve performance, but will impact the overall quality of the experience." - ) - ) - self.generatorLayout.addWidget(self.performance) + raise RuntimeError def initCheatLayout(self): @@ -633,58 +322,6 @@ class QSettingsWindow(QDialog): GameUpdateSignal.get_instance().updateGame(self.game) def applySettings(self): - self.game.settings.player_skill = CONST.SKILL_OPTIONS[ - self.playerCoalitionSkill.currentIndex() - ] - self.game.settings.enemy_skill = CONST.SKILL_OPTIONS[ - self.enemyCoalitionSkill.currentIndex() - ] - self.game.settings.enemy_vehicle_skill = CONST.SKILL_OPTIONS[ - self.enemyAASkill.currentIndex() - ] - self.game.settings.player_income_multiplier = self.player_income.value - self.game.settings.enemy_income_multiplier = self.enemy_income.value - self.game.settings.manpads = self.manpads.isChecked() - self.game.settings.labels = CONST.LABELS_OPTIONS[ - self.difficultyLabel.currentIndex() - ] - self.game.settings.night_disabled = self.noNightMission.isChecked() - self.game.settings.map_coalition_visibility = ( - self.mapVisibiitySelection.currentData() - ) - self.game.settings.external_views_allowed = self.ext_views.isChecked() - self.game.settings.battle_damage_assessment = ( - self.battleDamageAssessment.currentData() - ) - 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() - - self.game.settings.generate_dark_kneeboard = ( - self.generate_dark_kneeboard.isChecked() - ) - - self.game.settings.desired_player_mission_duration = ( - self.desired_player_mission_duration.value - ) - - self.game.settings.perf_red_alert_state = self.red_alert.isChecked() - self.game.settings.perf_smoke_gen = self.smoke.isChecked() - self.game.settings.perf_smoke_spacing = self.smoke_spacing.value() - 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_destroyed_units = self.destroyed_units.isChecked() - - self.game.settings.perf_culling = self.culling.isChecked() - self.game.settings.perf_culling_distance = int(self.culling_distance.value()) - self.game.settings.perf_do_not_cull_carrier = ( - self.culling_do_not_cull_carrier.isChecked() - ) - self.game.settings.show_red_ato = self.cheat_options.show_red_ato self.game.settings.enable_frontline_cheats = ( self.cheat_options.show_frontline_cheat