From 2d9b0177ec4298f1cc44e315ac3eac8cad79478b Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Mon, 13 Mar 2023 18:35:56 -0700 Subject: [PATCH] Add channel naming for the warthogs. The manual for the legacy warthog usually calls these VHF 1/2 and UHF, or VHF AM/FM and UHF. The AM/FM nomenclature is what I usually hear people call them and it's clearer, so go with that. For the A-10C II, that manual hasn't been updated for the AN/ARC-210 yet, so I'm not really sure what that ought to be called. The UFC calls it COM 1 though, so I went with that. The alternative would be something like VHF/UHF for the 210 and UHF for the 164, but I don't know if that's actually better. Could be completely explicit and call them by their full names, but that's probably less clear to people that aren't fiddling with the radio implementation constantly (and even I confuse the 164 and the 186 all the damn time). --- game/dcs/aircrafttype.py | 4 +++ game/radio/channels.py | 36 ++++++++++++++++++++++++++- resources/units/aircraft/A-10C.yaml | 1 + resources/units/aircraft/A-10C_2.yaml | 1 + 4 files changed, 41 insertions(+), 1 deletion(-) diff --git a/game/dcs/aircrafttype.py b/game/dcs/aircrafttype.py index 085bc676..8c2764b4 100644 --- a/game/dcs/aircrafttype.py +++ b/game/dcs/aircrafttype.py @@ -20,6 +20,7 @@ from game.radio.channels import ( CommonRadioChannelAllocator, FarmerRadioChannelAllocator, HueyChannelNamer, + LegacyWarthogChannelNamer, MirageChannelNamer, MirageF1CEChannelNamer, NoOpChannelAllocator, @@ -31,6 +32,7 @@ from game.radio.channels import ( ViggenChannelNamer, ViggenRadioChannelAllocator, ViperChannelNamer, + WarthogChannelNamer, ) from game.utils import ( Distance, @@ -104,6 +106,8 @@ class RadioConfig: "viggen": ViggenChannelNamer, "viper": ViperChannelNamer, "apache": ApacheChannelNamer, + "a10c-legacy": LegacyWarthogChannelNamer, + "a10c-ii": WarthogChannelNamer, }[config.get("namer", "default")] diff --git a/game/radio/channels.py b/game/radio/channels.py index 8f18a14d..e859a5a8 100644 --- a/game/radio/channels.py +++ b/game/radio/channels.py @@ -1,7 +1,7 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Optional, Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING if TYPE_CHECKING: from game.missiongenerator.aircraft.flightdata import FlightData @@ -355,3 +355,37 @@ class SCR522ChannelNamer(ChannelNamer): @classmethod def name(cls) -> str: return "SCR-522" + + +class LegacyWarthogChannelNamer(ChannelNamer): + """Channel namer for the legacy A-10C.""" + + @staticmethod + def channel_name(radio_id: int, channel_id: int) -> str: + radio_name = { + 1: "VHF AM", + 2: "UHF", + 3: "VHF FM", + }[radio_id] + return f"{radio_name} Ch {channel_id}" + + @classmethod + def name(cls) -> str: + return "a10c-legacy" + + +class WarthogChannelNamer(ChannelNamer): + """Channel namer for the legacy A-10C II""" + + @staticmethod + def channel_name(radio_id: int, channel_id: int) -> str: + radio_name = { + 1: "COM 1", + 2: "UHF", + 3: "VHF FM", + }[radio_id] + return f"{radio_name} Ch {channel_id}" + + @classmethod + def name(cls) -> str: + return "a10c-ii" diff --git a/resources/units/aircraft/A-10C.yaml b/resources/units/aircraft/A-10C.yaml index 5c7c27bb..4a292fd7 100644 --- a/resources/units/aircraft/A-10C.yaml +++ b/resources/units/aircraft/A-10C.yaml @@ -21,5 +21,6 @@ radios: inter_flight: AN/ARC-164 channels: type: common + namer: a10c-legacy intra_flight_radio_index: 2 inter_flight_radio_index: 2 diff --git a/resources/units/aircraft/A-10C_2.yaml b/resources/units/aircraft/A-10C_2.yaml index e4441939..95ec9352 100644 --- a/resources/units/aircraft/A-10C_2.yaml +++ b/resources/units/aircraft/A-10C_2.yaml @@ -25,5 +25,6 @@ radios: inter_flight: AN/ARC-210 channels: type: common + namer: a10c-ii intra_flight_radio_index: 2 inter_flight_radio_index: 1