Skip to content

Commit

Permalink
Stub new parameters in doctrines. These new parameters are not used a… (
Browse files Browse the repository at this point in the history
#3454)

…t the moment but are intended for a future point release
  • Loading branch information
zhexu14 authored Nov 6, 2024
1 parent 562d9cb commit 9ab5d0e
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
30 changes: 28 additions & 2 deletions game/data/doctrine.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

from pathlib import Path
import yaml
from typing import Any, ClassVar
from typing import Any, ClassVar, Optional

from dataclasses import dataclass
from datetime import timedelta

from dcs.task import OptAAMissileAttackRange
from game.data.units import UnitClass
from game.utils import Distance, feet, nautical_miles

Expand Down Expand Up @@ -115,6 +115,28 @@ def from_dict(data: dict[str, Any]) -> 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]

#: Air defence units evade ARMs
air_defence_evades_anti_radiation_missiles: bool

@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
),
)


@dataclass(frozen=True)
class Doctrine:
#: Name of the doctrine, used to assign a doctrine in a faction.
Expand Down Expand Up @@ -159,6 +181,9 @@ class Doctrine:
#: Doctrine for Fighter Sweep missions.
sweep: Sweep

#: Tactics options
tactics: Tactics

_by_name: ClassVar[dict[str, Doctrine]] = {}
_loaded: ClassVar[bool] = False

Expand Down Expand Up @@ -219,6 +244,7 @@ def load_all(cls) -> None:
cas=Cas.from_dict(data["cas"]),
cap=Cap.from_dict(data["cap"]),
sweep=Sweep.from_dict(data["sweep"]),
tactics=Tactics.from_dict(data.get("tactics", {})),
)
)
cls._loaded = True
5 changes: 4 additions & 1 deletion resources/doctrines/coldwar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@ helicopter:
combat_altitude_ft_agl: 200
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: ~
4 changes: 4 additions & 0 deletions resources/doctrines/modern.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ helicopter:
combat_altitude_ft_agl: 200
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: ~
4 changes: 4 additions & 0 deletions resources/doctrines/ww2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ helicopter:
combat_altitude_ft_agl: 200
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: ~

0 comments on commit 9ab5d0e

Please sign in to comment.