Improved Mission Planning flight selection behaviour.

This commit is contained in:
Khopa 2020-06-01 12:36:10 +02:00
parent 64c5c39b2a
commit c203ded1cd
8 changed files with 73 additions and 18 deletions

19
changelog.md Normal file
View File

@ -0,0 +1,19 @@
2.0 RC 6
--------
Features/Improvements :
* Supercarrier support (You have to go to settings to enable it, if you have the supercarrier module)
* Carrier ICLS channel will now be configured (check your briefing)
* When a base is captured, refill the "base defenses" group with units for the new owner.
* SAM units will spawn on RED Alarm state
* AI Flight planner now creates its own STRIKE flights
* Added performance settings to allow disabling : smoke, artillery strike, moving units, infantry, SAM alert mode.
* Added support for newest WW2 Units
Fixes :
* Fixed : CAS waypoints created from the "Predefined waypoint selector" would not be at the exact location of the frontline
* Fixed : Game generation does not work when "no night mission" settings was selected and the current time was "day"
* Fixed : Game generation does not work when the player selected faction has no AWACS
* Fixed : Base defenses would not be generated on normandy map
* Fixed : CAP mission flown from airbase are not named BARCAP anymore (CAP from carrier is still named BARCAP)

View File

@ -681,7 +681,15 @@ PLANE_PAYLOAD_OVERRIDES = {
AntishipStrike: "ANTISHIP",
GroundAttack: "STRIKE"
},
F_A_18C: {
CAP: "CAP HEAVY",
Intercept: "CAP HEAVY",
CAS: "CAS MAVERICK F",
PinpointStrike: "STRIKE",
SEAD: "SEAD",
AntishipStrike: "ANTISHIP",
GroundAttack: "STRIKE"
},
A_10A: COMMON_OVERRIDE,
A_10C: COMMON_OVERRIDE,
AV8BNA: COMMON_OVERRIDE,

View File

@ -65,7 +65,7 @@ class BriefingGenerator:
self.description += "-" * 50 + "\n"
for name, freq in self.freqs:
self.description += "\n{}: {}".format(name, freq)
self.description += "\n-" * 50 + "\n"
self.description += "\n" + ("-" * 50) + "\n"
for cp in self.game.theater.controlpoints:
if cp.captured and cp.cptype in [ControlPointType.LHA_GROUP, ControlPointType.AIRCRAFT_CARRIER_GROUP]:
self.description += cp.name + " TACAN : "

View File

@ -59,7 +59,7 @@ class FlightPlanner:
#self.commision_interceptors()
# Then some CAP patrol for the next 2 hours
self.commision_barcap()
self.commision_cap()
# Then setup cas
self.commision_cas()
@ -115,7 +115,7 @@ class FlightPlanner:
for k, v in inventory.items():
self.aircraft_inventory[k] = v
def commision_barcap(self):
def commision_cap(self):
"""
Pick some aircraft to assign them to defensive CAP roles (BARCAP)
"""

View File

@ -38,7 +38,7 @@ class QMissionPlanning(QDialog):
self.planned_flight_view.set_flight_planner(self.planner)
self.selected_cp = self.captured_cp[0]
self.planned_flight_view.selectionModel().setCurrentIndex(self.planned_flight_view.indexAt(QPoint(1, 1)), QItemSelectionModel.Select)
self.planned_flight_view.selectionModel().setCurrentIndex(self.planned_flight_view.indexAt(QPoint(1, 1)), QItemSelectionModel.Rows)
self.planned_flight_view.selectionModel().selectionChanged.connect(self.on_flight_selection_change)
if len(self.planned_flight_view.flight_planner.flights) > 0:
@ -83,15 +83,24 @@ 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]
print("On flight selection change")
index = self.planned_flight_view.selectionModel().currentIndex().row()
self.planned_flight_view.repaint();
if self.flight_planner is not None:
self.flight_planner.clearTabs()
try:
flight = self.planner.flights[index]
except IndexError:
flight = None
self.flight_planner = QFlightPlanner(flight, self.game, self.planner)
self.layout.addWidget(self.flight_planner, 0, 1)
def on_add_flight(self):
possible_aircraft_type = list(self.selected_cp.base.aircraft.keys())
@ -110,7 +119,8 @@ class QMissionPlanning(QDialog):
def on_delete_flight(self):
index = self.planned_flight_view.selectionModel().currentIndex().row()
self.planner.remove_flight(index)
self.planned_flight_view.set_flight_planner(self.planner)
self.planned_flight_view.set_flight_planner(self.planner, index)
def on_start(self):

View File

@ -1,6 +1,6 @@
from PySide2.QtCore import QSize
from PySide2.QtCore import QSize, QItemSelectionModel, QPoint
from PySide2.QtGui import QStandardItemModel
from PySide2.QtWidgets import QListView
from PySide2.QtWidgets import QListView, QAbstractItemView
from gen.flights.ai_flight_planner import FlightPlanner
from qt_ui.windows.mission.QFlightItem import QFlightItem
@ -13,18 +13,29 @@ class QPlannedFlightsView(QListView):
self.model = QStandardItemModel(self)
self.setModel(self.model)
self.setIconSize(QSize(91, 24))
self.setSelectionBehavior(QAbstractItemView.SelectItems)
if flight_planner:
self.set_flight_planner(flight_planner)
def update_content(self):
def update_content(self, row=0):
for i, f in enumerate(self.flight_planner.flights):
self.model.appendRow(QFlightItem(f))
self.setSelectedFlight(row)
self.repaint()
def setSelectedFlight(self, row):
self.selectionModel().clearSelection()
index = self.model.index(row, 0)
if not index.isValid():
index = self.model.index(0, 0)
self.selectionModel().setCurrentIndex(index, QItemSelectionModel.Select)
self.repaint()
def clear_layout(self):
self.model.removeRows(0, self.model.rowCount())
def set_flight_planner(self, flight_planner: FlightPlanner):
def set_flight_planner(self, flight_planner: FlightPlanner, row=0):
self.clear_layout()
self.flight_planner = flight_planner
if self.flight_planner:
self.update_content()
self.update_content(row)

View File

@ -111,6 +111,6 @@ class QFlightCreator(QDialog):
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.flight_view.set_flight_planner(self.planner, len(self.planner.flights)-1)
self.close()

View File

@ -11,6 +11,7 @@ class QFlightPlanner(QTabWidget):
def __init__(self, flight: Flight, game: Game, planner):
super(QFlightPlanner, self).__init__()
self.tabCount = 0
if flight:
self.general_settings_tab = QGeneralFlightSettingsTab(flight, game, planner)
self.payload_tab = QFlightPayloadTab(flight, game)
@ -18,9 +19,15 @@ class QFlightPlanner(QTabWidget):
self.addTab(self.general_settings_tab, "General Flight settings")
self.addTab(self.payload_tab, "Payload")
self.addTab(self.waypoint_tab, "Waypoints")
self.tabCount = 3
else:
tabError = QFrame()
l = QGridLayout()
l.addWidget(QLabel("No flight selected"))
tabError.setLayout(l)
self.addTab(tabError, "No flight")
self.tabCount = 1
def clearTabs(self):
for i in range(self.tabCount):
self.removeTab(i)