mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Reworked payloads, factions, map display, carrier. Re-added Tarawa support, many minor bug fixes. UI changes.
This commit is contained in:
@@ -15,22 +15,13 @@ from userdata import persistency, logging as logging_module
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
assert len(sys.argv) >= 3, "__init__.py should be started with two mandatory arguments: %UserProfile% location and application version"
|
||||
persistency.setup(installation.get_dcs_saved_games_directory())
|
||||
|
||||
persistency.setup(sys.argv[1])
|
||||
source_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..\\resources\\payloads")
|
||||
compiled_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..\\resources\\payloads")
|
||||
the_path = None
|
||||
if os.path.exists(source_path):
|
||||
the_path = source_path
|
||||
else:
|
||||
the_path = compiled_path
|
||||
custom_payloads = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..\\resources\\customized_payloads")
|
||||
if os.path.exists(custom_payloads):
|
||||
dcs.planes.FlyingType.payload_dirs.append(custom_payloads)
|
||||
|
||||
dcs.planes.FlyingType.payload_dirs = [
|
||||
the_path
|
||||
]
|
||||
|
||||
VERSION_STRING = sys.argv[2]
|
||||
VERSION_STRING = "2.0"
|
||||
logging_module.setup_version_string(VERSION_STRING)
|
||||
logging.info("Using {} as userdata folder".format(persistency.base_path()))
|
||||
|
||||
@@ -47,7 +38,6 @@ if __name__ == "__main__":
|
||||
uiconstants.load_aircraft_icons()
|
||||
uiconstants.load_vehicle_icons()
|
||||
|
||||
persistency.setup(sys.argv[1])
|
||||
|
||||
css = ""
|
||||
with open("./resources/stylesheets/style.css") as stylesheet:
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
import datetime
|
||||
|
||||
# from dcs import Mission
|
||||
# from dcs.terrain import Caucasus
|
||||
# from dcs.vehicles import AirDefence
|
||||
#
|
||||
# from game import Game
|
||||
# from gen.sam.sam_avenger import AvengerGenerator
|
||||
# from gen.sam.sam_chaparral import ChaparralGenerator
|
||||
# from gen.sam.sam_gepard import GepardGenerator
|
||||
# from gen.sam.sam_hawk import HawkGenerator
|
||||
# from gen.sam.sam_linebacker import LinebackerGenerator
|
||||
# from gen.sam.sam_patriot import PatriotGenerator
|
||||
# from gen.sam.sam_rapier import RapierGenerator
|
||||
# from gen.sam.sam_roland import RolandGenerator
|
||||
# from gen.sam.sam_sa10 import SA10Generator
|
||||
# from gen.sam.sam_sa11 import SA11Generator
|
||||
# from gen.sam.sam_sa13 import SA13Generator
|
||||
# from gen.sam.sam_sa15 import SA15Generator
|
||||
# from gen.sam.sam_sa19 import SA19Generator
|
||||
# from gen.sam.sam_sa2 import SA2Generator
|
||||
# from gen.sam.sam_sa3 import SA3Generator
|
||||
# from gen.sam.sam_sa6 import SA6Generator
|
||||
# from gen.sam.sam_sa8 import SA8Generator
|
||||
# from gen.sam.sam_sa9 import SA9Generator
|
||||
# from gen.sam.sam_zsu23 import ZSU23Generator
|
||||
# from gen.sam.sam_zu23 import ZU23Generator
|
||||
# from gen.sam.sam_zu23_ural import ZU23UralGenerator
|
||||
# from theater import TheaterGroundObject
|
||||
# from theater.caucasus import WesternGeorgia
|
||||
#
|
||||
# ter = Caucasus()
|
||||
# m = Mission()
|
||||
#
|
||||
#
|
||||
#
|
||||
# game = Game("USA 1990", "Iran 2015", WesternGeorgia(), datetime.datetime.now())
|
||||
#
|
||||
# generated_groups = []
|
||||
#
|
||||
# for i,c in enumerate([SA3Generator, SA2Generator, SA6Generator, RapierGenerator,
|
||||
# HawkGenerator, SA10Generator, SA19Generator, ZU23Generator,
|
||||
# SA8Generator, SA11Generator, SA9Generator, SA13Generator,
|
||||
# ZSU23Generator, SA15Generator, GepardGenerator, RolandGenerator,
|
||||
# PatriotGenerator, ZU23UralGenerator, ChaparralGenerator,
|
||||
# AvengerGenerator, LinebackerGenerator]):
|
||||
# t = TheaterGroundObject()
|
||||
# t.position = ter.kutaisi().position
|
||||
# t.position.x += i*250
|
||||
# t.dcs_identifier = "AA"
|
||||
# gen = c(game, t)
|
||||
# gen.generate()
|
||||
# vehicle_group = gen.get_generated_group()
|
||||
# generated_groups.append(vehicle_group)
|
||||
#
|
||||
# for g in generated_groups:
|
||||
# g.name = m.string(g.name)
|
||||
# for unit in g.units:
|
||||
# unit.name = m.string(unit.name)
|
||||
# m.country("USA").add_vehicle_group(g)
|
||||
#
|
||||
# m.save("./test.miz")
|
||||
from dcs.helicopters import SA342M
|
||||
|
||||
from game import db
|
||||
|
||||
print(db.unit_type_name(None))
|
||||
@@ -20,8 +20,10 @@ LABELS_OPTIONS = ["Full", "Abbreviated", "Dot Only", "Off"]
|
||||
SKILL_OPTIONS = ["Average", "Good", "High", "Excellent"]
|
||||
|
||||
COLORS: Dict[str, QColor] = {
|
||||
"red": QColor(255, 125, 125),
|
||||
"bright_red": QColor(200, 64, 64),
|
||||
"dark_red": QColor(140, 20, 20),
|
||||
"red": QColor(200, 80, 80),
|
||||
"bright_red": QColor(150, 80, 80),
|
||||
"super_red": QColor(200, 120, 120),
|
||||
"blue": QColor(164, 164, 255),
|
||||
"dark_blue": QColor(45, 62, 80),
|
||||
"white": QColor(255, 255, 255),
|
||||
@@ -29,8 +31,8 @@ COLORS: Dict[str, QColor] = {
|
||||
"bright_green": QColor(64, 200, 64),
|
||||
"black": QColor(0, 0, 0),
|
||||
"black_transparent": QColor(0, 0, 0, 64),
|
||||
"blue_transparent": QColor(164, 164, 255, 64),
|
||||
"red_transparent": QColor(255, 125, 125, 64)
|
||||
"blue_transparent": QColor(164, 164, 255, 32),
|
||||
"red_transparent": QColor(255, 125, 125, 32)
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +61,8 @@ def load_icons():
|
||||
ICONS["Night"] = QPixmap("./resources/ui/daytime/night.png")
|
||||
|
||||
ICONS["Money"] = QPixmap("./resources/ui/misc/money_icon.png")
|
||||
ICONS["PassTurn"] = QPixmap("./resources/ui/misc/pass_turn.png")
|
||||
ICONS["PassTurn"] = QPixmap("./resources/ui/misc/hourglass.png")
|
||||
ICONS["Proceed"] = QPixmap("./resources/ui/misc/proceed.png")
|
||||
ICONS["Settings"] = QPixmap("./resources/ui/misc/settings.png")
|
||||
ICONS["Statistics"] = QPixmap("./resources/ui/misc/statistics.png")
|
||||
ICONS["Ordnance"] = QPixmap("./resources/ui/misc/ordnance_icon.png")
|
||||
|
||||
31
qt_ui/widgets/QFactionsInfos.py
Normal file
31
qt_ui/widgets/QFactionsInfos.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from PySide2.QtWidgets import QLabel, QGroupBox, QGridLayout
|
||||
from game import Game
|
||||
|
||||
|
||||
class QFactionsInfos(QGroupBox):
|
||||
"""
|
||||
UI Component to display current turn and time info
|
||||
"""
|
||||
|
||||
def __init__(self, game):
|
||||
super(QFactionsInfos, self).__init__("Factions")
|
||||
|
||||
self.player_name = QLabel("")
|
||||
self.enemy_name = QLabel("")
|
||||
self.setGame(game)
|
||||
|
||||
self.layout = QGridLayout()
|
||||
self.layout.addWidget(QLabel("<b>Player : </b>"),0,0)
|
||||
self.layout.addWidget(self.player_name,0,1)
|
||||
self.layout.addWidget(QLabel("<b>Enemy : </b>"),1,0)
|
||||
self.layout.addWidget(self.enemy_name,1,1)
|
||||
self.setLayout(self.layout)
|
||||
|
||||
def setGame(self, game: Game):
|
||||
if game is not None:
|
||||
self.player_name.setText(game.player_name)
|
||||
self.enemy_name.setText(game.enemy_name)
|
||||
else:
|
||||
self.player_name.setText("")
|
||||
self.enemy_name.setText("")
|
||||
|
||||
@@ -2,6 +2,7 @@ from PySide2.QtWidgets import QFrame, QHBoxLayout, QPushButton, QVBoxLayout
|
||||
|
||||
from game import Game
|
||||
from qt_ui.widgets.QBudgetBox import QBudgetBox
|
||||
from qt_ui.widgets.QFactionsInfos import QFactionsInfos
|
||||
from qt_ui.windows.stats.QStatsWindow import QStatsWindow
|
||||
from qt_ui.widgets.QTurnCounter import QTurnCounter
|
||||
|
||||
@@ -30,12 +31,17 @@ class QTopPanel(QFrame):
|
||||
self.passTurnButton.clicked.connect(self.passTurn)
|
||||
|
||||
self.proceedButton = QPushButton("Proceed")
|
||||
self.proceedButton.setIcon(CONST.ICONS["PassTurn"])
|
||||
self.proceedButton.setIcon(CONST.ICONS["Proceed"])
|
||||
self.proceedButton.setProperty("style", "btn-primary")
|
||||
self.proceedButton.clicked.connect(self.proceed)
|
||||
if self.game and self.game.turn == 0:
|
||||
self.proceedButton.setEnabled(False)
|
||||
elif not len(self.game.planners.keys()) == self.game.theater.controlpoints:
|
||||
self.proceedButton.setEnabled(False)
|
||||
else:
|
||||
self.proceedButton.setEnabled(True)
|
||||
|
||||
self.factionsInfos = QFactionsInfos(self.game)
|
||||
|
||||
self.submenus = QVBoxLayout()
|
||||
self.settings = QPushButton("Settings")
|
||||
@@ -52,10 +58,11 @@ class QTopPanel(QFrame):
|
||||
self.submenus.addWidget(self.statistics)
|
||||
|
||||
self.layout = QHBoxLayout()
|
||||
self.layout.addStretch(1)
|
||||
self.layout.addLayout(self.submenus)
|
||||
self.layout.addWidget(self.factionsInfos)
|
||||
self.layout.addWidget(self.turnCounter)
|
||||
self.layout.addWidget(self.budgetBox)
|
||||
self.layout.addLayout(self.submenus)
|
||||
self.layout.addStretch(1)
|
||||
self.layout.addWidget(self.passTurnButton)
|
||||
self.layout.addWidget(self.proceedButton)
|
||||
self.setLayout(self.layout)
|
||||
@@ -65,6 +72,10 @@ class QTopPanel(QFrame):
|
||||
if game is not None:
|
||||
self.turnCounter.setCurrentTurn(self.game.turn, self.game.current_day)
|
||||
self.budgetBox.setBudget(self.game.budget, self.game.budget_reward_amount)
|
||||
self.factionsInfos.setGame(self.game)
|
||||
|
||||
if not len(self.game.planners.keys()) == self.game.theater.controlpoints:
|
||||
self.proceedButton.setEnabled(False)
|
||||
|
||||
def openSettings(self):
|
||||
self.subwindow = QSettingsWindow(self.game)
|
||||
@@ -75,7 +86,7 @@ class QTopPanel(QFrame):
|
||||
self.subwindow.show()
|
||||
|
||||
def passTurn(self):
|
||||
self.game.pass_turn()
|
||||
self.game.pass_turn(no_action=True)
|
||||
GameUpdateSignal.get_instance().updateGame(self.game)
|
||||
self.proceedButton.setEnabled(True)
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ from PySide2.QtCore import Qt, QRect, QPointF
|
||||
from PySide2.QtGui import QPixmap, QBrush, QColor, QWheelEvent, QPen, QFont
|
||||
from PySide2.QtWidgets import QGraphicsView, QFrame, QGraphicsOpacityEffect
|
||||
from dcs import Point
|
||||
from dcs.mapping import point_from_heading
|
||||
|
||||
import qt_ui.uiconstants as CONST
|
||||
from game import Game, db
|
||||
@@ -114,12 +115,17 @@ class QLiberationMap(QGraphicsView):
|
||||
unit = db.unit_type_from_name(u.type)
|
||||
if unit.threat_range > max_range:
|
||||
max_range = unit.threat_range
|
||||
if max_range >= 6000:
|
||||
scene.addEllipse(go_pos[0] - max_range/300.0 + 8, go_pos[1] - max_range/300.0 + 8, max_range/150.0, max_range/150.0, pen, brush)
|
||||
|
||||
scene.addEllipse(go_pos[0] - max_range/300.0 + 8, go_pos[1] - max_range/300.0 + 8, max_range/150.0, max_range/150.0, pen, brush)
|
||||
|
||||
for cp in self.game.theater.enemy_points():
|
||||
if self.get_display_rule("lines"):
|
||||
self.scene_create_lines_for_cp(cp)
|
||||
for cp in self.game.theater.player_points():
|
||||
if self.get_display_rule("lines"):
|
||||
self.scene_create_lines_for_cp(cp)
|
||||
|
||||
for cp in self.game.theater.controlpoints:
|
||||
if self.get_display_rule("flight_paths"):
|
||||
if cp.id in self.game.planners.keys():
|
||||
planner = self.game.planners[cp.id]
|
||||
@@ -138,38 +144,33 @@ class QLiberationMap(QGraphicsView):
|
||||
pos = self._transform_point(cp.position)
|
||||
for connected_cp in cp.connected_points:
|
||||
pos2 = self._transform_point(connected_cp.position)
|
||||
if connected_cp.captured != cp.captured:
|
||||
if not cp.captured:
|
||||
color = CONST.COLORS["red"]
|
||||
elif connected_cp.captured and cp.captured:
|
||||
elif cp.captured:
|
||||
color = CONST.COLORS["blue"]
|
||||
else:
|
||||
color = CONST.COLORS["black_transparent"]
|
||||
color = CONST.COLORS["red"]
|
||||
|
||||
pen = QPen(brush=color)
|
||||
pen.setColor(color)
|
||||
pen.setWidth(4)
|
||||
scene.addLine(pos[0], pos[1], pos2[0], pos2[1], pen=pen)
|
||||
|
||||
pen.setWidth(16)
|
||||
if cp.captured and not connected_cp.captured and Conflict.has_frontline_between(cp, connected_cp):
|
||||
frontline = self._frontline_vector(cp, connected_cp)
|
||||
if not frontline:
|
||||
continue
|
||||
if not cp.captured:
|
||||
scene.addLine(pos[0], pos[1], pos2[0], pos2[1], pen=pen)
|
||||
else:
|
||||
posx, h = Conflict.frontline_position(self.game.theater, cp, connected_cp)
|
||||
pos2 = self._transform_point(posx)
|
||||
scene.addLine(pos[0], pos[1], pos2[0], pos2[1], pen=pen)
|
||||
|
||||
frontline_pos, heading, distance = frontline
|
||||
p1 = point_from_heading(pos2[0], pos2[1], h+180, 25)
|
||||
p2 = point_from_heading(pos2[0], pos2[1], h, 25)
|
||||
frontline_pen = QPen(brush=CONST.COLORS["bright_red"])
|
||||
frontline_pen.setColor(CONST.COLORS["bright_red"])
|
||||
frontline_pen.setWidth(18)
|
||||
scene.addLine(p1[0], p1[1], p2[0], p2[1], pen=frontline_pen)
|
||||
|
||||
if distance < 10000:
|
||||
frontline_pos = frontline_pos.point_from_heading(heading + 180, 5000)
|
||||
distance = 10000
|
||||
|
||||
start_coords = self._transform_point(frontline_pos, treshold=10)
|
||||
end_coords = self._transform_point(frontline_pos.point_from_heading(heading, distance),
|
||||
treshold=60)
|
||||
|
||||
frontline_pen = QPen(brush=CONST.COLORS["bright_red"])
|
||||
frontline_pen.setColor(CONST.COLORS["bright_red"])
|
||||
frontline_pen.setWidth(4)
|
||||
frontline_pen.setStyle(Qt.DashDotLine)
|
||||
scene.addLine(start_coords[0], start_coords[1], end_coords[0], end_coords[1], pen=frontline_pen)
|
||||
else:
|
||||
scene.addLine(pos[0], pos[1], pos2[0], pos2[1], pen=pen)
|
||||
|
||||
def _frontline_vector(self, from_cp: ControlPoint, to_cp: ControlPoint):
|
||||
# Cache mechanism to avoid performing frontline vector computation on every frame
|
||||
|
||||
@@ -37,24 +37,24 @@ class QMapControlPoint(QGraphicsRectItem):
|
||||
painter.setPen(self.pen_color)
|
||||
|
||||
r = option.rect
|
||||
painter.drawChord(r, -180*16, -180*16)
|
||||
painter.drawEllipse(r.x(), r.y(), r.width(), r.height())
|
||||
|
||||
gauge = QRect(r.x(),
|
||||
r.y()+CONST.CP_SIZE/2 + 2,
|
||||
r.width(),
|
||||
CONST.CP_SIZE / 4)
|
||||
#gauge = QRect(r.x(),
|
||||
# r.y()+CONST.CP_SIZE/2 + 2,
|
||||
# r.width(),
|
||||
# CONST.CP_SIZE / 4)
|
||||
|
||||
painter.setBrush(CONST.COLORS["bright_red"])
|
||||
painter.setPen(CONST.COLORS["black"])
|
||||
painter.drawRect(gauge)
|
||||
#painter.setBrush(CONST.COLORS["bright_red"])
|
||||
#painter.setPen(CONST.COLORS["black"])
|
||||
#painter.drawRect(gauge)
|
||||
|
||||
gauge2 = QRect(r.x(),
|
||||
r.y() + CONST.CP_SIZE / 2 + 2,
|
||||
r.width()*self.model.base.strength,
|
||||
CONST.CP_SIZE / 4)
|
||||
#gauge2 = QRect(r.x(),
|
||||
# r.y() + CONST.CP_SIZE / 2 + 2,
|
||||
# r.width()*self.model.base.strength,
|
||||
# CONST.CP_SIZE / 4)
|
||||
|
||||
painter.setBrush(CONST.COLORS["green"])
|
||||
painter.drawRect(gauge2)
|
||||
#painter.setBrush(CONST.COLORS["green"])
|
||||
#painter.drawRect(gauge2)
|
||||
else:
|
||||
# TODO : not drawing sunk carriers. Can be improved to display sunk carrier.
|
||||
pass
|
||||
@@ -64,6 +64,9 @@ class QMapControlPoint(QGraphicsRectItem):
|
||||
self.update()
|
||||
self.setCursor(Qt.PointingHandCursor)
|
||||
|
||||
def mouseMoveEvent(self, event:QGraphicsSceneMouseEvent):
|
||||
self.update()
|
||||
|
||||
def hoverLeaveEvent(self, event: QGraphicsSceneHoverEvent):
|
||||
self.update()
|
||||
|
||||
@@ -87,9 +90,9 @@ class QMapControlPoint(QGraphicsRectItem):
|
||||
@property
|
||||
def brush_color(self)->QColor:
|
||||
if self.parent.game.player_country in db.BLUEFOR_FACTIONS:
|
||||
return self.model.captured and CONST.COLORS["blue"] or CONST.COLORS["red"]
|
||||
return self.model.captured and CONST.COLORS["blue"] or CONST.COLORS["super_red"]
|
||||
else:
|
||||
return self.model.captured and CONST.COLORS["red"] or CONST.COLORS["blue"]
|
||||
return self.model.captured and CONST.COLORS["super_red"] or CONST.COLORS["blue"]
|
||||
|
||||
@property
|
||||
def pen_color(self) -> QColor:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from PySide2.QtCore import QPoint, QRect, QPointF
|
||||
from PySide2.QtCore import QPoint, QRect, QPointF, Qt
|
||||
from PySide2.QtGui import QPainter
|
||||
from PySide2.QtWidgets import QGraphicsRectItem, QGraphicsItem
|
||||
from PySide2.QtWidgets import QGraphicsRectItem, QGraphicsItem, QGraphicsSceneHoverEvent, QGraphicsSceneMouseEvent
|
||||
|
||||
import qt_ui.uiconstants as CONST
|
||||
from game import db
|
||||
@@ -41,8 +41,20 @@ class QMapGroundObject(QGraphicsRectItem):
|
||||
painter.save()
|
||||
if not self.model.is_dead and not self.cp.captured:
|
||||
painter.drawPixmap(option.rect, CONST.ICONS[self.model.category])
|
||||
elif not self.model.is_dead and self.model.category == "aa":
|
||||
elif not self.model.is_dead:
|
||||
painter.drawPixmap(option.rect, CONST.ICONS[self.model.category + "_blue"])
|
||||
else:
|
||||
painter.drawPixmap(option.rect, CONST.ICONS["destroyed"])
|
||||
painter.restore()
|
||||
|
||||
def hoverEnterEvent(self, event: QGraphicsSceneHoverEvent):
|
||||
self.update()
|
||||
self.setCursor(Qt.PointingHandCursor)
|
||||
|
||||
def mouseMoveEvent(self, event:QGraphicsSceneMouseEvent):
|
||||
self.update()
|
||||
self.setCursor(Qt.PointingHandCursor)
|
||||
|
||||
def hoverLeaveEvent(self, event: QGraphicsSceneHoverEvent):
|
||||
self.update()
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import sys
|
||||
import webbrowser
|
||||
|
||||
from PySide2 import QtGui
|
||||
@@ -73,7 +74,7 @@ class QLiberationWindow(QMainWindow):
|
||||
def initToolbar(self):
|
||||
self.tool_bar = self.addToolBar("File")
|
||||
self.tool_bar.addAction(self.newGameAction)
|
||||
self.tool_bar.addAction(QIcon(CONST.ICONS["Open"]), "Open")
|
||||
#self.tool_bar.addAction(QIcon(CONST.ICONS["Open"]), "Open")
|
||||
self.tool_bar.addAction(self.saveGameAction)
|
||||
|
||||
def initMenuBar(self):
|
||||
@@ -81,15 +82,18 @@ class QLiberationWindow(QMainWindow):
|
||||
|
||||
file_menu = self.menu.addMenu("File")
|
||||
file_menu.addAction(self.newGameAction)
|
||||
file_menu.addAction(QIcon(CONST.ICONS["Open"]), "Open")
|
||||
#file_menu.addAction(QIcon(CONST.ICONS["Open"]), "Open") # TODO : implement
|
||||
file_menu.addAction(self.saveGameAction)
|
||||
file_menu.addAction("Save As")
|
||||
#file_menu.addAction("Save As") # TODO : implement
|
||||
#file_menu.addAction("Close Current Game", lambda: self.closeGame()) # Not working
|
||||
file_menu.addAction("Exit" , lambda: self.exit())
|
||||
|
||||
|
||||
help_menu = self.menu.addMenu("Help")
|
||||
help_menu.addAction("Online Manual", lambda: webbrowser.open_new_tab(URLS["Manual"]))
|
||||
help_menu.addAction("Troubleshooting Guide", lambda: webbrowser.open_new_tab(URLS["Troubleshooting"]))
|
||||
help_menu.addAction("Modding Guide", lambda: webbrowser.open_new_tab(URLS["Modding"]))
|
||||
help_menu.addSeparator()
|
||||
#help_menu.addAction("Online Manual", lambda: webbrowser.open_new_tab(URLS["Manual"]))
|
||||
#help_menu.addAction("Troubleshooting Guide", lambda: webbrowser.open_new_tab(URLS["Troubleshooting"]))
|
||||
#help_menu.addAction("Modding Guide", lambda: webbrowser.open_new_tab(URLS["Modding"]))
|
||||
#help_menu.addSeparator() ----> Note from Khopa : I disable these links since it's not up to date for this branch
|
||||
help_menu.addAction("Contribute", lambda: webbrowser.open_new_tab(URLS["Repository"]))
|
||||
help_menu.addAction("Forum Thread", lambda: webbrowser.open_new_tab(URLS["ForumThread"]))
|
||||
help_menu.addAction("Report an issue", lambda: webbrowser.open_new_tab(URLS["Issues"]))
|
||||
@@ -151,6 +155,13 @@ class QLiberationWindow(QMainWindow):
|
||||
self.game = game
|
||||
GameUpdateSignal.get_instance().updateGame(self.game)
|
||||
|
||||
def closeGame(self):
|
||||
self.game = None
|
||||
GameUpdateSignal.get_instance().updateGame(self.game)
|
||||
|
||||
def exit(self):
|
||||
sys.exit(0)
|
||||
|
||||
def setGame(self, game: Game):
|
||||
self.game = game
|
||||
|
||||
@@ -158,10 +169,11 @@ class QLiberationWindow(QMainWindow):
|
||||
text = "<h3>DCS Liberation</h3>" + \
|
||||
"<h4>Repository</h4>" + \
|
||||
"<b>Source code :</b> https://github.com/shdwp/dcs_liberation<br/>" + \
|
||||
"<h4>Contributors</h4>" + \
|
||||
"<b>Author :</b> sdwp<br/><br/>" + \
|
||||
"<b>Contributors :</b> Khopa, Wrycu, calvinmorrow, JohanAberg<br/><br/>" + \
|
||||
"<b>Special Thanks :</b> rp- (pydcs framework) "
|
||||
"<h4>Authors/Contributors</h4><br/>" + \
|
||||
"<b>shdwp</b>, <b>Khopa</b>, <b>Wrycu</b>, <b>calvinmorrow</b>, <b>JohanAberg</b><br/>" + \
|
||||
"<h4>Special Thanks :</h4>" \
|
||||
"<b>rp-</b> <i>for the pydcs framework</i><br/>"\
|
||||
"<b>Grimes (mrSkortch)</b> & <b>Speed</b> <i>for the MIST framework</i><br/>"
|
||||
|
||||
about = QMessageBox()
|
||||
about.setWindowTitle("About DCS Liberation")
|
||||
|
||||
@@ -35,8 +35,10 @@ class NewGameWizard(QtWidgets.QWizard):
|
||||
isTerrainPg = self.field("isTerrainPg")
|
||||
isTerrainNttr = self.field("isTerrainNttr")
|
||||
isTerrainCaucasusSmall = self.field("isTerrainCaucasusSmall")
|
||||
isTerrainCaucasusSmallInverted = self.field("isTerrainCaucasusSmallInverted")
|
||||
isIranianCampaignTheater = self.field("isIranianCampaignTheater")
|
||||
isTerrainNormandy = self.field("isTerrainNormandy")
|
||||
isTerrainEmirates = self.field("isTerrainEmirates")
|
||||
timePeriod = db.TIME_PERIODS[list(db.TIME_PERIODS.keys())[self.field("timePeriod")]]
|
||||
sams = self.field("sams")
|
||||
midGame = self.field("midGame")
|
||||
@@ -51,17 +53,17 @@ class NewGameWizard(QtWidgets.QWizard):
|
||||
conflicttheater = nevada.NevadaTheater()
|
||||
elif isTerrainCaucasusSmall:
|
||||
conflicttheater = caucasus.WesternGeorgia()
|
||||
elif isTerrainCaucasusSmallInverted:
|
||||
conflicttheater = caucasus.WesternGeorgiaInverted()
|
||||
elif isIranianCampaignTheater:
|
||||
conflicttheater = persiangulf.IranianCampaign()
|
||||
elif isTerrainEmirates:
|
||||
conflicttheater = persiangulf.Emirates()
|
||||
elif isTerrainNormandy:
|
||||
conflicttheater = normandy.NormandyTheater()
|
||||
else:
|
||||
conflicttheater = caucasus.CaucasusTheater()
|
||||
|
||||
|
||||
print("player_name, enemy_name, conflicttheater, sams, midGame, multiplier, timePeriod")
|
||||
print(player_name, enemy_name, conflicttheater, sams, midGame, multiplier, timePeriod)
|
||||
print(isIranianCampaignTheater, isTerrainPg)
|
||||
self.generatedGame = self.start_new_game(player_name, enemy_name, conflicttheater, sams, midGame, multiplier,
|
||||
timePeriod)
|
||||
|
||||
@@ -204,18 +206,22 @@ class TheaterConfiguration(QtWidgets.QWizardPage):
|
||||
|
||||
# Terrain selection
|
||||
terrainGroup = QtWidgets.QGroupBox("Terrain")
|
||||
terrainCaucasus = QtWidgets.QRadioButton("Caucasus - Full map")
|
||||
terrainCaucasus.setIcon(QtGui.QIcon(CONST.ICONS["Terrain_Caucasus"]))
|
||||
terrainCaucasusSmall = QtWidgets.QRadioButton("Caucasus - Western Georgia [RECOMMENDED]")
|
||||
terrainCaucasusSmall.setIcon(QtGui.QIcon(CONST.ICONS["Terrain_Caucasus"]))
|
||||
terrainCaucasusSmallInverted = QtWidgets.QRadioButton("Caucasus - Western Georgia Inverted [RECOMMENDED]")
|
||||
terrainCaucasusSmallInverted.setIcon(QtGui.QIcon(CONST.ICONS["Terrain_Caucasus"]))
|
||||
terrainCaucasus = QtWidgets.QRadioButton("Caucasus - Full map")
|
||||
terrainCaucasus.setIcon(QtGui.QIcon(CONST.ICONS["Terrain_Caucasus"]))
|
||||
|
||||
terrainPg = QtWidgets.QRadioButton("Persian Gulf - Full Map")
|
||||
terrainPg.setIcon(QtGui.QIcon(CONST.ICONS["Terrain_Persian_Gulf"]))
|
||||
terrainIran = QtWidgets.QRadioButton("Persian Gulf - Iranian Campaign [RECOMMENDED]")
|
||||
terrainIran = QtWidgets.QRadioButton("Persian Gulf - Invasion of Iran [RECOMMENDED]")
|
||||
terrainIran.setIcon(QtGui.QIcon(CONST.ICONS["Terrain_Persian_Gulf"]))
|
||||
terrainEmirates = QtWidgets.QRadioButton("Persian Gulf - Emirates [RECOMMENDED]")
|
||||
terrainEmirates.setIcon(QtGui.QIcon(CONST.ICONS["Terrain_Persian_Gulf"]))
|
||||
terrainNttr = QtWidgets.QRadioButton("Nevada - Full")
|
||||
terrainNttr.setIcon(QtGui.QIcon(CONST.ICONS["Terrain_Nevada"]))
|
||||
terrainNormandy = QtWidgets.QRadioButton("Normandy")
|
||||
terrainNormandy = QtWidgets.QRadioButton("Normandy [Alpha]")
|
||||
terrainNormandy.setIcon(QtGui.QIcon(CONST.ICONS["Terrain_Normandy"]))
|
||||
terrainCaucasusSmall.setChecked(True)
|
||||
|
||||
@@ -231,8 +237,10 @@ class TheaterConfiguration(QtWidgets.QWizardPage):
|
||||
# Register fields
|
||||
self.registerField('isTerrainCaucasus', terrainCaucasus)
|
||||
self.registerField('isTerrainCaucasusSmall', terrainCaucasusSmall)
|
||||
self.registerField('isTerrainCaucasusSmallInverted', terrainCaucasusSmallInverted)
|
||||
self.registerField('isTerrainPg', terrainPg)
|
||||
self.registerField('isIranianCampaignTheater', terrainIran)
|
||||
self.registerField('isTerrainEmirates', terrainEmirates)
|
||||
self.registerField('isTerrainNttr', terrainNttr)
|
||||
self.registerField('isTerrainNormandy', terrainNormandy)
|
||||
self.registerField('timePeriod', timePeriodSelect)
|
||||
@@ -240,8 +248,10 @@ class TheaterConfiguration(QtWidgets.QWizardPage):
|
||||
# Build layout
|
||||
terrainGroupLayout = QtWidgets.QVBoxLayout()
|
||||
terrainGroupLayout.addWidget(terrainCaucasusSmall)
|
||||
terrainGroupLayout.addWidget(terrainCaucasusSmallInverted)
|
||||
terrainGroupLayout.addWidget(terrainCaucasus)
|
||||
terrainGroupLayout.addWidget(terrainIran)
|
||||
terrainGroupLayout.addWidget(terrainEmirates)
|
||||
terrainGroupLayout.addWidget(terrainPg)
|
||||
terrainGroupLayout.addWidget(terrainNttr)
|
||||
terrainGroupLayout.addWidget(terrainNormandy)
|
||||
|
||||
@@ -53,6 +53,8 @@ class QAircraftRecruitmentMenu(QGroupBox, QRecruitBehaviour):
|
||||
for unit_type in units_column:
|
||||
if self.cp.is_carrier and not unit_type in db.CARRIER_CAPABLE:
|
||||
continue
|
||||
if self.cp.is_lha and not unit_type in db.LHA_CAPABLE:
|
||||
continue
|
||||
row = self.add_purchase_row(unit_type, task_box_layout, row)
|
||||
stretch = QVBoxLayout()
|
||||
stretch.addStretch()
|
||||
|
||||
@@ -73,6 +73,9 @@ class QMissionPlanning(QDialog):
|
||||
@Slot(str)
|
||||
def on_departure_cp_changed(self, cp_name):
|
||||
cps = [cp for cp in self.game.theater.controlpoints if cp.name == cp_name]
|
||||
|
||||
print(cps)
|
||||
|
||||
if len(cps) == 1:
|
||||
self.selected_cp = cps[0]
|
||||
self.planner = self.game.planners[cps[0].id]
|
||||
@@ -80,6 +83,8 @@ class QMissionPlanning(QDialog):
|
||||
else:
|
||||
self.planned_flight_view.set_flight_planner(None)
|
||||
|
||||
print(self.selected_cp.id)
|
||||
|
||||
def on_flight_selection_change(self):
|
||||
index = self.planned_flight_view.selectionModel().currentIndex().row()
|
||||
flight = self.planner.flights[index]
|
||||
|
||||
@@ -42,14 +42,16 @@ class QFlightCreator(QDialog):
|
||||
self.select_type_aircraft.setCurrentIndex(0)
|
||||
|
||||
self.select_flight_type = QComboBox()
|
||||
self.select_flight_type.addItem("CAP", userData=FlightType.CAP)
|
||||
self.select_flight_type.addItem("BARCAP", userData=FlightType.BARCAP)
|
||||
self.select_flight_type.addItem("TARCAP", userData=FlightType.TARCAP)
|
||||
self.select_flight_type.addItem("INTERCEPT", userData=FlightType.INTERCEPTION)
|
||||
self.select_flight_type.addItem("CAS", userData=FlightType.CAS)
|
||||
self.select_flight_type.addItem("SEAD", userData=FlightType.SEAD)
|
||||
self.select_flight_type.addItem("DEAD", userData=FlightType.DEAD)
|
||||
self.select_flight_type.addItem("STRIKE", userData=FlightType.STRIKE)
|
||||
self.select_flight_type.addItem("CAP [Combat Air Patrol]", userData=FlightType.CAP)
|
||||
self.select_flight_type.addItem("BARCAP [Barrier Combat Air Patrol]", userData=FlightType.BARCAP)
|
||||
self.select_flight_type.addItem("TARCAP [Target Combat Air Patrol]", userData=FlightType.TARCAP)
|
||||
self.select_flight_type.addItem("INTERCEPT [Interception]", userData=FlightType.INTERCEPTION)
|
||||
self.select_flight_type.addItem("CAS [Close Air Support]", userData=FlightType.CAS)
|
||||
self.select_flight_type.addItem("BAI [Battlefield Interdiction]", userData=FlightType.CAS)
|
||||
self.select_flight_type.addItem("SEAD [Suppression of Enemy Air Defenses]", userData=FlightType.SEAD)
|
||||
self.select_flight_type.addItem("DEAD [Destruction of Enemy Air Defenses]", userData=FlightType.DEAD)
|
||||
self.select_flight_type.addItem("STRIKE [Strike]", userData=FlightType.STRIKE)
|
||||
self.select_flight_type.addItem("ANTISHIP [Antiship Attack]", userData=FlightType.ANTISHIP)
|
||||
self.select_flight_type.setCurrentIndex(0)
|
||||
|
||||
self.select_count_of_aircraft = QSpinBox()
|
||||
@@ -71,13 +73,11 @@ class QFlightCreator(QDialog):
|
||||
type_layout.addStretch()
|
||||
type_layout.addWidget(self.select_type_aircraft, alignment=Qt.AlignRight)
|
||||
|
||||
|
||||
count_layout = QHBoxLayout()
|
||||
count_layout.addWidget(QLabel("Count : "))
|
||||
count_layout.addStretch()
|
||||
count_layout.addWidget(self.select_count_of_aircraft, alignment=Qt.AlignRight)
|
||||
|
||||
|
||||
flight_type_layout = QHBoxLayout()
|
||||
flight_type_layout.addWidget(QLabel("Task : "))
|
||||
flight_type_layout.addStretch()
|
||||
|
||||
@@ -108,7 +108,7 @@ class QPredefinedWaypointSelectionWindow(QDialog):
|
||||
for ecp in enemy_cp:
|
||||
wpt = FlightWaypoint((select_cp.position.x + ecp.position.x)/2, (select_cp.position.y + ecp.position.y)/2, 800)
|
||||
wpt.name = "Frontline with " + ecp.name + " [CAS]"
|
||||
wpt.description = "Provide CAS"
|
||||
wpt.description = "Frontline"
|
||||
self.wpt_selection_box.addItem(wpt.name, userData=wpt)
|
||||
if len(enemy_cp) == 0:
|
||||
self.wpt_selection_box.addItem("None", userData=None)
|
||||
@@ -117,7 +117,10 @@ class QPredefinedWaypointSelectionWindow(QDialog):
|
||||
if not ground_object.is_dead and not ground_object.dcs_identifier == "AA":
|
||||
wpt = FlightWaypoint(ground_object.position.x,ground_object.position.y, 0)
|
||||
wpt.name = ground_object.category + " #" + str(ground_object.object_id) + " @ site #" + str(ground_object.group_id)
|
||||
wpt.description = "Ennemy Building"
|
||||
if select_cp.captured:
|
||||
wpt.description = "Friendly Building"
|
||||
else:
|
||||
wpt.description = "Enemy Building"
|
||||
self.wpt_selection_box.addItem(wpt.name, userData=wpt)
|
||||
elif selected_wpt_type == PREDEFINED_WAYPOINT_CATEGORIES[2]: # Known units position
|
||||
for ground_object in select_cp.ground_objects:
|
||||
@@ -126,12 +129,18 @@ class QPredefinedWaypointSelectionWindow(QDialog):
|
||||
for u in g.units:
|
||||
wpt = FlightWaypoint(ground_object.position.x, ground_object.position.y, 0)
|
||||
wpt.name = u.type + " @ site #" + str(ground_object.group_id)
|
||||
wpt.description = "Ennemy unit to be destroyed"
|
||||
if select_cp.captured:
|
||||
wpt.description = "Friendly unit :" + u.type
|
||||
else:
|
||||
wpt.description = "Enemy unit :" + u.type
|
||||
self.wpt_selection_box.addItem(wpt.name, userData=wpt)
|
||||
elif selected_wpt_type == PREDEFINED_WAYPOINT_CATEGORIES[3]: # CAS
|
||||
wpt = FlightWaypoint(select_cp.position.x, select_cp.position.y, 0)
|
||||
wpt.name = select_cp.name
|
||||
wpt.description = "Position of " + select_cp.name
|
||||
if select_cp.captured:
|
||||
wpt.description = "Position of " + select_cp.name + " [Friendly Airbase]"
|
||||
else:
|
||||
wpt.description = "Position of " + select_cp.name + " [Enemy Airbase]"
|
||||
self.wpt_selection_box.addItem("Airbase", userData=wpt)
|
||||
else:
|
||||
self.wpt_selection_box.addItem("None", userData=None)
|
||||
|
||||
@@ -131,10 +131,21 @@ class QSettingsWindow(QDialog):
|
||||
self.takeOffOnlyForPlayerGroup.setChecked(self.game.settings.only_player_takeoff)
|
||||
self.takeOffOnlyForPlayerGroup.toggled.connect(self.applySettings)
|
||||
|
||||
self.generatorLayout.addWidget(QLabel("Aircraft cold start"), 0, 0)
|
||||
self.generatorLayout.addWidget(self.coldStart, 0, 1)
|
||||
self.generatorLayout.addWidget(QLabel("Takeoff only for player group"), 1, 0)
|
||||
self.generatorLayout.addWidget(self.takeOffOnlyForPlayerGroup, 1, 1)
|
||||
self.coldStart = QCheckBox()
|
||||
self.coldStart.setChecked(self.game.settings.cold_start)
|
||||
self.coldStart.toggled.connect(self.applySettings)
|
||||
|
||||
self.supercarrier = QCheckBox()
|
||||
self.supercarrier.setChecked(self.game.settings.supercarrier)
|
||||
self.supercarrier.toggled.connect(self.applySettings)
|
||||
|
||||
# Settings not used anymore
|
||||
# self.generatorLayout.addWidget(QLabel("Aircraft cold start"), 0, 0)
|
||||
# self.generatorLayout.addWidget(self.coldStart, 0, 1)
|
||||
# self.generatorLayout.addWidget(QLabel("Takeoff only for player group"), 1, 0)
|
||||
# self.generatorLayout.addWidget(self.takeOffOnlyForPlayerGroup, 1, 1)
|
||||
self.generatorLayout.addWidget(QLabel("Use Supercarrier Module"), 0, 0)
|
||||
self.generatorLayout.addWidget(self.supercarrier, 0, 1)
|
||||
|
||||
|
||||
def initCheatLayout(self):
|
||||
@@ -177,6 +188,7 @@ class QSettingsWindow(QDialog):
|
||||
self.game.settings.night_disabled = self.noNightMission.isChecked()
|
||||
self.game.settings.only_player_takeoff = self.takeOffOnlyForPlayerGroup.isChecked()
|
||||
self.game.settings.cold_start = self.coldStart.isChecked()
|
||||
self.game.settings.supercarrier = self.supercarrier.isChecked()
|
||||
|
||||
GameUpdateSignal.get_instance().updateGame(self.game)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user