From 2fd4fa25f7099068809e640732f5309aeeea1a14 Mon Sep 17 00:00:00 2001 From: Khopa Date: Fri, 14 Aug 2020 22:39:45 +0200 Subject: [PATCH] Added JTAC smoke parameter. --- changelog.md | 2 +- game/operation/operation.py | 11 +++++++---- game/settings.py | 1 + qt_ui/windows/settings/QSettingsWindow.py | 9 +++++++++ 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index ba5130df..2273c8e5 100644 --- a/changelog.md +++ b/changelog.md @@ -3,7 +3,7 @@ ## Features/Improvements : **[Units/Factions]** Added Mig-31, Su-30, Mi-24V, Mi-28N to Russia 2010 faction. -## Fixed issues : +## Fixed issues : **[Units/Factions]** Fixed OH-58D not being used by AI **[Units/Factions]** Fixed big performance issue in new release UI that occurred only when running the .exe diff --git a/game/operation/operation.py b/game/operation/operation.py index d69c406d..470133dd 100644 --- a/game/operation/operation.py +++ b/game/operation/operation.py @@ -72,9 +72,6 @@ class Operation: self.groundobjectgen = GroundObjectsGenerator(mission, conflict, self.game) self.briefinggen = BriefingGenerator(mission, conflict, self.game) - player_country = self.from_cp.captured and self.attacker_country or self.defender_country - enemy_country = self.from_cp.captured and self.defender_country or self.attacker_country - def prepare(self, terrain: Terrain, is_quick: bool): with open("resources/default_options.lua", "r") as f: options_dict = loads(f.read())["options"] @@ -202,8 +199,14 @@ class Operation: script = f.read() script = script + "\n" + + smoke = "true" + if hasattr(self.game, "jtac_smoke_on"): + if not self.game.settings.jtac_smoke_on: + smoke = "false" + for jtac in self.game.jtacs: - script = script + "\n" + "JTACAutoLase('" + str(jtac[2]) + "', " + str(jtac[1]) + ", true, \"vehicle\")" + "\n" + script = script + "\n" + "JTACAutoLase('" + str(jtac[2]) + "', " + str(jtac[1]) + ", " + smoke + ", \"vehicle\")" + "\n" load_autolase.add_action(DoScript(String(script))) self.current_mission.triggerrules.triggers.append(load_autolase) diff --git a/game/settings.py b/game/settings.py index c42e727b..4566ad0f 100644 --- a/game/settings.py +++ b/game/settings.py @@ -25,6 +25,7 @@ class Settings: self.cold_start = False # Legacy parameter do not use self.version = None self.include_jtac_if_available = True + self.jtac_smoke_on = True # Performance oriented self.perf_red_alert_state = True diff --git a/qt_ui/windows/settings/QSettingsWindow.py b/qt_ui/windows/settings/QSettingsWindow.py index e6ba069a..195eeb87 100644 --- a/qt_ui/windows/settings/QSettingsWindow.py +++ b/qt_ui/windows/settings/QSettingsWindow.py @@ -169,17 +169,25 @@ class QSettingsWindow(QDialog): if not hasattr(self.game.settings, "include_jtac_if_available"): self.game.settings.include_jtac_if_available = True + if not hasattr(self.game.settings, "jtac_smoke_on"): + self.game.settings.jtac_smoke_on= True self.include_jtac_if_available = QCheckBox() self.include_jtac_if_available.setChecked(self.game.settings.include_jtac_if_available) self.include_jtac_if_available.toggled.connect(self.applySettings) + self.jtac_smoke_on = QCheckBox() + self.jtac_smoke_on.setChecked(self.game.settings.jtac_smoke_on) + self.jtac_smoke_on.toggled.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) self.gameplayLayout.addWidget(QLabel("Include JTAC (If available)"), 2, 0) self.gameplayLayout.addWidget(self.include_jtac_if_available, 2, 1, Qt.AlignRight) + self.gameplayLayout.addWidget(QLabel("Enable JTAC smoke markers"), 2, 0) + self.gameplayLayout.addWidget(self.jtac_smoke_on, 3, 1, Qt.AlignRight) self.performance = QGroupBox("Performance") self.performanceLayout = QGridLayout() @@ -299,6 +307,7 @@ class QSettingsWindow(QDialog): self.game.settings.external_views_allowed = self.ext_views.isChecked() self.game.settings.generate_marks = self.generate_marks.isChecked() self.game.settings.include_jtac_if_available = self.include_jtac_if_available.isChecked() + self.game.settings.jtac_smoke_on = self.jtac_smoke_on.isChecked() print(self.game.settings.map_coalition_visibility)