mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Improvement for factions and templates which will allow decoupling of the templates from the actual units - Implement UnitGroup class which matches unit_types and possible templates as the needed abstraction layer for decoupling. - Refactor UnitType, Add ShipUnitType and all ships we currently use - Remove serialized template.json and migrated to multiple yaml templates (one for each template) and multiple .miz - Reorganized a lot of templates and started with generalization of many types (AAA, Flak, SHORAD, Navy) - Fixed a lot of bugs from the previous reworks (group name generation, strike targets...) - Reorganized the faction file completly. removed redundant lists, added presets for complex groups / families of units like sams - Reworked the building template handling. Some templates are unused like "village" - Reworked how groups from templates can be merged again for the dcs group creation (e.g. the skynet plugin requires them to be in the same group) - Allow to define alternative tasks
190 lines
5.6 KiB
Python
190 lines
5.6 KiB
Python
from dataclasses import dataclass
|
|
from datetime import timedelta
|
|
|
|
from game.data.units import UnitClass
|
|
from game.utils import Distance, feet, nautical_miles
|
|
|
|
|
|
@dataclass
|
|
class GroundUnitProcurementRatios:
|
|
ratios: dict[UnitClass, float]
|
|
|
|
def for_unit_class(self, unit_class: UnitClass) -> float:
|
|
try:
|
|
return self.ratios[unit_class] / sum(self.ratios.values())
|
|
except KeyError:
|
|
return 0.0
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class Doctrine:
|
|
cas: bool
|
|
cap: bool
|
|
sead: bool
|
|
strike: bool
|
|
antiship: bool
|
|
|
|
rendezvous_altitude: Distance
|
|
|
|
#: The minimum distance between the departure airfield and the hold point.
|
|
hold_distance: Distance
|
|
|
|
#: The minimum distance between the hold point and the join point.
|
|
push_distance: Distance
|
|
|
|
#: The distance between the join point and the ingress point. Only used for the
|
|
#: fallback flight plan layout (when the departure airfield is near a threat zone).
|
|
join_distance: Distance
|
|
|
|
#: The maximum distance between the ingress point (beginning of the attack) and
|
|
#: target.
|
|
max_ingress_distance: Distance
|
|
|
|
#: The minimum distance between the ingress point (beginning of the attack) and
|
|
#: target.
|
|
min_ingress_distance: Distance
|
|
|
|
ingress_altitude: Distance
|
|
|
|
min_patrol_altitude: Distance
|
|
max_patrol_altitude: Distance
|
|
pattern_altitude: Distance
|
|
|
|
#: The duration that CAP flights will remain on-station.
|
|
cap_duration: timedelta
|
|
|
|
#: The minimum length of the CAP race track.
|
|
cap_min_track_length: Distance
|
|
|
|
#: The maximum length of the CAP race track.
|
|
cap_max_track_length: Distance
|
|
|
|
#: The minimum distance between the defended position and the *end* of the
|
|
#: CAP race track.
|
|
cap_min_distance_from_cp: Distance
|
|
|
|
#: The maximum distance between the defended position and the *end* of the
|
|
#: CAP race track.
|
|
cap_max_distance_from_cp: Distance
|
|
|
|
#: The engagement range of CAP flights. Any enemy aircraft within this range
|
|
#: of the CAP's current position will be engaged by the CAP.
|
|
cap_engagement_range: Distance
|
|
|
|
cas_duration: timedelta
|
|
|
|
sweep_distance: Distance
|
|
|
|
ground_unit_procurement_ratios: GroundUnitProcurementRatios
|
|
|
|
|
|
MODERN_DOCTRINE = Doctrine(
|
|
cap=True,
|
|
cas=True,
|
|
sead=True,
|
|
strike=True,
|
|
antiship=True,
|
|
rendezvous_altitude=feet(25000),
|
|
hold_distance=nautical_miles(25),
|
|
push_distance=nautical_miles(20),
|
|
join_distance=nautical_miles(20),
|
|
max_ingress_distance=nautical_miles(45),
|
|
min_ingress_distance=nautical_miles(10),
|
|
ingress_altitude=feet(20000),
|
|
min_patrol_altitude=feet(15000),
|
|
max_patrol_altitude=feet(33000),
|
|
pattern_altitude=feet(5000),
|
|
cap_duration=timedelta(minutes=30),
|
|
cap_min_track_length=nautical_miles(15),
|
|
cap_max_track_length=nautical_miles(40),
|
|
cap_min_distance_from_cp=nautical_miles(10),
|
|
cap_max_distance_from_cp=nautical_miles(40),
|
|
cap_engagement_range=nautical_miles(50),
|
|
cas_duration=timedelta(minutes=30),
|
|
sweep_distance=nautical_miles(60),
|
|
ground_unit_procurement_ratios=GroundUnitProcurementRatios(
|
|
{
|
|
UnitClass.Tank: 3,
|
|
UnitClass.Atgm: 2,
|
|
UnitClass.Apc: 2,
|
|
UnitClass.Ifv: 3,
|
|
UnitClass.Artillery: 1,
|
|
UnitClass.SHORAD: 2,
|
|
UnitClass.Recon: 1,
|
|
}
|
|
),
|
|
)
|
|
|
|
COLDWAR_DOCTRINE = Doctrine(
|
|
cap=True,
|
|
cas=True,
|
|
sead=True,
|
|
strike=True,
|
|
antiship=True,
|
|
rendezvous_altitude=feet(22000),
|
|
hold_distance=nautical_miles(15),
|
|
push_distance=nautical_miles(10),
|
|
join_distance=nautical_miles(10),
|
|
max_ingress_distance=nautical_miles(30),
|
|
min_ingress_distance=nautical_miles(10),
|
|
ingress_altitude=feet(18000),
|
|
min_patrol_altitude=feet(10000),
|
|
max_patrol_altitude=feet(24000),
|
|
pattern_altitude=feet(5000),
|
|
cap_duration=timedelta(minutes=30),
|
|
cap_min_track_length=nautical_miles(12),
|
|
cap_max_track_length=nautical_miles(24),
|
|
cap_min_distance_from_cp=nautical_miles(8),
|
|
cap_max_distance_from_cp=nautical_miles(25),
|
|
cap_engagement_range=nautical_miles(35),
|
|
cas_duration=timedelta(minutes=30),
|
|
sweep_distance=nautical_miles(40),
|
|
ground_unit_procurement_ratios=GroundUnitProcurementRatios(
|
|
{
|
|
UnitClass.Tank: 4,
|
|
UnitClass.Atgm: 2,
|
|
UnitClass.Apc: 3,
|
|
UnitClass.Ifv: 2,
|
|
UnitClass.Artillery: 1,
|
|
UnitClass.SHORAD: 2,
|
|
UnitClass.Recon: 1,
|
|
}
|
|
),
|
|
)
|
|
|
|
WWII_DOCTRINE = Doctrine(
|
|
cap=True,
|
|
cas=True,
|
|
sead=False,
|
|
strike=True,
|
|
antiship=True,
|
|
hold_distance=nautical_miles(10),
|
|
push_distance=nautical_miles(5),
|
|
join_distance=nautical_miles(5),
|
|
rendezvous_altitude=feet(10000),
|
|
max_ingress_distance=nautical_miles(7),
|
|
min_ingress_distance=nautical_miles(5),
|
|
ingress_altitude=feet(8000),
|
|
min_patrol_altitude=feet(4000),
|
|
max_patrol_altitude=feet(15000),
|
|
pattern_altitude=feet(5000),
|
|
cap_duration=timedelta(minutes=30),
|
|
cap_min_track_length=nautical_miles(8),
|
|
cap_max_track_length=nautical_miles(18),
|
|
cap_min_distance_from_cp=nautical_miles(0),
|
|
cap_max_distance_from_cp=nautical_miles(5),
|
|
cap_engagement_range=nautical_miles(20),
|
|
cas_duration=timedelta(minutes=30),
|
|
sweep_distance=nautical_miles(10),
|
|
ground_unit_procurement_ratios=GroundUnitProcurementRatios(
|
|
{
|
|
UnitClass.Tank: 3,
|
|
UnitClass.Atgm: 3,
|
|
UnitClass.Apc: 3,
|
|
UnitClass.Artillery: 1,
|
|
UnitClass.SHORAD: 3,
|
|
UnitClass.Recon: 1,
|
|
}
|
|
),
|
|
)
|