mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Add preset configuration for offshore types.
This commit is contained in:
parent
ff751c30f9
commit
5fb6a53cbd
@ -16,7 +16,11 @@ from dcs.countries import (
|
||||
)
|
||||
from dcs.country import Country
|
||||
from dcs.mapping import Point
|
||||
from dcs.ships import CVN_74_John_C__Stennis, LHA_1_Tarawa
|
||||
from dcs.ships import (
|
||||
CVN_74_John_C__Stennis,
|
||||
LHA_1_Tarawa,
|
||||
USS_Arleigh_Burke_IIa,
|
||||
)
|
||||
from dcs.statics import Fortification
|
||||
from dcs.terrain import (
|
||||
caucasus,
|
||||
@ -98,6 +102,8 @@ class MizCampaignLoader:
|
||||
SAM_UNIT_TYPE = AirDefence.SAM_SA_10_S_300PS_SR_64H6E.id
|
||||
GARRISON_UNIT_TYPE = AirDefence.SAM_SA_19_Tunguska_2S6.id
|
||||
STRIKE_TARGET_UNIT_TYPE = Fortification.Workshop_A.id
|
||||
OFFSHORE_STRIKE_TARGET_UNIT_TYPE = Fortification.Oil_platform.id
|
||||
SHIP_UNIT_TYPE = USS_Arleigh_Burke_IIa.id
|
||||
|
||||
BASE_DEFENSE_RADIUS = nm_to_meter(2)
|
||||
|
||||
@ -165,6 +171,12 @@ class MizCampaignLoader:
|
||||
if group.units[0].type == self.LHA_UNIT_TYPE:
|
||||
yield group
|
||||
|
||||
@property
|
||||
def ships(self) -> Iterator[ShipGroup]:
|
||||
for group in self.blue.ship_group:
|
||||
if group.units[0].type == self.SHIP_UNIT_TYPE:
|
||||
yield group
|
||||
|
||||
@property
|
||||
def ewrs(self) -> Iterator[VehicleGroup]:
|
||||
for group in self.blue.vehicle_group:
|
||||
@ -189,6 +201,12 @@ class MizCampaignLoader:
|
||||
if group.units[0].type == self.STRIKE_TARGET_UNIT_TYPE:
|
||||
yield group
|
||||
|
||||
@property
|
||||
def offshore_strike_targets(self) -> Iterator[StaticGroup]:
|
||||
for group in self.blue.static_group:
|
||||
if group.units[0].type == self.OFFSHORE_STRIKE_TARGET_UNIT_TYPE:
|
||||
yield group
|
||||
|
||||
@cached_property
|
||||
def control_points(self) -> Dict[int, ControlPoint]:
|
||||
control_points = {}
|
||||
@ -279,6 +297,15 @@ class MizCampaignLoader:
|
||||
closest, distance = self.objective_info(group)
|
||||
closest.preset_locations.strike_locations.append(group.position)
|
||||
|
||||
for group in self.offshore_strike_targets:
|
||||
closest, distance = self.objective_info(group)
|
||||
closest.preset_locations.offshore_strike_locations.append(
|
||||
group.position)
|
||||
|
||||
for group in self.ships:
|
||||
closest, distance = self.objective_info(group)
|
||||
closest.preset_locations.ships.append(group.position)
|
||||
|
||||
def populate_theater(self) -> None:
|
||||
for control_point in self.control_points.values():
|
||||
self.theater.add_controlpoint(control_point)
|
||||
|
||||
@ -59,9 +59,10 @@ class PresetLocations:
|
||||
|
||||
ewrs: List[Point] = field(default_factory=list)
|
||||
sams: List[Point] = field(default_factory=list)
|
||||
offshore: List[Point] = field(default_factory=list)
|
||||
ships: List[Point] = field(default_factory=list)
|
||||
coastal_defenses: List[Point] = field(default_factory=list)
|
||||
strike_locations: List[Point] = field(default_factory=list)
|
||||
offshore_strike_locations: List[Point] = field(default_factory=list)
|
||||
|
||||
fixed_sams: List[Point] = field(default_factory=list)
|
||||
|
||||
@ -85,9 +86,9 @@ class PresetLocations:
|
||||
if location_type == LocationType.Shorad:
|
||||
return self._random_from(self.base_garrisons)
|
||||
if location_type == LocationType.OffshoreStrikeTarget:
|
||||
return self._random_from(self.offshore)
|
||||
return self._random_from(self.offshore_strike_locations)
|
||||
if location_type == LocationType.Ship:
|
||||
return self._random_from(self.offshore)
|
||||
return self._random_from(self.ships)
|
||||
if location_type == LocationType.StrikeTarget:
|
||||
return self._random_from(self.strike_locations)
|
||||
logging.error(f"Unknown location type: {location_type}")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user