mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Polishing, Bug Fixes, Slight improvements to flight generator for BARCAP.
This commit is contained in:
parent
fc64e57495
commit
8afdf5ef65
@ -17,8 +17,9 @@ class LHAGroupGenerator(GroupGenerator):
|
||||
self.add_unit(carrier_type, "LHA", self.position.x, self.position.y, self.heading)
|
||||
|
||||
# Add destroyers escort
|
||||
dd_type = random.choice(self.faction["destroyer"])
|
||||
self.add_unit(dd_type, "DD1", self.position.x + 50, self.position.y + 150, self.heading)
|
||||
self.add_unit(dd_type, "DD2", self.position.x + 50, self.position.y - 150, self.heading)
|
||||
if "destroyer" in self.faction.keys():
|
||||
dd_type = random.choice(self.faction["destroyer"])
|
||||
self.add_unit(dd_type, "DD1", self.position.x + 250, self.position.y + 450, self.heading)
|
||||
self.add_unit(dd_type, "DD2", self.position.x + 250, self.position.y - 450, self.heading)
|
||||
|
||||
self.get_generated_group().points[0].speed = 20
|
||||
@ -50,7 +50,7 @@ class FlightPlanner:
|
||||
self.compute_strike_targets()
|
||||
|
||||
# The priority is to assign air-superiority fighter or interceptor to interception roles, so they can scramble if there is an attacker
|
||||
self.commision_interceptors()
|
||||
#self.commision_interceptors()
|
||||
|
||||
# Then some CAP patrol for the next 2 hours
|
||||
self.commision_barcap()
|
||||
@ -138,9 +138,19 @@ class FlightPlanner:
|
||||
point = FlightWaypoint(ground_object.position.x, ground_object.position.y, patrol_alt)
|
||||
point.name = "Patrol point"
|
||||
point.description = "Patrol #" + str(len(flight.points))
|
||||
point.pretty_name = "Patrol #" + str(len(flight.points))
|
||||
flight.points.append(point)
|
||||
patrolled.append(ground_object.group_id)
|
||||
|
||||
if len(flight.points) == 0:
|
||||
for i in range(3):
|
||||
pos = self.from_cp.position.point_from_heading(random.randint(0,360), random.randint(30000, 80000))
|
||||
point = FlightWaypoint(pos.x, pos.y, patrol_alt)
|
||||
point.name = "Patrol point"
|
||||
point.description = "Patrol #" + str(len(flight.points))
|
||||
point.pretty_name = "Patrol #" + str(len(flight.points))
|
||||
flight.points.append(point)
|
||||
|
||||
self.cap_flights.append(flight)
|
||||
self.flights.append(flight)
|
||||
|
||||
@ -182,17 +192,20 @@ class FlightPlanner:
|
||||
|
||||
ingress_point = FlightWaypoint(ingress.x, ingress.y, 1000)
|
||||
ingress_point.name = "INGRESS"
|
||||
ingress_point.pretty_name = "INGRESS"
|
||||
ingress_point.description = "Ingress into CAS area"
|
||||
flight.points.append(ingress_point)
|
||||
|
||||
center_point = FlightWaypoint(center.x, center.y, 1000)
|
||||
center_point.description = "Provide CAS"
|
||||
center_point.name = "CAS"
|
||||
center_point.pretty_name = "INGRESS"
|
||||
flight.points.append(center_point)
|
||||
|
||||
egress_point = FlightWaypoint(egress.x, egress.y, 1000)
|
||||
egress_point.description = "Egress from CAS area"
|
||||
egress_point.name = "EGRESS"
|
||||
egress_point.pretty_name = "EGRESS"
|
||||
flight.points.append(egress_point)
|
||||
|
||||
self.cas_flights.append(flight)
|
||||
@ -234,6 +247,7 @@ class FlightPlanner:
|
||||
|
||||
point = FlightWaypoint(location.position.x, location.position.y, 1000)
|
||||
point.description = "SEAD"
|
||||
point.pretty_name = "SEAD"
|
||||
point.targets.append(location)
|
||||
flight.points.append(point)
|
||||
|
||||
@ -324,8 +338,12 @@ class FlightPlanner:
|
||||
return "-"*40 + "\n" + self.from_cp.name + " planned flights :\n"\
|
||||
+ "-"*40 + "\n" + "\n".join([repr(f) for f in self.flights]) + "\n" + "-"*40
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def get_available_aircraft(self):
|
||||
base_aircraft_inventory = dict({k: v for k, v in self.from_cp.base.aircraft.items()})
|
||||
for f in self.flights:
|
||||
if f.unit_type in base_aircraft_inventory.keys():
|
||||
base_aircraft_inventory[f.unit_type] = base_aircraft_inventory[f.unit_type] - f.count
|
||||
if base_aircraft_inventory[f.unit_type] <= 0:
|
||||
del base_aircraft_inventory[f.unit_type]
|
||||
return base_aircraft_inventory
|
||||
|
||||
|
||||
@ -81,7 +81,7 @@ class QTopPanel(QFrame):
|
||||
self.budgetBox.setGame(self.game)
|
||||
self.factionsInfos.setGame(self.game)
|
||||
|
||||
if not len(self.game.planners.keys()) == len(self.game.theater.controlpoints):
|
||||
if self.game and self.game.turn == 0:
|
||||
self.proceedButton.setEnabled(False)
|
||||
else:
|
||||
self.proceedButton.setEnabled(True)
|
||||
|
||||
@ -1,45 +0,0 @@
|
||||
from PySide2.QtWidgets import QGridLayout, QLabel, QGroupBox, QVBoxLayout
|
||||
|
||||
from game import db
|
||||
from qt_ui.uiconstants import AIRCRAFT_ICONS, VEHICLES_ICONS
|
||||
from theater import ControlPoint, Airport
|
||||
|
||||
|
||||
class QBaseInformation(QGroupBox):
|
||||
|
||||
def __init__(self, cp:ControlPoint, airport:Airport):
|
||||
super(QBaseInformation, self).__init__("Base defenses")
|
||||
self.cp = cp
|
||||
self.airport = airport
|
||||
self.setMinimumWidth(500)
|
||||
self.init_ui()
|
||||
|
||||
def init_ui(self):
|
||||
self.layout = QGridLayout()
|
||||
|
||||
unit_dict = {}
|
||||
for g in self.cp.ground_objects:
|
||||
if g.airbase_group:
|
||||
for group in g.groups:
|
||||
for u in group.units:
|
||||
if u.type in unit_dict.keys():
|
||||
unit_dict[u.type] = unit_dict[u.type] + 1
|
||||
else:
|
||||
unit_dict[u.type] = 1
|
||||
|
||||
i = 0
|
||||
for k,v in unit_dict.items():
|
||||
icon = QLabel()
|
||||
if k in VEHICLES_ICONS.keys():
|
||||
icon.setPixmap(VEHICLES_ICONS[k])
|
||||
else:
|
||||
icon.setText("<b>"+k[:6]+"</b>")
|
||||
icon.setProperty("style", "icon-plane")
|
||||
self.layout.addWidget(icon, i, 0)
|
||||
self.layout.addWidget(QLabel(str(v) + " x " + k), i, 1)
|
||||
i = i + 1
|
||||
|
||||
stretch = QVBoxLayout()
|
||||
stretch.addStretch()
|
||||
self.layout.addLayout(stretch, len(unit_dict) + 1, 0)
|
||||
self.setLayout(self.layout)
|
||||
@ -76,24 +76,13 @@ class QLiberationMap(QGraphicsView):
|
||||
scene.addItem(QMapControlPoint(self, pos[0] - CONST.CP_SIZE / 2, pos[1] - CONST.CP_SIZE / 2, CONST.CP_SIZE,
|
||||
CONST.CP_SIZE, cp, self.game))
|
||||
|
||||
|
||||
if cp.captured:
|
||||
pen = QPen(brush=CONST.COLORS["blue"])
|
||||
brush = CONST.COLORS["blue_transparent"]
|
||||
|
||||
flight_path_pen = QPen(brush=CONST.COLORS["blue"])
|
||||
flight_path_pen.setColor(CONST.COLORS["blue"])
|
||||
flight_path_pen.setWidth(1)
|
||||
flight_path_pen.setStyle(Qt.DashDotLine)
|
||||
else:
|
||||
pen = QPen(brush=CONST.COLORS["red"])
|
||||
brush = CONST.COLORS["red_transparent"]
|
||||
|
||||
flight_path_pen = QPen(brush=CONST.COLORS["bright_red"])
|
||||
flight_path_pen.setColor(CONST.COLORS["bright_red"])
|
||||
flight_path_pen.setWidth(1)
|
||||
flight_path_pen.setStyle(Qt.DashDotLine)
|
||||
|
||||
for ground_object in cp.ground_objects:
|
||||
|
||||
go_pos = self._transform_point(ground_object.position)
|
||||
@ -119,6 +108,24 @@ class QLiberationMap(QGraphicsView):
|
||||
self.scene_create_lines_for_cp(cp)
|
||||
|
||||
for cp in self.game.theater.controlpoints:
|
||||
|
||||
if cp.captured:
|
||||
pen = QPen(brush=CONST.COLORS["blue"])
|
||||
brush = CONST.COLORS["blue_transparent"]
|
||||
|
||||
flight_path_pen = QPen(brush=CONST.COLORS["blue"])
|
||||
flight_path_pen.setColor(CONST.COLORS["blue"])
|
||||
flight_path_pen.setWidth(1)
|
||||
flight_path_pen.setStyle(Qt.DashDotLine)
|
||||
else:
|
||||
pen = QPen(brush=CONST.COLORS["red"])
|
||||
brush = CONST.COLORS["red_transparent"]
|
||||
|
||||
flight_path_pen = QPen(brush=CONST.COLORS["bright_red"])
|
||||
flight_path_pen.setColor(CONST.COLORS["bright_red"])
|
||||
flight_path_pen.setWidth(1)
|
||||
flight_path_pen.setStyle(Qt.DashDotLine)
|
||||
|
||||
pos = self._transform_point(cp.position)
|
||||
if self.get_display_rule("flight_paths"):
|
||||
if cp.id in self.game.planners.keys():
|
||||
|
||||
@ -210,16 +210,16 @@ class TheaterConfiguration(QtWidgets.QWizardPage):
|
||||
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 = QtWidgets.QRadioButton("Caucasus - Full map [NOT TESTED]")
|
||||
terrainCaucasus.setIcon(QtGui.QIcon(CONST.ICONS["Terrain_Caucasus"]))
|
||||
|
||||
terrainPg = QtWidgets.QRadioButton("Persian Gulf - Full Map")
|
||||
terrainPg = QtWidgets.QRadioButton("Persian Gulf - Full Map [NOT TESTED]")
|
||||
terrainPg.setIcon(QtGui.QIcon(CONST.ICONS["Terrain_Persian_Gulf"]))
|
||||
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 = QtWidgets.QRadioButton("Nevada - North Nevada [RECOMMENDED]")
|
||||
terrainNttr.setIcon(QtGui.QIcon(CONST.ICONS["Terrain_Nevada"]))
|
||||
terrainNormandy = QtWidgets.QRadioButton("Normandy [Alpha]")
|
||||
terrainNormandy.setIcon(QtGui.QIcon(CONST.ICONS["Terrain_Normandy"]))
|
||||
@ -282,6 +282,7 @@ class MiscOptions(QtWidgets.QWizardPage):
|
||||
sams.setChecked(True)
|
||||
midGame = QtWidgets.QCheckBox()
|
||||
multiplier = QtWidgets.QSpinBox()
|
||||
multiplier.setEnabled(False)
|
||||
multiplier.setMinimum(1)
|
||||
multiplier.setMaximum(5)
|
||||
|
||||
@ -290,11 +291,11 @@ class MiscOptions(QtWidgets.QWizardPage):
|
||||
self.registerField('multiplier', multiplier)
|
||||
|
||||
layout = QtWidgets.QGridLayout()
|
||||
layout.addWidget(QtWidgets.QLabel("With SAM Systems :"), 0, 0)
|
||||
layout.addWidget(sams, 0, 1)
|
||||
#layout.addWidget(QtWidgets.QLabel("With SAM Systems :"), 0, 0)
|
||||
#layout.addWidget(sams, 0, 1)
|
||||
layout.addWidget(QtWidgets.QLabel("Start at mid game"), 1, 0)
|
||||
layout.addWidget(midGame, 1, 1)
|
||||
layout.addWidget(QtWidgets.QLabel("Ennemy forces multiplier"), 2, 0)
|
||||
layout.addWidget(QtWidgets.QLabel("Ennemy forces multiplier [Disabled for Now]"), 2, 0)
|
||||
layout.addWidget(multiplier, 2, 1)
|
||||
self.setLayout(layout)
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ from dcs.unittype import UnitType
|
||||
from game.event import UnitsDeliveryEvent, ControlPointType
|
||||
from qt_ui.widgets.QBudgetBox import QBudgetBox
|
||||
from qt_ui.widgets.base.QAirportInformation import QAirportInformation
|
||||
from qt_ui.widgets.base.QBaseInformation import QBaseInformation
|
||||
from qt_ui.windows.basemenu.base_defenses.QBaseInformation import QBaseInformation
|
||||
from qt_ui.windows.mission.QPlannedFlightsView import QPlannedFlightsView
|
||||
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
|
||||
from theater import ControlPoint, CAP, Embarking, CAS, PinpointStrike, db
|
||||
|
||||
@ -18,6 +18,9 @@ class QBaseMenuTabs(QTabWidget):
|
||||
if not cp.captured:
|
||||
self.intel = QIntelInfo(cp, game)
|
||||
self.addTab(self.intel, "Intel")
|
||||
if not cp.is_carrier:
|
||||
self.base_defenses_hq = QBaseDefensesHQ(cp, game)
|
||||
self.addTab(self.base_defenses_hq, "Base Defenses")
|
||||
else:
|
||||
if cp.has_runway():
|
||||
self.airfield_command = QAirfieldCommand(cp, game)
|
||||
@ -28,6 +31,9 @@ class QBaseMenuTabs(QTabWidget):
|
||||
self.addTab(self.ground_forces_hq, "Ground Forces HQ")
|
||||
self.base_defenses_hq = QBaseDefensesHQ(cp, game)
|
||||
self.addTab(self.base_defenses_hq, "Base Defenses")
|
||||
else:
|
||||
self.base_defenses_hq = QBaseDefensesHQ(cp, game)
|
||||
self.addTab(self.base_defenses_hq, "Fleet")
|
||||
|
||||
else:
|
||||
tabError = QFrame()
|
||||
|
||||
@ -1,19 +1,8 @@
|
||||
import traceback
|
||||
from PySide2.QtWidgets import QVBoxLayout, QGridLayout, QGroupBox
|
||||
|
||||
from PySide2.QtCore import Qt
|
||||
from PySide2.QtGui import QCloseEvent
|
||||
from PySide2.QtWidgets import QHBoxLayout, QLabel, QWidget, QDialog, QVBoxLayout, QGridLayout, QPushButton, \
|
||||
QGroupBox, QSizePolicy, QSpacerItem, QFrame
|
||||
from dcs.unittype import UnitType
|
||||
|
||||
from game.event import UnitsDeliveryEvent, ControlPointType
|
||||
from qt_ui.widgets.QBudgetBox import QBudgetBox
|
||||
from qt_ui.widgets.base.QAirportInformation import QAirportInformation
|
||||
from qt_ui.widgets.base.QBaseInformation import QBaseInformation
|
||||
from game.event import UnitsDeliveryEvent
|
||||
from qt_ui.windows.basemenu.QRecruitBehaviour import QRecruitBehaviour
|
||||
from qt_ui.windows.mission.QPlannedFlightsView import QPlannedFlightsView
|
||||
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
|
||||
from theater import ControlPoint, CAP, Embarking, CAS, PinpointStrike, db
|
||||
from theater import ControlPoint, CAP, CAS, db
|
||||
from game import Game
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,36 @@
|
||||
from PySide2.QtWidgets import QGridLayout, QLabel, QGroupBox
|
||||
|
||||
from qt_ui.uiconstants import VEHICLES_ICONS
|
||||
from theater import ControlPoint, TheaterGroundObject
|
||||
|
||||
|
||||
class QBaseDefenseGroupInfo(QGroupBox):
|
||||
|
||||
def __init__(self, cp:ControlPoint, ground_object: TheaterGroundObject):
|
||||
super(QBaseDefenseGroupInfo, self).__init__("Group : " + ground_object.obj_name)
|
||||
self.ground_object = ground_object
|
||||
self.init_ui()
|
||||
|
||||
def init_ui(self):
|
||||
unit_dict = {}
|
||||
layout = QGridLayout()
|
||||
for g in self.ground_object.groups:
|
||||
for u in g.units:
|
||||
if u.type in unit_dict.keys():
|
||||
unit_dict[u.type] = unit_dict[u.type] + 1
|
||||
else:
|
||||
unit_dict[u.type] = 1
|
||||
i = 0
|
||||
for k, v in unit_dict.items():
|
||||
icon = QLabel()
|
||||
if k in VEHICLES_ICONS.keys():
|
||||
icon.setPixmap(VEHICLES_ICONS[k])
|
||||
else:
|
||||
icon.setText("<b>" + k[:6] + "</b>")
|
||||
icon.setProperty("style", "icon-plane")
|
||||
layout.addWidget(icon, i, 0)
|
||||
layout.addWidget(QLabel(str(v) + " x " + k), i, 1)
|
||||
i = i + 1
|
||||
self.setLayout(layout)
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
from PySide2.QtWidgets import QFrame, QGridLayout, QLabel
|
||||
from PySide2.QtWidgets import QFrame, QGridLayout
|
||||
from game import Game
|
||||
from qt_ui.widgets.base.QBaseInformation import QBaseInformation
|
||||
from qt_ui.windows.basemenu.base_defenses.QBaseInformation import QBaseInformation
|
||||
from theater import ControlPoint
|
||||
|
||||
|
||||
|
||||
24
qt_ui/windows/basemenu/base_defenses/QBaseInformation.py
Normal file
24
qt_ui/windows/basemenu/base_defenses/QBaseInformation.py
Normal file
@ -0,0 +1,24 @@
|
||||
from PySide2.QtWidgets import QGridLayout, QLabel, QGroupBox, QVBoxLayout
|
||||
|
||||
from game import db
|
||||
from qt_ui.uiconstants import AIRCRAFT_ICONS, VEHICLES_ICONS
|
||||
from qt_ui.windows.basemenu.base_defenses.QBaseDefenseGroupInfo import QBaseDefenseGroupInfo
|
||||
from theater import ControlPoint, Airport
|
||||
|
||||
|
||||
class QBaseInformation(QGroupBox):
|
||||
|
||||
def __init__(self, cp:ControlPoint, airport:Airport):
|
||||
super(QBaseInformation, self).__init__("Base defenses")
|
||||
self.cp = cp
|
||||
self.airport = airport
|
||||
self.setMinimumWidth(500)
|
||||
self.init_ui()
|
||||
|
||||
def init_ui(self):
|
||||
self.layout = QVBoxLayout()
|
||||
for g in self.cp.ground_objects:
|
||||
if g.airbase_group:
|
||||
group_info = QBaseDefenseGroupInfo(self.cp, g)
|
||||
self.layout.addWidget(group_info)
|
||||
self.setLayout(self.layout)
|
||||
@ -42,9 +42,9 @@ class QMissionPlanning(QDialog):
|
||||
self.planned_flight_view.selectionModel().selectionChanged.connect(self.on_flight_selection_change)
|
||||
|
||||
if len(self.planned_flight_view.flight_planner.flights) > 0:
|
||||
self.flight_planner = QFlightPlanner(self.planned_flight_view.flight_planner.flights[0], self.game)
|
||||
self.flight_planner = QFlightPlanner(self.planned_flight_view.flight_planner.flights[0], self.game, self.planned_flight_view.flight_planner)
|
||||
else:
|
||||
self.flight_planner = QFlightPlanner(None, self.game)
|
||||
self.flight_planner = QFlightPlanner(None, self.game, self.planned_flight_view.flight_planner)
|
||||
|
||||
self.add_flight_button = QPushButton("Add Flight")
|
||||
self.add_flight_button.clicked.connect(self.on_add_flight)
|
||||
@ -89,7 +89,7 @@ class QMissionPlanning(QDialog):
|
||||
index = self.planned_flight_view.selectionModel().currentIndex().row()
|
||||
flight = self.planner.flights[index]
|
||||
|
||||
self.flight_planner = QFlightPlanner(flight, self.game)
|
||||
self.flight_planner = QFlightPlanner(flight, self.game, self.planner)
|
||||
self.layout.addWidget(self.flight_planner, 0, 1)
|
||||
|
||||
def on_add_flight(self):
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
from typing import List
|
||||
|
||||
from PySide2.QtCore import Qt
|
||||
from PySide2.QtWidgets import QDialog, QGridLayout, QLabel, QComboBox, QHBoxLayout, QVBoxLayout, QPushButton, QSpinBox
|
||||
from PySide2.QtWidgets import QDialog, QGridLayout, QLabel, QComboBox, QHBoxLayout, QVBoxLayout, QPushButton, QSpinBox, \
|
||||
QMessageBox
|
||||
from dcs import Point
|
||||
from dcs.unittype import UnitType
|
||||
|
||||
@ -28,6 +29,7 @@ class QFlightCreator(QDialog):
|
||||
self.from_cp = from_cp
|
||||
self.flight_view = flight_view
|
||||
self.planner = self.game.planners[from_cp.id]
|
||||
self.available = self.planner.get_available_aircraft()
|
||||
|
||||
self.setWindowFlags(Qt.WindowStaysOnTopHint)
|
||||
self.setModal(True)
|
||||
@ -35,7 +37,7 @@ class QFlightCreator(QDialog):
|
||||
self.setWindowIcon(EVENT_ICONS["strike"])
|
||||
|
||||
self.select_type_aircraft = QComboBox()
|
||||
for aircraft_type in possible_aircraft_type:
|
||||
for aircraft_type in self.planner.get_available_aircraft().keys():
|
||||
print(aircraft_type)
|
||||
print(aircraft_type.name)
|
||||
self.select_type_aircraft.addItem(aircraft_type.id, userData=aircraft_type)
|
||||
@ -47,7 +49,7 @@ class QFlightCreator(QDialog):
|
||||
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("BAI [Battlefield Interdiction]", userData=FlightType.BAI)
|
||||
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)
|
||||
@ -60,7 +62,7 @@ class QFlightCreator(QDialog):
|
||||
self.select_count_of_aircraft.setValue(2)
|
||||
|
||||
self.add_button = QPushButton("Add")
|
||||
self.add_button.clicked.connect(self.create)
|
||||
self.add_button.clicked.connect(self.create_flight)
|
||||
|
||||
self.init_ui()
|
||||
|
||||
@ -91,13 +93,24 @@ class QFlightCreator(QDialog):
|
||||
|
||||
self.setLayout(layout)
|
||||
|
||||
def create(self):
|
||||
def create_flight(self):
|
||||
aircraft_type = self.select_type_aircraft.currentData()
|
||||
count = self.select_count_of_aircraft.value()
|
||||
flight = Flight(aircraft_type, count, self.from_cp, self.select_flight_type.currentData())
|
||||
self.planner.flights.append(flight)
|
||||
self.planner.custom_flights.append(flight)
|
||||
if self.flight_view is not None:
|
||||
self.flight_view.set_flight_planner(self.planner)
|
||||
self.close()
|
||||
|
||||
if self.available[aircraft_type] < count:
|
||||
msg = QMessageBox()
|
||||
msg.setIcon(QMessageBox.Information)
|
||||
msg.setText("Not enough aircraft of this type are available. Only " + str(self.available[aircraft_type]) + " available.")
|
||||
msg.setWindowTitle("Not enough aircraft")
|
||||
msg.setStandardButtons(QMessageBox.Ok)
|
||||
msg.setWindowFlags(Qt.WindowStaysOnTopHint)
|
||||
msg.exec_()
|
||||
return
|
||||
else:
|
||||
flight = Flight(aircraft_type, count, self.from_cp, self.select_flight_type.currentData())
|
||||
self.planner.flights.append(flight)
|
||||
self.planner.custom_flights.append(flight)
|
||||
if self.flight_view is not None:
|
||||
self.flight_view.set_flight_planner(self.planner)
|
||||
self.close()
|
||||
|
||||
|
||||
@ -9,10 +9,10 @@ from qt_ui.windows.mission.flight.waypoints.QFlightWaypointTab import QFlightWay
|
||||
|
||||
class QFlightPlanner(QTabWidget):
|
||||
|
||||
def __init__(self, flight: Flight, game: Game):
|
||||
def __init__(self, flight: Flight, game: Game, planner):
|
||||
super(QFlightPlanner, self).__init__()
|
||||
if flight:
|
||||
self.general_settings_tab = QGeneralFlightSettingsTab(flight, game)
|
||||
self.general_settings_tab = QGeneralFlightSettingsTab(flight, game, planner)
|
||||
self.payload_tab = QFlightPayloadTab(flight, game)
|
||||
self.waypoint_tab = QFlightWaypointTab(game, flight)
|
||||
self.addTab(self.general_settings_tab, "General Flight settings")
|
||||
|
||||
@ -6,23 +6,32 @@ class QFlightSlotEditor(QGroupBox):
|
||||
|
||||
changed = Signal()
|
||||
|
||||
def __init__(self, flight, game):
|
||||
def __init__(self, flight, game, planner):
|
||||
super(QFlightSlotEditor, self).__init__("Slots")
|
||||
self.flight = flight
|
||||
self.game = game
|
||||
self.planner = planner
|
||||
self.available = self.planner.get_available_aircraft()
|
||||
if self.flight.unit_type not in self.available:
|
||||
max = self.flight.count
|
||||
else:
|
||||
max = self.flight.count + self.available[self.flight.unit_type]
|
||||
if max > 4:
|
||||
max = 4
|
||||
|
||||
layout = QGridLayout()
|
||||
|
||||
self.aircraft_count = QLabel("Aircraft count :")
|
||||
self.aircraft_count_spinner = QSpinBox()
|
||||
self.aircraft_count_spinner.setMinimum(1)
|
||||
self.aircraft_count_spinner.setMaximum(4)
|
||||
self.aircraft_count_spinner.setMaximum(max)
|
||||
self.aircraft_count_spinner.setValue(flight.count)
|
||||
self.aircraft_count_spinner.valueChanged.connect(self._changed_aircraft_count)
|
||||
|
||||
self.client_count = QLabel("Client slots count :")
|
||||
self.client_count_spinner = QSpinBox()
|
||||
self.client_count_spinner.setMinimum(0)
|
||||
self.client_count_spinner.setMaximum(4)
|
||||
self.client_count_spinner.setMaximum(max)
|
||||
self.client_count_spinner.setValue(flight.client_count)
|
||||
self.client_count_spinner.valueChanged.connect(self._changed_client_count)
|
||||
|
||||
|
||||
@ -10,17 +10,18 @@ from qt_ui.windows.mission.flight.settings.QFlightTypeTaskInfo import QFlightTyp
|
||||
|
||||
class QGeneralFlightSettingsTab(QFrame):
|
||||
|
||||
def __init__(self, flight: Flight, game: Game):
|
||||
def __init__(self, flight: Flight, game: Game, planner):
|
||||
super(QGeneralFlightSettingsTab, self).__init__()
|
||||
self.flight = flight
|
||||
self.game = game
|
||||
self.planner = planner
|
||||
self.init_ui()
|
||||
|
||||
def init_ui(self):
|
||||
layout = QGridLayout()
|
||||
self.flight_info = QFlightTypeTaskInfo(self.flight)
|
||||
self.flight_departure = QFlightDepartureEditor(self.flight)
|
||||
self.flight_slots = QFlightSlotEditor(self.flight, self.game)
|
||||
self.flight_slots = QFlightSlotEditor(self.flight, self.game, self.planner)
|
||||
self.flight_start_type = QFlightStartType(self.flight)
|
||||
layout.addWidget(self.flight_info, 0, 0)
|
||||
layout.addWidget(self.flight_departure, 1, 0)
|
||||
|
||||
@ -5,6 +5,7 @@ from PySide2.QtWidgets import QLabel, QDialog, QGridLayout, QListView, QStackedL
|
||||
|
||||
import qt_ui.uiconstants as CONST
|
||||
from game.game import Game
|
||||
from game.infos.information import Information
|
||||
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
|
||||
|
||||
|
||||
@ -163,21 +164,28 @@ class QSettingsWindow(QDialog):
|
||||
self.cheat50M = QPushButton("Cheat +50M")
|
||||
self.cheat100M = QPushButton("Cheat +100M")
|
||||
self.cheat200M = QPushButton("Cheat +200M")
|
||||
self.cheat500M = QPushButton("Cheat +500M")
|
||||
self.cheat1000M = QPushButton("Cheat +1000M")
|
||||
|
||||
self.cheat25M.clicked.connect(lambda: self.cheatMoney(25))
|
||||
self.cheat50M.clicked.connect(lambda: self.cheatMoney(50))
|
||||
self.cheat100M.clicked.connect(lambda: self.cheatMoney(100))
|
||||
self.cheat200M.clicked.connect(lambda: self.cheatMoney(200))
|
||||
self.cheat500M.clicked.connect(lambda: self.cheatMoney(500))
|
||||
self.cheat1000M.clicked.connect(lambda: self.cheatMoney(1000))
|
||||
|
||||
self.moneyCheatBoxLayout.addWidget(self.cheat25M, 0, 0)
|
||||
self.moneyCheatBoxLayout.addWidget(self.cheat50M, 0, 1)
|
||||
self.moneyCheatBoxLayout.addWidget(self.cheat100M, 1, 0)
|
||||
self.moneyCheatBoxLayout.addWidget(self.cheat200M, 1, 1)
|
||||
self.moneyCheatBoxLayout.addWidget(self.cheat500M, 2, 0)
|
||||
self.moneyCheatBoxLayout.addWidget(self.cheat1000M, 2, 1)
|
||||
|
||||
self.cheatLayout.addWidget(self.moneyCheatBox, 0, 0)
|
||||
|
||||
def cheatMoney(self, amount):
|
||||
self.game.budget += amount
|
||||
self.game.informations.append(Information("CHEATER", "You are a cheater and you should feel bad", self.game.turn))
|
||||
GameUpdateSignal.get_instance().updateGame(self.game)
|
||||
|
||||
def applySettings(self):
|
||||
|
||||
@ -77,6 +77,7 @@ QLabel[style="base-title"]{
|
||||
QLabel[style="icon-plane"]{
|
||||
background-color:#48719D;
|
||||
min-height:24px;
|
||||
max-width: 84px;
|
||||
border: 1px solid black;
|
||||
text-align:center;
|
||||
color:white;
|
||||
|
||||
@ -30,23 +30,20 @@ class NevadaTheater(ConflictTheater):
|
||||
self.mesquite = ControlPoint.from_airport(nevada.Mesquite, LAND, SIZE_REGULAR, 1.3)
|
||||
self.beatty = ControlPoint.from_airport(nevada.Beatty_Airport, LAND, SIZE_REGULAR, 1.1)
|
||||
self.creech = ControlPoint.from_airport(nevada.Creech_AFB, LAND, SIZE_BIG, IMPORTANCE_HIGH)
|
||||
self.las_vegas = ControlPoint.from_airport(nevada.North_Las_Vegas, LAND, SIZE_LARGE, IMPORTANCE_HIGH)
|
||||
self.jean = ControlPoint.from_airport(nevada.Jean_Airport, LAND, SIZE_REGULAR, 1.2)
|
||||
self.laughlin = ControlPoint.from_airport(nevada.Laughlin_Airport, LAND, SIZE_LARGE, IMPORTANCE_HIGH)
|
||||
#self.las_vegas = ControlPoint.from_airport(nevada.North_Las_Vegas, LAND, SIZE_LARGE, IMPORTANCE_HIGH)
|
||||
#self.jean = ControlPoint.from_airport(nevada.Jean_Airport, LAND, SIZE_REGULAR, 1.2)
|
||||
#self.laughlin = ControlPoint.from_airport(nevada.Laughlin_Airport, LAND, SIZE_LARGE, IMPORTANCE_HIGH)
|
||||
|
||||
self.add_controlpoint(self.tonopah, connected_to=[self.tonopah_test_range])
|
||||
|
||||
self.add_controlpoint(self.tonopah, connected_to=[self.tonopah_test_range, self.lincoln_conty])
|
||||
self.add_controlpoint(self.tonopah_test_range, connected_to=[self.tonopah, self.lincoln_conty, self.pahute_mesa])
|
||||
self.add_controlpoint(self.lincoln_conty, connected_to=[self.tonopah_test_range, self.tonopah, self.mesquite])
|
||||
|
||||
self.add_controlpoint(self.groom_lake, connected_to=[self.pahute_mesa, self.lincoln_conty, self.mesquite])
|
||||
self.add_controlpoint(self.lincoln_conty, connected_to=[self.tonopah_test_range, self.mesquite, self.groom_lake])
|
||||
self.add_controlpoint(self.pahute_mesa, connected_to=[self.groom_lake, self.tonopah_test_range, self.beatty, self.creech])
|
||||
self.add_controlpoint(self.mesquite, connected_to=[self.lincoln_conty, self.groom_lake, self.creech, self.las_vegas])
|
||||
self.add_controlpoint(self.beatty, connected_to=[self.pahute_mesa, self.creech])
|
||||
self.add_controlpoint(self.groom_lake, connected_to=[self.pahute_mesa, self.lincoln_conty, self.mesquite])
|
||||
|
||||
self.add_controlpoint(self.creech, connected_to=[self.beatty, self.mesquite, self.pahute_mesa, self.las_vegas])
|
||||
self.add_controlpoint(self.las_vegas, connected_to=[self.mesquite, self.creech, self.jean, self.laughlin])
|
||||
self.add_controlpoint(self.jean, connected_to=[self.laughlin, self.las_vegas])
|
||||
self.add_controlpoint(self.laughlin, connected_to=[self.jean, self.las_vegas])
|
||||
self.add_controlpoint(self.beatty, connected_to=[self.pahute_mesa])
|
||||
self.add_controlpoint(self.creech, connected_to=[self.mesquite, self.pahute_mesa])
|
||||
self.add_controlpoint(self.mesquite, connected_to=[self.lincoln_conty, self.groom_lake, self.creech])
|
||||
|
||||
self.tonopah.captured = True
|
||||
|
||||
|
||||
@ -123,7 +123,9 @@ class IranianCampaign(ConflictTheater):
|
||||
self.jiroft = ControlPoint.from_airport(persiangulf.Jiroft_Airport, LAND, SIZE_BIG, IMPORTANCE_HIGH)
|
||||
self.bandar_e_jask = ControlPoint.from_airport(persiangulf.Bandar_e_Jask_airfield, LAND, SIZE_TINY,IMPORTANCE_LOW)
|
||||
self.ras_al_khaimah = ControlPoint.from_airport(persiangulf.Ras_Al_Khaimah, LAND, SIZE_REGULAR,IMPORTANCE_MEDIUM)
|
||||
self.east_carrier = ControlPoint.carrier("East carrier", Point(59514.324335475, 28165.517980635))
|
||||
|
||||
self.east_carrier = ControlPoint.carrier("East carrier", Point(59514.324335475, 28165.517980635), 1001)
|
||||
self.west_carrier = ControlPoint.lha("Tarawa", Point(-27500.813952358, -147000.65947136), 1002)
|
||||
|
||||
self.add_controlpoint(self.ras_al_khaimah, connected_to=[self.khasab])
|
||||
self.add_controlpoint(self.khasab, connected_to=[self.ras_al_khaimah])
|
||||
@ -139,7 +141,10 @@ class IranianCampaign(ConflictTheater):
|
||||
self.add_controlpoint(self.lar, connected_to=[self.bandar_lengeh, self.havadarya, self.shiraz, self.kerman])
|
||||
|
||||
self.add_controlpoint(self.east_carrier)
|
||||
self.add_controlpoint(self.west_carrier)
|
||||
|
||||
self.east_carrier.captured = True
|
||||
self.west_carrier.captured = True
|
||||
self.al_dhafra.captured = True
|
||||
self.ras_al_khaimah.captured = True
|
||||
self.khasab.captured = True
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user