Allow per pilot loadouts and properties.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/3092.
This commit is contained in:
Dan Albert
2023-07-20 21:49:21 -07:00
committed by Raffson
parent 8e670e1a3c
commit 485229b92f
27 changed files with 475 additions and 115 deletions

View File

@@ -1,5 +1,6 @@
from __future__ import annotations
import copy
import datetime
import logging
from collections.abc import Iterable
@@ -35,6 +36,11 @@ class Loadout:
def derive_custom(self, name: str) -> Loadout:
return Loadout(name, self.pylons, self.date, is_custom=True)
def clone(self) -> Loadout:
return Loadout(
self.name, dict(self.pylons), copy.deepcopy(self.date), self.is_custom
)
def has_weapon_of_type(self, weapon_type: WeaponType) -> bool:
for weapon in self.pylons.values():
if weapon is not None and weapon.weapon_group.type is weapon_type: