Move livery overrides to unit yaml.

This commit is contained in:
Dan Albert 2022-02-18 17:22:43 -08:00
parent c1cb32de21
commit 52ed6f3f94
5 changed files with 14 additions and 23 deletions

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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): {}
F-14A Tomcat (AI): {}

View File

@ -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
utc_kneeboard: true