mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
parent
e9917ba00e
commit
a8d6f90f55
@ -21,6 +21,7 @@ Saves from 5.x are not compatible with 6.0.
|
|||||||
* **[UI]** Added options to the loadout editor for setting properties such as HMD choice.
|
* **[UI]** Added options to the loadout editor for setting properties such as HMD choice.
|
||||||
* **[UI]** Added separate images for the different carrier types.
|
* **[UI]** Added separate images for the different carrier types.
|
||||||
* **[UI]** Add Accept/Reset buttons to Air Wing Configurator screen.
|
* **[UI]** Add Accept/Reset buttons to Air Wing Configurator screen.
|
||||||
|
* **[UI]** Add livery selector to Air Wing Configurator's squadrons.
|
||||||
* **[Campaign]** Allow campaign designers to define default values for the economy settings (starting budget and multiplier).
|
* **[Campaign]** Allow campaign designers to define default values for the economy settings (starting budget and multiplier).
|
||||||
* **[Plugins]** Allow full support of the SkynetIADS plugin with all advanced features (connection nodes, power sources, command centers) if campaign supports it.
|
* **[Plugins]** Allow full support of the SkynetIADS plugin with all advanced features (connection nodes, power sources, command centers) if campaign supports it.
|
||||||
* **[Plugins]** Added support for the CTLD script by ciribob with many possible customization options and updated the JTAC Autolase to the CTLD included script.
|
* **[Plugins]** Added support for the CTLD script by ciribob with many possible customization options and updated the JTAC Autolase to the CTLD included script.
|
||||||
|
|||||||
@ -74,6 +74,10 @@ class Coalition:
|
|||||||
def country_name(self) -> str:
|
def country_name(self) -> str:
|
||||||
return self.faction.country
|
return self.faction.country
|
||||||
|
|
||||||
|
@property
|
||||||
|
def country_shortname(self) -> str:
|
||||||
|
return self.faction.country_shortname
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def opponent(self) -> Coalition:
|
def opponent(self) -> Coalition:
|
||||||
assert self._opponent is not None
|
assert self._opponent is not None
|
||||||
|
|||||||
@ -46,6 +46,9 @@ class Faction:
|
|||||||
# Country used by this faction
|
# Country used by this faction
|
||||||
country: str = field(default="")
|
country: str = field(default="")
|
||||||
|
|
||||||
|
# Country's short name used by this faction
|
||||||
|
country_shortname: str = field(default="")
|
||||||
|
|
||||||
# Nice name of the faction
|
# Nice name of the faction
|
||||||
name: str = field(default="")
|
name: str = field(default="")
|
||||||
|
|
||||||
@ -172,13 +175,22 @@ class Faction:
|
|||||||
faction = Faction(locales=json.get("locales"))
|
faction = Faction(locales=json.get("locales"))
|
||||||
|
|
||||||
faction.country = json.get("country", "/")
|
faction.country = json.get("country", "/")
|
||||||
if faction.country not in [c.name for c in country_dict.values()]:
|
|
||||||
|
country = None
|
||||||
|
for c in country_dict.values():
|
||||||
|
if c.name == faction.country:
|
||||||
|
country = c
|
||||||
|
break
|
||||||
|
|
||||||
|
if country is None:
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
'Faction\'s country ("{}") is not a valid DCS country ID'.format(
|
'Faction\'s country ("{}") is not a valid DCS country ID'.format(
|
||||||
faction.country
|
faction.country
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
faction.country_shortname = country.shortname
|
||||||
|
|
||||||
faction.name = json.get("name", "")
|
faction.name = json.get("name", "")
|
||||||
if not faction.name:
|
if not faction.name:
|
||||||
raise AssertionError("Faction has no valid name")
|
raise AssertionError("Faction has no valid name")
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import logging
|
||||||
from typing import Iterable, Optional, Iterator
|
from typing import Iterable, Optional, Iterator
|
||||||
|
|
||||||
from PySide2.QtCore import (
|
from PySide2.QtCore import (
|
||||||
@ -26,7 +27,6 @@ from PySide2.QtWidgets import (
|
|||||||
QPushButton,
|
QPushButton,
|
||||||
QGridLayout,
|
QGridLayout,
|
||||||
QToolButton,
|
QToolButton,
|
||||||
QMessageBox,
|
|
||||||
)
|
)
|
||||||
from game import Game
|
from game import Game
|
||||||
from game.ato.flighttype import FlightType
|
from game.ato.flighttype import FlightType
|
||||||
@ -137,6 +137,38 @@ class SquadronBaseSelector(QComboBox):
|
|||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
|
|
||||||
|
class SquadronLiverySelector(QComboBox):
|
||||||
|
"""
|
||||||
|
A combo box for selecting a squadron's livery.
|
||||||
|
The combo box will automatically be populated with all available liveries.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, squadron: Squadron) -> None:
|
||||||
|
super().__init__()
|
||||||
|
self.setSizeAdjustPolicy(self.AdjustToContents)
|
||||||
|
|
||||||
|
self.aircraft_type = squadron.aircraft
|
||||||
|
selected_livery = squadron.livery
|
||||||
|
|
||||||
|
liveries = set()
|
||||||
|
cc = squadron.coalition.faction.country_shortname
|
||||||
|
aircraft_liveries = self.aircraft_type.dcs_unit_type.Liveries
|
||||||
|
if len(aircraft_liveries) == 0:
|
||||||
|
logging.info(f"Liveries for {self.aircraft_type} is empty!")
|
||||||
|
for livery in aircraft_liveries:
|
||||||
|
valid_livery = livery.countries is None or cc in livery.countries
|
||||||
|
if valid_livery or cc in ["BLUE", "RED"]:
|
||||||
|
liveries.add(livery)
|
||||||
|
for livery in sorted(liveries):
|
||||||
|
self.addItem(livery.name, userData=livery.id)
|
||||||
|
if selected_livery is not None:
|
||||||
|
if selected_livery == livery.id:
|
||||||
|
self.setCurrentText(livery.name)
|
||||||
|
if len(liveries) == 0:
|
||||||
|
self.addItem("No available liveries (using DCS default)")
|
||||||
|
self.setEnabled(False)
|
||||||
|
|
||||||
|
|
||||||
class SquadronConfigurationBox(QGroupBox):
|
class SquadronConfigurationBox(QGroupBox):
|
||||||
remove_squadron_signal = Signal(Squadron)
|
remove_squadron_signal = Signal(Squadron)
|
||||||
|
|
||||||
@ -169,6 +201,10 @@ class SquadronConfigurationBox(QGroupBox):
|
|||||||
reroll_nickname_button.clicked.connect(self.reroll_nickname)
|
reroll_nickname_button.clicked.connect(self.reroll_nickname)
|
||||||
nickname_edit_layout.addWidget(reroll_nickname_button, 1, 1, Qt.AlignTop)
|
nickname_edit_layout.addWidget(reroll_nickname_button, 1, 1, Qt.AlignTop)
|
||||||
|
|
||||||
|
left_column.addWidget(QLabel("Livery:"))
|
||||||
|
self.livery_selector = SquadronLiverySelector(squadron)
|
||||||
|
left_column.addWidget(self.livery_selector)
|
||||||
|
|
||||||
left_column.addWidget(QLabel("Base:"))
|
left_column.addWidget(QLabel("Base:"))
|
||||||
self.base_selector = SquadronBaseSelector(
|
self.base_selector = SquadronBaseSelector(
|
||||||
theater.control_points_for(squadron.player),
|
theater.control_points_for(squadron.player),
|
||||||
@ -224,6 +260,7 @@ class SquadronConfigurationBox(QGroupBox):
|
|||||||
if base is None:
|
if base is None:
|
||||||
raise RuntimeError("Base cannot be none")
|
raise RuntimeError("Base cannot be none")
|
||||||
self.squadron.assign_to_base(base)
|
self.squadron.assign_to_base(base)
|
||||||
|
self.squadron.livery = self.livery_selector.currentData()
|
||||||
|
|
||||||
player_names = self.player_list.toPlainText().splitlines()
|
player_names = self.player_list.toPlainText().splitlines()
|
||||||
# Prepend player pilots so they get set active first.
|
# Prepend player pilots so they get set active first.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user