mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Add player pilot invulnerability option.
https://github.com/dcs-liberation/dcs_liberation/issues/276
This commit is contained in:
parent
82ce688a0d
commit
28f20d47d3
@ -120,10 +120,13 @@ class Event:
|
||||
self.game.red_ato, debriefing.air_losses, for_player=False
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def commit_air_losses(debriefing: Debriefing) -> None:
|
||||
def commit_air_losses(self, debriefing: Debriefing) -> None:
|
||||
for loss in debriefing.air_losses.losses:
|
||||
loss.pilot.alive = False
|
||||
if (
|
||||
not loss.pilot.player
|
||||
or not self.game.settings.invulnerable_player_pilots
|
||||
):
|
||||
loss.pilot.alive = False
|
||||
aircraft = loss.flight.unit_type
|
||||
cp = loss.flight.departure
|
||||
available = cp.base.total_units_of_type(aircraft)
|
||||
|
||||
@ -36,6 +36,7 @@ class Settings:
|
||||
restrict_weapons_by_date: bool = False
|
||||
disable_legacy_aewc: bool = False
|
||||
generate_dark_kneeboard: bool = False
|
||||
invulnerable_player_pilots: bool = True
|
||||
|
||||
# Performance oriented
|
||||
perf_red_alert_state: bool = True
|
||||
|
||||
@ -92,7 +92,7 @@ class StartTypeComboBox(QComboBox):
|
||||
|
||||
class QSettingsWindow(QDialog):
|
||||
def __init__(self, game: Game):
|
||||
super(QSettingsWindow, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
self.game = game
|
||||
self.pluginsPage = None
|
||||
@ -285,6 +285,23 @@ class QSettingsWindow(QDialog):
|
||||
self.ext_views.setChecked(self.game.settings.external_views_allowed)
|
||||
self.ext_views.toggled.connect(self.applySettings)
|
||||
|
||||
def set_invulnerable_player_pilots(checked: bool) -> None:
|
||||
self.game.settings.invulnerable_player_pilots = checked
|
||||
|
||||
invulnerable_player_pilots_label = QLabel(
|
||||
"Player pilots cannot be killed<br />"
|
||||
"<strong>Aircraft are vulnerable, but the player's pilot will be<br />"
|
||||
"returned to the squadron at the end of the mission</strong>"
|
||||
)
|
||||
|
||||
invulnerable_player_pilots_checkbox = QCheckBox()
|
||||
invulnerable_player_pilots_checkbox.setChecked(
|
||||
self.game.settings.invulnerable_player_pilots
|
||||
)
|
||||
invulnerable_player_pilots_checkbox.toggled.connect(
|
||||
set_invulnerable_player_pilots
|
||||
)
|
||||
|
||||
self.aiDifficultyLayout.addWidget(QLabel("Player coalition skill"), 0, 0)
|
||||
self.aiDifficultyLayout.addWidget(
|
||||
self.playerCoalitionSkill, 0, 1, Qt.AlignRight
|
||||
@ -295,6 +312,10 @@ class QSettingsWindow(QDialog):
|
||||
self.aiDifficultyLayout.addWidget(self.enemyAASkill, 2, 1, Qt.AlignRight)
|
||||
self.aiDifficultyLayout.addLayout(self.player_income, 3, 0)
|
||||
self.aiDifficultyLayout.addLayout(self.enemy_income, 4, 0)
|
||||
self.aiDifficultyLayout.addWidget(invulnerable_player_pilots_label, 5, 0)
|
||||
self.aiDifficultyLayout.addWidget(
|
||||
invulnerable_player_pilots_checkbox, 5, 1, Qt.AlignRight
|
||||
)
|
||||
self.aiDifficultySettings.setLayout(self.aiDifficultyLayout)
|
||||
self.difficultyLayout.addWidget(self.aiDifficultySettings)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user