mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Fix UI to obey max group sizes.
This also adds max group sizes for aircraft that need it but don't according to DCS. Only the first tanker or AEW&C unit in a group can be contacted by radio.
This commit is contained in:
parent
39fe5951f7
commit
5b31026e1c
@ -95,6 +95,7 @@ class AircraftType(UnitType[FlyingType]):
|
||||
carrier_capable: bool
|
||||
lha_capable: bool
|
||||
always_keeps_gun: bool
|
||||
max_group_size: int
|
||||
intra_flight_radio: Optional[Radio]
|
||||
channel_allocator: Optional[RadioChannelAllocator]
|
||||
channel_namer: Type[ChannelNamer]
|
||||
@ -142,6 +143,12 @@ class AircraftType(UnitType[FlyingType]):
|
||||
def channel_name(self, radio_id: int, channel_id: int) -> str:
|
||||
return self.channel_namer.channel_name(radio_id, channel_id)
|
||||
|
||||
def __setstate__(self, state: dict[str, Any]) -> None:
|
||||
# Update any existing models with new data on load.
|
||||
updated = AircraftType.named(state["name"])
|
||||
state.update(updated.__dict__)
|
||||
self.__dict__.update(state)
|
||||
|
||||
@classmethod
|
||||
def register(cls, aircraft_type: AircraftType) -> None:
|
||||
cls._by_name[aircraft_type.name] = aircraft_type
|
||||
@ -206,6 +213,7 @@ class AircraftType(UnitType[FlyingType]):
|
||||
carrier_capable=data.get("carrier_capable", False),
|
||||
lha_capable=data.get("lha_capable", False),
|
||||
always_keeps_gun=data.get("always_keeps_gun", False),
|
||||
max_group_size=data.get("max_group_size", aircraft.group_size_max),
|
||||
intra_flight_radio=radio_config.intra_flight,
|
||||
channel_allocator=radio_config.channel_allocator,
|
||||
channel_namer=radio_config.channel_namer,
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import logging
|
||||
from typing import Optional, Type
|
||||
|
||||
from PySide2.QtCore import Qt, Signal
|
||||
@ -260,7 +259,12 @@ class QFlightCreator(QDialog):
|
||||
)
|
||||
|
||||
def update_max_size(self, available: int) -> None:
|
||||
self.flight_size_spinner.setMaximum(min(available, 4))
|
||||
aircraft = self.aircraft_selector.currentData()
|
||||
if aircraft is None:
|
||||
self.flight_size_spinner.setMaximum(0)
|
||||
return
|
||||
|
||||
self.flight_size_spinner.setMaximum(min(available, aircraft.max_group_size))
|
||||
|
||||
if self.flight_size_spinner.maximum() >= 2:
|
||||
if self.flight_size_spinner.value() < 2:
|
||||
self.flight_size_spinner.setValue(2)
|
||||
self.flight_size_spinner.setValue(2)
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
description: The A-50 is an AWACS plane.
|
||||
max_group_size: 1
|
||||
price: 50
|
||||
variants:
|
||||
A-50: null
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
carrier_capable: true
|
||||
description: The Northrop Grumman E-2 Hawkeye is an American all-weather, carrier-capable
|
||||
max_group_size: 1
|
||||
description:
|
||||
The Northrop Grumman E-2 Hawkeye is an American all-weather, carrier-capable
|
||||
tactical airborne early warning (AEW) aircraft.
|
||||
introduced: 1973
|
||||
manufacturer: Northrop Grumman
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
description: The E-3A is a AWACS aicraft.
|
||||
price: 50
|
||||
max_group_size: 1
|
||||
variants:
|
||||
E-3A: null
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
price: 20
|
||||
max_group_size: 1
|
||||
variants:
|
||||
IL-78M: null
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
description: The Boeing KC-135 Stratotanker is a military aerial refueling aircraft
|
||||
that was developed from the Boeing 367-80 prototype, alongside the Boeing 707 airliner.
|
||||
description:
|
||||
The Boeing KC-135 Stratotanker is a military aerial refueling aircraft that
|
||||
was developed from the Boeing 367-80 prototype, alongside the Boeing 707
|
||||
airliner.
|
||||
introduced: 1957
|
||||
max_group_size: 1
|
||||
manufacturer: Beoing
|
||||
origin: USA
|
||||
price: 25
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
carrier_capable: true
|
||||
description: The Lockheed S-3 Viking is a 4-crew, twin-engine turbofan-powered jet
|
||||
description:
|
||||
The Lockheed S-3 Viking is a 4-crew, twin-engine turbofan-powered jet
|
||||
aircraft that was used by the U.S. Navy (USN) primarily for anti-submarine warfare.
|
||||
In the late 1990s, the S-3B's mission focus shifted to surface warfare and aerial
|
||||
refueling. The Viking also provided electronic warfare and surface surveillance
|
||||
@ -14,6 +15,7 @@ introduced: 1984
|
||||
manufacturer: Lockheed
|
||||
origin: USA
|
||||
price: 10
|
||||
max_group_size: 1
|
||||
role: Carrier-based Attack
|
||||
variants:
|
||||
S-3B Viking: {}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user