Issue 3204 (#3458)

This issue addresses Issue #3204 by allowing factions to set a different
weapon introduction date.
This commit is contained in:
zhexu14
2024-11-09 23:43:01 +11:00
committed by GitHub
parent c29c61ade3
commit fa41b00ef0
12 changed files with 70 additions and 14 deletions

View File

@@ -3,6 +3,7 @@ from __future__ import annotations
import itertools
import logging
from dataclasses import dataclass, field
import datetime
from functools import cached_property
from typing import Any, Dict, Iterator, List, Optional, TYPE_CHECKING, Type
@@ -118,6 +119,10 @@ class Faction:
#: both will use it.
unrestricted_satnav: bool = False
#: Overrides default weapons introduction years for faction. Maps names of
#: weapons groups to their introduction years.
weapons_introduction_year_overrides: Dict[str, int] = field(default_factory=dict)
def has_access_to_dcs_type(self, unit_type: Type[DcsUnitType]) -> bool:
# Vehicle and Ship Units
if any(unit_type == u.dcs_unit_type for u in self.accessible_units):
@@ -262,6 +267,10 @@ class Faction:
faction.unrestricted_satnav = json.get("unrestricted_satnav", False)
faction.weapons_introduction_year_overrides = json.get(
"weapons_introduction_year_overrides", {}
)
return faction
@property