mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Decoupling and generalization of templates
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
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
from dataclasses import dataclass
|
||||
from datetime import timedelta
|
||||
|
||||
from game.data.groundunitclass import GroundUnitClass
|
||||
from game.data.units import UnitClass
|
||||
from game.utils import Distance, feet, nautical_miles
|
||||
|
||||
|
||||
@dataclass
|
||||
class GroundUnitProcurementRatios:
|
||||
ratios: dict[GroundUnitClass, float]
|
||||
ratios: dict[UnitClass, float]
|
||||
|
||||
def for_unit_class(self, unit_class: GroundUnitClass) -> float:
|
||||
def for_unit_class(self, unit_class: UnitClass) -> float:
|
||||
try:
|
||||
return self.ratios[unit_class] / sum(self.ratios.values())
|
||||
except KeyError:
|
||||
@@ -104,13 +104,13 @@ MODERN_DOCTRINE = Doctrine(
|
||||
sweep_distance=nautical_miles(60),
|
||||
ground_unit_procurement_ratios=GroundUnitProcurementRatios(
|
||||
{
|
||||
GroundUnitClass.Tank: 3,
|
||||
GroundUnitClass.Atgm: 2,
|
||||
GroundUnitClass.Apc: 2,
|
||||
GroundUnitClass.Ifv: 3,
|
||||
GroundUnitClass.Artillery: 1,
|
||||
GroundUnitClass.Shorads: 2,
|
||||
GroundUnitClass.Recon: 1,
|
||||
UnitClass.Tank: 3,
|
||||
UnitClass.Atgm: 2,
|
||||
UnitClass.Apc: 2,
|
||||
UnitClass.Ifv: 3,
|
||||
UnitClass.Artillery: 1,
|
||||
UnitClass.SHORAD: 2,
|
||||
UnitClass.Recon: 1,
|
||||
}
|
||||
),
|
||||
)
|
||||
@@ -141,13 +141,13 @@ COLDWAR_DOCTRINE = Doctrine(
|
||||
sweep_distance=nautical_miles(40),
|
||||
ground_unit_procurement_ratios=GroundUnitProcurementRatios(
|
||||
{
|
||||
GroundUnitClass.Tank: 4,
|
||||
GroundUnitClass.Atgm: 2,
|
||||
GroundUnitClass.Apc: 3,
|
||||
GroundUnitClass.Ifv: 2,
|
||||
GroundUnitClass.Artillery: 1,
|
||||
GroundUnitClass.Shorads: 2,
|
||||
GroundUnitClass.Recon: 1,
|
||||
UnitClass.Tank: 4,
|
||||
UnitClass.Atgm: 2,
|
||||
UnitClass.Apc: 3,
|
||||
UnitClass.Ifv: 2,
|
||||
UnitClass.Artillery: 1,
|
||||
UnitClass.SHORAD: 2,
|
||||
UnitClass.Recon: 1,
|
||||
}
|
||||
),
|
||||
)
|
||||
@@ -178,12 +178,12 @@ WWII_DOCTRINE = Doctrine(
|
||||
sweep_distance=nautical_miles(10),
|
||||
ground_unit_procurement_ratios=GroundUnitProcurementRatios(
|
||||
{
|
||||
GroundUnitClass.Tank: 3,
|
||||
GroundUnitClass.Atgm: 3,
|
||||
GroundUnitClass.Apc: 3,
|
||||
GroundUnitClass.Artillery: 1,
|
||||
GroundUnitClass.Shorads: 3,
|
||||
GroundUnitClass.Recon: 1,
|
||||
UnitClass.Tank: 3,
|
||||
UnitClass.Atgm: 3,
|
||||
UnitClass.Apc: 3,
|
||||
UnitClass.Artillery: 1,
|
||||
UnitClass.SHORAD: 3,
|
||||
UnitClass.Recon: 1,
|
||||
}
|
||||
),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user