mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Add warning for missing weapon data.
These are disabled by default because it would otherwise warn about nearly every piece of equipment in the game currently.
This commit is contained in:
parent
746c99ebd6
commit
bc6b2e0f3e
@ -7,11 +7,18 @@ from pathlib import Path
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
import dcs
|
import dcs
|
||||||
|
from dcs.weapons_data import weapon_ids
|
||||||
|
|
||||||
from PySide2 import QtWidgets
|
from PySide2 import QtWidgets
|
||||||
from PySide2.QtGui import QPixmap
|
from PySide2.QtGui import QPixmap
|
||||||
from PySide2.QtWidgets import QApplication, QSplashScreen
|
from PySide2.QtWidgets import QApplication, QSplashScreen
|
||||||
|
|
||||||
from game import Game, db, persistency, VERSION
|
from game import Game, db, persistency, VERSION
|
||||||
|
from game.data.weapons import (
|
||||||
|
WEAPON_FALLBACK_MAP,
|
||||||
|
WEAPON_INTRODUCTION_YEARS,
|
||||||
|
Weapon,
|
||||||
|
)
|
||||||
from game.settings import Settings
|
from game.settings import Settings
|
||||||
from game.theater.start_generator import GameGenerator, GeneratorSettings
|
from game.theater.start_generator import GameGenerator, GeneratorSettings
|
||||||
from qt_ui import (
|
from qt_ui import (
|
||||||
@ -103,6 +110,11 @@ def parse_args() -> argparse.Namespace:
|
|||||||
raise argparse.ArgumentTypeError("path does not exist")
|
raise argparse.ArgumentTypeError("path does not exist")
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"--warn-missing-weapon-data", action="store_true",
|
||||||
|
help="Emits a warning for weapons without date or fallback information."
|
||||||
|
)
|
||||||
|
|
||||||
new_game = subparsers.add_parser("new-game")
|
new_game = subparsers.add_parser("new-game")
|
||||||
|
|
||||||
new_game.add_argument(
|
new_game.add_argument(
|
||||||
@ -163,6 +175,15 @@ def create_game(campaign_path: Path, blue: str, red: str,
|
|||||||
return generator.generate()
|
return generator.generate()
|
||||||
|
|
||||||
|
|
||||||
|
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")
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
logging_config.init_logging(VERSION)
|
logging_config.init_logging(VERSION)
|
||||||
|
|
||||||
@ -172,6 +193,11 @@ def main():
|
|||||||
game: Optional[Game] = None
|
game: Optional[Game] = None
|
||||||
|
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
|
|
||||||
|
# TODO: Flesh out data and then make unconditional.
|
||||||
|
if args.warn_missing_weapon_data:
|
||||||
|
lint_weapon_data()
|
||||||
|
|
||||||
if args.subcommand == "new-game":
|
if args.subcommand == "new-game":
|
||||||
game = create_game(args.campaign, args.blue, args.red,
|
game = create_game(args.campaign, args.blue, args.red,
|
||||||
args.supercarrier, args.auto_procurement,
|
args.supercarrier, args.auto_procurement,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user