mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Weapons data migration (changing names)
This commit is contained in:
parent
80a7d7da2d
commit
bb629a7be2
@ -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)
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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}"
|
||||
|
||||
@ -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}"
|
||||
|
||||
@ -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}"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user