mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Refactor use_countermeasures to faction (#3459)
This commit is contained in:
parent
fa41b00ef0
commit
e47e95f89f
@ -117,8 +117,6 @@ class Cap:
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Tactics:
|
||||
#: Aircraft use countermeasures (chaff, flares)
|
||||
use_countermeasures: bool
|
||||
|
||||
#: Air-to-air missile attack range options
|
||||
air_to_air_missile_attack_range: Optional[OptAAMissileAttackRange.Values]
|
||||
@ -129,7 +127,6 @@ class Tactics:
|
||||
@staticmethod
|
||||
def from_dict(data: dict[str, Any]) -> Tactics:
|
||||
return Tactics(
|
||||
use_countermeasures=data.get("use_countermeasures", True),
|
||||
air_to_air_missile_attack_range=None,
|
||||
air_defence_evades_anti_radiation_missiles=data.get(
|
||||
"air_defence_evades_anti_radiation_missiles", False
|
||||
|
||||
@ -123,6 +123,9 @@ class Faction:
|
||||
#: weapons groups to their introduction years.
|
||||
weapons_introduction_year_overrides: Dict[str, int] = field(default_factory=dict)
|
||||
|
||||
#: Set to True if the faction has access to countermeasures (chaff and flares).
|
||||
countermeasures_available: bool = True
|
||||
|
||||
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):
|
||||
@ -271,6 +274,8 @@ class Faction:
|
||||
"weapons_introduction_year_overrides", {}
|
||||
)
|
||||
|
||||
faction.countermeasures_available = json.get("countermeasures_available", True)
|
||||
|
||||
return faction
|
||||
|
||||
@property
|
||||
|
||||
@ -32,6 +32,5 @@ helicopter:
|
||||
rendezvous_altitude_ft_agl: 1500
|
||||
air_assault_nav_altitude_ft_agl: 1500
|
||||
tactics:
|
||||
use_countermeasures: true
|
||||
air_defence_evades_anti_radiation_missiles: false
|
||||
air_to_air_missile_attack_range: ~
|
||||
|
||||
@ -32,6 +32,5 @@ helicopter:
|
||||
rendezvous_altitude_ft_agl: 1500
|
||||
air_assault_nav_altitude_ft_agl: 1500
|
||||
tactics:
|
||||
use_countermeasures: true
|
||||
air_defence_evades_anti_radiation_missiles: false
|
||||
air_to_air_missile_attack_range: ~
|
||||
@ -31,6 +31,5 @@ helicopter:
|
||||
rendezvous_altitude_ft_agl: 1500
|
||||
air_assault_nav_altitude_ft_agl: 1500
|
||||
tactics:
|
||||
use_countermeasures: true
|
||||
air_defence_evades_anti_radiation_missiles: false
|
||||
air_to_air_missile_attack_range: ~
|
||||
Loading…
x
Reference in New Issue
Block a user