From aaaa9847b12b001a43398083d1cb3dba09b36e0b 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 | 2 +- 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/game/dcs/aircrafttype.py b/game/dcs/aircrafttype.py index 78fc8cf0..87d6866b 100644 --- a/game/dcs/aircrafttype.py +++ b/game/dcs/aircrafttype.py @@ -21,6 +21,7 @@ from game.radio.channels import ( CommonRadioChannelAllocator, FarmerRadioChannelAllocator, HueyChannelNamer, + LegacyWarthogChannelNamer, MirageChannelNamer, MirageF1CEChannelNamer, NoOpChannelAllocator, @@ -32,6 +33,7 @@ from game.radio.channels import ( ViggenChannelNamer, ViggenRadioChannelAllocator, ViperChannelNamer, + WarthogChannelNamer, ) from game.utils import ( Distance, @@ -106,6 +108,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 3b6600ce..7d85fef9 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 @@ -358,3 +358,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 1721bcc5..dfb5082d 100644 --- a/resources/units/aircraft/A-10C.yaml +++ b/resources/units/aircraft/A-10C.yaml @@ -19,6 +19,7 @@ radios: inter_flight: AN/ARC-164 channels: type: common + namer: a10c-legacy intra_flight_radio_index: 1 inter_flight_radio_index: 2 tasks: diff --git a/resources/units/aircraft/A-10C_2.yaml b/resources/units/aircraft/A-10C_2.yaml index 37ed57ba..0f3d785c 100644 --- a/resources/units/aircraft/A-10C_2.yaml +++ b/resources/units/aircraft/A-10C_2.yaml @@ -25,7 +25,7 @@ radios: inter_flight: AN/ARC-210 channels: type: common - # namer: a10c-ii + namer: a10c-ii intra_flight_radio_index: 2 inter_flight_radio_index: 1 tasks: