diff --git a/game/db.py b/game/db.py index 1f4ff2b4..f31fc9c6 100644 --- a/game/db.py +++ b/game/db.py @@ -11,8 +11,6 @@ from dcs.helicopters import ( # mypy can't resolve these if they're wildcard imports for some reason. from dcs.planes import ( B_17G, - FA_18C_hornet, - F_14A, F_16C_50, Ju_88A4, P_51D_30_NA, @@ -28,7 +26,7 @@ from dcs.ships import ( Stennis, ship_map, ) -from dcs.unittype import FlyingType, ShipType, UnitType, VehicleType +from dcs.unittype import ShipType, UnitType, VehicleType from dcs.vehicles import ( vehicle_map, ) @@ -68,19 +66,6 @@ country : DCS Country name """ FACTIONS = FactionLoader() -""" -Aircraft livery overrides. Syntax as follows: - - `Identifier`: "LiveryName", - -`Identifier` is aircraft identifier (as used troughout the file) and "LiveryName" (with double quotes) -is livery name as found in mission editor. -""" -PLANE_LIVERY_OVERRIDES: dict[Type[FlyingType], str] = { - FA_18C_hornet: "VFA-34", # default livery for the hornet is blue angels one - F_14A: "vf-142 `ghost riders`", # default livery for the AI F-14A is the black demo scheme -} - """ Possible time periods for new games diff --git a/game/dcs/aircrafttype.py b/game/dcs/aircrafttype.py index 4d42bb3e..092fb6e4 100644 --- a/game/dcs/aircrafttype.py +++ b/game/dcs/aircrafttype.py @@ -32,10 +32,10 @@ from game.radio.channels import ( ) from game.utils import ( Distance, - SPEED_OF_SOUND_AT_SEA_LEVEL, ImperialUnits, MetricUnits, NauticalUnits, + SPEED_OF_SOUND_AT_SEA_LEVEL, Speed, UnitSystem, feet, @@ -174,6 +174,8 @@ class AircraftType(UnitType[Type[FlyingType]]): fuel_consumption: Optional[FuelConsumption] + default_livery: Optional[str] + intra_flight_radio: Optional[Radio] channel_allocator: Optional[RadioChannelAllocator] channel_namer: Type[ChannelNamer] @@ -409,6 +411,7 @@ class AircraftType(UnitType[Type[FlyingType]]): patrol_speed=patrol_config.speed, max_mission_range=mission_range, fuel_consumption=fuel_consumption, + default_livery=data.get("default_livery"), intra_flight_radio=radio_config.intra_flight, channel_allocator=radio_config.channel_allocator, channel_namer=radio_config.channel_namer, diff --git a/game/missiongenerator/aircraft/aircraftpainter.py b/game/missiongenerator/aircraft/aircraftpainter.py index 476635ef..df45ccaf 100644 --- a/game/missiongenerator/aircraft/aircraftpainter.py +++ b/game/missiongenerator/aircraft/aircraftpainter.py @@ -5,7 +5,6 @@ from typing import Any, Optional from dcs.unitgroup import FlyingGroup -from game import db from game.ato import Flight @@ -14,8 +13,8 @@ class AircraftPainter: self.flight = flight self.group = group - def livery_from_db(self) -> Optional[str]: - return db.PLANE_LIVERY_OVERRIDES.get(self.flight.unit_type.dcs_unit_type) + def livery_from_unit_type(self) -> Optional[str]: + return self.flight.unit_type.default_livery def livery_from_faction(self) -> Optional[str]: faction = self.flight.squadron.coalition.faction @@ -33,7 +32,7 @@ class AircraftPainter: return livery if (livery := self.livery_from_faction()) is not None: return livery - if (livery := self.livery_from_db()) is not None: + if (livery := self.livery_from_unit_type()) is not None: return livery return None diff --git a/resources/units/aircraft/F-14A.yaml b/resources/units/aircraft/F-14A.yaml index c85d08bd..6d75221a 100644 --- a/resources/units/aircraft/F-14A.yaml +++ b/resources/units/aircraft/F-14A.yaml @@ -21,5 +21,7 @@ origin: USA price: 20 role: Carrier-based Air-Superiority Fighter/Fighter Bomber max_range: 350 +# DCS default livery for the AI F-14A is the black demo scheme. +default_livery: vf-142 `ghost riders` variants: - F-14A Tomcat (AI): {} \ No newline at end of file + F-14A Tomcat (AI): {} diff --git a/resources/units/aircraft/FA-18C_hornet.yaml b/resources/units/aircraft/FA-18C_hornet.yaml index e2af4f01..7aafd021 100644 --- a/resources/units/aircraft/FA-18C_hornet.yaml +++ b/resources/units/aircraft/FA-18C_hornet.yaml @@ -21,6 +21,8 @@ manufacturer: McDonnell Douglas origin: USA price: 24 role: Carrier-based Multirole Fighter +# DCS default livery for the Hornet is the Blue Angels. +default_livery: "VFA-34" fuel: # Parking A1 to RWY 32 at Akrotiri. taxi: 170 @@ -46,4 +48,4 @@ radios: # we must use radio 1 for the intra-flight radio. intra_flight_radio_index: 1 inter_flight_radio_index: 2 -utc_kneeboard: true \ No newline at end of file +utc_kneeboard: true