mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Add cheat options back to front lines.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1108.
This commit is contained in:
parent
30f6220c3e
commit
d1c7146a47
@ -1,7 +1,10 @@
|
|||||||
from PySide2.QtWidgets import QGroupBox, QLabel, QVBoxLayout
|
from collections import Callable
|
||||||
|
|
||||||
|
from PySide2.QtWidgets import QGroupBox, QLabel, QVBoxLayout, QPushButton
|
||||||
|
|
||||||
from game import Game
|
from game import Game
|
||||||
from game.theater import ControlPoint
|
from game.theater import ControlPoint
|
||||||
|
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
|
||||||
from qt_ui.windows.basemenu.ground_forces.QGroundForcesStrategySelector import (
|
from qt_ui.windows.basemenu.ground_forces.QGroundForcesStrategySelector import (
|
||||||
QGroundForcesStrategySelector,
|
QGroundForcesStrategySelector,
|
||||||
)
|
)
|
||||||
@ -15,10 +18,44 @@ class QGroundForcesStrategy(QGroupBox):
|
|||||||
self.init_ui()
|
self.init_ui()
|
||||||
|
|
||||||
def init_ui(self):
|
def init_ui(self):
|
||||||
|
def make_cheat_callback(
|
||||||
|
enemy_point: ControlPoint, advance: bool
|
||||||
|
) -> Callable[[], None]:
|
||||||
|
def cheat() -> None:
|
||||||
|
self.cheat_alter_front_line(enemy_point, advance)
|
||||||
|
|
||||||
|
return cheat
|
||||||
|
|
||||||
layout = QVBoxLayout()
|
layout = QVBoxLayout()
|
||||||
for enemy_cp in self.cp.connected_points:
|
for enemy_cp in self.cp.connected_points:
|
||||||
if not enemy_cp.captured:
|
if not enemy_cp.captured:
|
||||||
layout.addWidget(QLabel(enemy_cp.name))
|
layout.addWidget(QLabel(enemy_cp.name))
|
||||||
layout.addWidget(QGroundForcesStrategySelector(self.cp, enemy_cp))
|
layout.addWidget(QGroundForcesStrategySelector(self.cp, enemy_cp))
|
||||||
|
if self.game.settings.enable_frontline_cheats:
|
||||||
|
advance_button = QPushButton("CHEAT: Advance")
|
||||||
|
advance_button.setProperty("style", "btn-danger")
|
||||||
|
layout.addWidget(advance_button)
|
||||||
|
advance_button.clicked.connect(
|
||||||
|
make_cheat_callback(enemy_cp, advance=True)
|
||||||
|
)
|
||||||
|
|
||||||
|
retreat_button = QPushButton("CHEAT: Retreat")
|
||||||
|
retreat_button.setProperty("style", "btn-danger")
|
||||||
|
layout.addWidget(retreat_button)
|
||||||
|
retreat_button.clicked.connect(
|
||||||
|
make_cheat_callback(enemy_cp, advance=False)
|
||||||
|
)
|
||||||
|
|
||||||
layout.addStretch()
|
layout.addStretch()
|
||||||
self.setLayout(layout)
|
self.setLayout(layout)
|
||||||
|
|
||||||
|
def cheat_alter_front_line(self, enemy_point: ControlPoint, advance: bool) -> None:
|
||||||
|
amount = 0.2
|
||||||
|
if not advance:
|
||||||
|
amount *= -1
|
||||||
|
self.cp.base.affect_strength(amount)
|
||||||
|
enemy_point.base.affect_strength(-amount)
|
||||||
|
# Clear the ATO to replan missions affected by the front line.
|
||||||
|
self.game.reset_ato()
|
||||||
|
self.game.initialize_turn()
|
||||||
|
GameUpdateSignal.get_instance().updateGame(self.game)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user