diff --git a/game/data/weapons.py b/game/data/weapons.py index 5333a66e..b7aac82f 100644 --- a/game/data/weapons.py +++ b/game/data/weapons.py @@ -19,6 +19,18 @@ PydcsWeapon = Any PydcsWeaponAssignment = tuple[int, PydcsWeapon] +def weapons_migrator(name: str) -> str: + migration_map = { + "AGM-88C HARM - High Speed Anti-Radiation Missile": "AGM-88C HARM", + "Kh-25MPU (Updated AS-12 Kegler) - 320kg, ARM, IN & Pas Rdr": "Kh-25MPU", + "Kh-31P (AS-17 Krypton) - 600kg, ARM, IN & Pas Rdr": "Kh-31P", + "Kh-58U (AS-11 Kilter) - 640kg, ARM, IN & Pas Rdr": "Kh-58U", + } + while name in migration_map: + name = migration_map[name] + return name + + @dataclass(frozen=True) class Weapon: """Wrapper for DCS weapons.""" @@ -139,7 +151,7 @@ class WeaponGroup: def __setstate__(self, state: dict[str, Any]) -> None: # Update any existing models with new data on load. - updated = WeaponGroup.named(state["name"]) + updated = WeaponGroup.named(weapons_migrator(state["name"])) state.update(updated.__dict__) self.__dict__.update(state) diff --git a/resources/weapons/standoff/AGM-88C.yaml b/resources/weapons/standoff/AGM-88C.yaml index fa146c9d..b68eb7ed 100644 --- a/resources/weapons/standoff/AGM-88C.yaml +++ b/resources/weapons/standoff/AGM-88C.yaml @@ -1,4 +1,4 @@ -name: AGM-88C HARM - High Speed Anti-Radiation Missile +name: AGM-88C HARM type: ARM # https://www.af.mil/About-Us/Fact-Sheets/Display/Article/104574/agm-88-harm/ # 1984 is the date for the A variant but as we do not have that one we use it for C diff --git a/resources/weapons/standoff/Kh-25MPU.yaml b/resources/weapons/standoff/Kh-25MPU.yaml index ddc793f6..ca374d88 100644 --- a/resources/weapons/standoff/Kh-25MPU.yaml +++ b/resources/weapons/standoff/Kh-25MPU.yaml @@ -1,4 +1,4 @@ -name: Kh-25MPU (Updated AS-12 Kegler) - 320kg, ARM, IN & Pas Rdr +name: Kh-25MPU type: ARM clsids: - "{E86C5AA5-6D49-4F00-AD2E-79A62D6DDE26}" diff --git a/resources/weapons/standoff/Kh-31P.yaml b/resources/weapons/standoff/Kh-31P.yaml index bed31d68..60f4b92e 100644 --- a/resources/weapons/standoff/Kh-31P.yaml +++ b/resources/weapons/standoff/Kh-31P.yaml @@ -1,4 +1,4 @@ -name: Kh-31P (AS-17 Krypton) - 600kg, ARM, IN & Pas Rdr +name: Kh-31P type: ARM clsids: - "{D8F2C90B-887B-4B9E-9FE2-996BC9E9AF03}" diff --git a/resources/weapons/standoff/Kh-58U.yaml b/resources/weapons/standoff/Kh-58U.yaml index 722b5b56..0b4a516c 100644 --- a/resources/weapons/standoff/Kh-58U.yaml +++ b/resources/weapons/standoff/Kh-58U.yaml @@ -1,4 +1,4 @@ -name: Kh-58U (AS-11 Kilter) - 640kg, ARM, IN & Pas Rdr +name: Kh-58U type: ARM clsids: - "{FE382A68-8620-4AC0-BDF5-709BFE3977D7}"