mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Ignore loadouts with invalid weapons.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2320.
This commit is contained in:
parent
f1562a7b94
commit
469d8b7b12
@ -34,6 +34,7 @@ Saves from 5.x are not compatible with 6.0.
|
||||
* **[Mission Generation]** Fixed an issue where SEAD/DEAD/BAI flights fired all missiles / bombs against a single unit in a group instead of targeting the whole group.
|
||||
* **[Mission Generation]** Fixed adding additional mission types for a squadron causing error messages when the mission type is not supported by the aircraft type by default
|
||||
* **[Mission Generation]** AAA ground units now spawn correctly at the frontline
|
||||
* **[Modding]** Loadouts with invalid weapons (typically new DCS weapons not yet available in Liberation) will be ignored rather than causing an error.
|
||||
* **[UI]** Fixed and issue where the liberation main exe was still running after application close.
|
||||
* **[UI]** Disable player slots for non-flyable aircraft.
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import datetime
|
||||
import logging
|
||||
from collections.abc import Iterable
|
||||
from typing import Iterator, Mapping, Optional, TYPE_CHECKING, Type
|
||||
|
||||
@ -122,9 +123,19 @@ class Loadout:
|
||||
for payload in payloads.values():
|
||||
name = payload["name"]
|
||||
pylons = payload["pylons"]
|
||||
try:
|
||||
pylon_assignments = {
|
||||
p["num"]: Weapon.with_clsid(p["CLSID"]) for p in pylons.values()
|
||||
}
|
||||
except KeyError:
|
||||
logging.exception(
|
||||
"Ignoring %s loadout with invalid weapons: %s", aircraft.name, name
|
||||
)
|
||||
continue
|
||||
|
||||
yield Loadout(
|
||||
name,
|
||||
{p["num"]: Weapon.with_clsid(p["CLSID"]) for p in pylons.values()},
|
||||
pylon_assignments,
|
||||
date=None,
|
||||
)
|
||||
|
||||
@ -189,11 +200,16 @@ class Loadout:
|
||||
dcs_unit_type.load_payloads()
|
||||
payload = dcs_unit_type.loadout_by_name(name)
|
||||
if payload is not None:
|
||||
return Loadout(
|
||||
name,
|
||||
{i: Weapon.with_clsid(d["clsid"]) for i, d in payload},
|
||||
date=None,
|
||||
)
|
||||
try:
|
||||
pylons = {i: Weapon.with_clsid(d["clsid"]) for i, d in payload}
|
||||
except KeyError:
|
||||
logging.exception(
|
||||
"Ignoring %s loadout with invalid weapons: %s",
|
||||
dcs_unit_type.id,
|
||||
name,
|
||||
)
|
||||
continue
|
||||
return Loadout(name, pylons, date=None)
|
||||
|
||||
# TODO: Try group.load_task_default_loadout(loadout_for_task)
|
||||
return cls.empty_loadout()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user