Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stub new parameters in doctrines. These new parameters are not used a… #3454

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: ~
Loading