Make weapon groups explicit and moddable.

The only parts of the old weapon data that worked well (didn't commonly
result in empty pylons) did this implicitly, so make the grouping
explicit.

This also moves the data out of Python and into the resources, which
both makes the data moddable and isolates us from a huge amount of
effort and a save compat break whenever ED changes weapon names.

I didn't auto migrate the old data since the old groups were not
explict and there's no way to infer the grouping. Besides, since most of
the weapons were *not* grouped, the old data did more harm than good in
my experience. I've handled the AIM-120 and AIM-7 for now, but will get
at least all the fox 3 missiles before we ship.
This commit is contained in:
Dan Albert 2021-07-14 00:57:57 -07:00
parent 9177588220
commit 7648716199
15 changed files with 234 additions and 1107 deletions

View File

@ -4,6 +4,7 @@ Saves from 3.x are not compatible with 5.0.
## Features/Improvements
* **[Campaign]** Weapon data such as fallbacks and introduction years is now moddable. Due to the new architecture to support this, the old data was not automatically migrated.
* **[Campaign AI]** Overhauled campaign AI target prioritization. This currently only affects the ordering of DEAD missions.
* **[Campaign AI]** Player front line stances can now be automated. Improved stance selection for AI.

File diff suppressed because it is too large Load Diff

View File

@ -68,7 +68,7 @@ class Loadout:
pylons = payload["pylons"]
yield Loadout(
name,
{p["num"]: Weapon.from_clsid(p["CLSID"]) for p in pylons.values()},
{p["num"]: Weapon.with_clsid(p["CLSID"]) for p in pylons.values()},
date=None,
)
@ -132,7 +132,7 @@ class Loadout:
if payload is not None:
return Loadout(
name,
{i: Weapon.from_clsid(d["clsid"]) for i, d in payload},
{i: Weapon.with_clsid(d["clsid"]) for i, d in payload},
date=None,
)

View File

@ -11,14 +11,9 @@ from PySide2.QtCore import Qt
from PySide2.QtGui import QPixmap
from PySide2.QtWidgets import QApplication, QSplashScreen
from dcs.payloads import PayloadDirectories
from dcs.weapons_data import weapon_ids
from game import Game, VERSION, persistency
from game.data.weapons import (
WEAPON_FALLBACK_MAP,
WEAPON_INTRODUCTION_YEARS,
Weapon,
)
from game.data.weapons import WeaponGroup
from game.db import FACTIONS
from game.profiling import logged_duration
from game.settings import Settings
@ -239,12 +234,8 @@ def create_game(
def lint_weapon_data() -> None:
for clsid in weapon_ids:
weapon = Weapon.from_clsid(clsid)
if weapon not in WEAPON_INTRODUCTION_YEARS:
logging.warning(f"{weapon} has no introduction date")
if weapon not in WEAPON_FALLBACK_MAP:
logging.warning(f"{weapon} has no fallback")
for weapon in WeaponGroup.named("Unknown").weapons:
logging.warning(f"No weapon data for {weapon}: {weapon.clsid}")
def main():

View File

@ -56,7 +56,7 @@ class QPylonEditor(QComboBox):
#
# A similar hack exists in Pylon to support forcibly equipping this even when
# it's not known to be compatible.
if weapon.cls_id == "<CLEAN>":
if weapon.clsid == "<CLEAN>":
if not self.has_added_clean_item:
self.addItem("Clean", weapon)
self.has_added_clean_item = True

View File

@ -0,0 +1,5 @@
name: 2xAIM-120B
year: 1994
fallback: AIM-7MH
clsids:
- "LAU-115_2*LAU-127_AIM-120B"

View File

@ -0,0 +1,7 @@
name: AIM-120B
year: 1994
fallback: AIM-7MH
clsids:
- "{C8E06185-7CD6-4C90-959F-044679E90751}"
- "{LAU-115 - AIM-120B}"
- "{LAU-115 - AIM-120B_R}"

View File

@ -0,0 +1,5 @@
name: 2xAIM-120C
year: 1996
fallback: 2xAIM-120B
clsids:
- "LAU-115_2*LAU-127_AIM-120C"

View File

@ -0,0 +1,7 @@
name: AIM-120C
year: 1996
fallback: AIM-120B
clsids:
- "{40EF17B7-F508-45de-8566-6FFECC0C1AB8}"
- "{LAU-115 - AIM-120C}"
- "{LAU-115 - AIM-120C_R}"

View File

@ -0,0 +1,5 @@
name: AIM-7E
year: 1963
clsids:
- "{AIM-7E}"
- "{LAU-115 - AIM-7E}"

View File

@ -0,0 +1,8 @@
name: AIM-7F
year: 1976
fallback: AIM-7E
clsids:
- "{SHOULDER AIM-7F}"
- "{BELLY AIM-7F}"
- "{AIM-7F}"
- "{LAU-115 - AIM-7F}"

View File

@ -0,0 +1,8 @@
name: AIM-7M
year: 1982
fallback: AIM-7F
clsids:
- "{SHOULDER AIM-7M}"
- "{BELLY AIM-7M}"
- "{8D399DDA-FF81-4F14-904D-099B34FE7918}"
- "{LAU-115 - AIM-7M}"

View File

@ -0,0 +1,8 @@
name: AIM-7MH
year: 1987
fallback: AIM-7M
clsids:
- "{SHOULDER AIM-7MH}"
- "{BELLY AIM-7MH}"
- "{AIM-7H}"
- "{LAU-115 - AIM-7H}"

View File

@ -0,0 +1,4 @@
name: AN/ASQ-228 ATFLIR
year: 2003
clsids:
- "{AN_ASQ_228}"

View File

@ -0,0 +1,5 @@
name: AN/AAQ-28 LITENING
year: 1999
clsids:
- "{A111396E-D3E8-4b9c-8AC9-2432489304D5}"
- "{AAQ-28_LEFT}"