mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Add AEW&C aircraft to the faction aircraft list.
To avoid confusion, use only the aircraft list for the purchasable aircraft. This fix also caught a faction's Tu-142 that was not actually purchasable. Invalid aircraft in the faction aircraft list will now raise an error. Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1074
This commit is contained in:
parent
99dc91dcb4
commit
eec56256e8
@ -117,6 +117,7 @@ from dcs.planes import (
|
||||
Yak_40,
|
||||
plane_map,
|
||||
I_16,
|
||||
Tu_142,
|
||||
)
|
||||
from dcs.ships import (
|
||||
Boat_Armed_Hi_speed,
|
||||
@ -456,6 +457,7 @@ PRICES = {
|
||||
Tu_160: 50,
|
||||
Tu_22M3: 40,
|
||||
Tu_95MS: 35,
|
||||
Tu_142: 35,
|
||||
# special
|
||||
IL_76MD: 30,
|
||||
An_26B: 25,
|
||||
|
||||
@ -154,6 +154,8 @@ class Faction:
|
||||
faction.awacs = load_all_aircraft(json.get("awacs", []))
|
||||
faction.tankers = load_all_aircraft(json.get("tankers", []))
|
||||
|
||||
faction.aircrafts = list(set(faction.aircrafts + faction.awacs))
|
||||
|
||||
faction.frontline_units = load_all_vehicles(json.get("frontline_units", []))
|
||||
faction.artillery_units = load_all_vehicles(json.get("artillery_units", []))
|
||||
faction.infantry_units = load_all_vehicles(json.get("infantry_units", []))
|
||||
|
||||
@ -52,23 +52,19 @@ class QAircraftRecruitmentMenu(QFrame, QRecruitBehaviour):
|
||||
row = 0
|
||||
|
||||
unit_types: Set[Type[FlyingType]] = set()
|
||||
for task in tasks:
|
||||
units = db.find_unittype(task, self.game_model.game.player_name)
|
||||
if not units:
|
||||
for unit_type in self.game_model.game.player_faction.aircrafts:
|
||||
if not issubclass(unit_type, FlyingType):
|
||||
raise RuntimeError(f"Non-flying aircraft found in faction: {unit_type}")
|
||||
if self.cp.is_carrier and unit_type not in db.CARRIER_CAPABLE:
|
||||
continue
|
||||
for unit in units:
|
||||
if not issubclass(unit, FlyingType):
|
||||
continue
|
||||
if self.cp.is_carrier and unit not in db.CARRIER_CAPABLE:
|
||||
continue
|
||||
if self.cp.is_lha and unit not in db.LHA_CAPABLE:
|
||||
continue
|
||||
if (
|
||||
self.cp.cptype in [ControlPointType.FOB, ControlPointType.FARP]
|
||||
and unit not in helicopter_map.values()
|
||||
):
|
||||
continue
|
||||
unit_types.add(unit)
|
||||
if self.cp.is_lha and unit_type not in db.LHA_CAPABLE:
|
||||
continue
|
||||
if (
|
||||
self.cp.cptype in [ControlPointType.FOB, ControlPointType.FARP]
|
||||
and unit_type not in helicopter_map.values()
|
||||
):
|
||||
continue
|
||||
unit_types.add(unit_type)
|
||||
|
||||
sorted_units = sorted(
|
||||
unit_types,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user