mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
AI planning for anti shipping missions.
Same as for anti convoy, these are rarely planned due to ordering issue between mission planning and procurement. Fixes https://github.com/Khopa/dcs_liberation/issues/826
This commit is contained in:
parent
2d64acf299
commit
21c35b31d4
@ -39,7 +39,7 @@ from game.theater.theatergroundobject import (
|
||||
NavalGroundObject,
|
||||
VehicleGroupGroundObject,
|
||||
)
|
||||
from game.transfers import Convoy, MultiGroupTransport, TransferOrder
|
||||
from game.transfers import CargoShip, Convoy
|
||||
from game.utils import Distance, nautical_miles
|
||||
from gen import Conflict
|
||||
from gen.ato import Package
|
||||
@ -445,7 +445,7 @@ class ObjectiveFinder:
|
||||
airfields.append(control_point)
|
||||
return self._targets_by_range(airfields)
|
||||
|
||||
def convoys(self) -> Iterator[MultiGroupTransport]:
|
||||
def convoys(self) -> Iterator[Convoy]:
|
||||
for front_line in self.front_lines():
|
||||
if front_line.control_point_a.is_friendly(self.is_player):
|
||||
enemy_cp = front_line.control_point_a
|
||||
@ -454,6 +454,15 @@ class ObjectiveFinder:
|
||||
|
||||
yield from self.game.transfers.convoys.travelling_to(enemy_cp)
|
||||
|
||||
def cargo_ships(self) -> Iterator[CargoShip]:
|
||||
for front_line in self.front_lines():
|
||||
if front_line.control_point_a.is_friendly(self.is_player):
|
||||
enemy_cp = front_line.control_point_a
|
||||
else:
|
||||
enemy_cp = front_line.control_point_b
|
||||
|
||||
yield from self.game.transfers.cargo_ships.travelling_to(enemy_cp)
|
||||
|
||||
def friendly_control_points(self) -> Iterator[ControlPoint]:
|
||||
"""Iterates over all friendly control points."""
|
||||
return (
|
||||
@ -668,6 +677,21 @@ class CoalitionMissionPlanner:
|
||||
],
|
||||
)
|
||||
|
||||
for ship in self.objective_finder.cargo_ships():
|
||||
yield ProposedMission(
|
||||
ship,
|
||||
[
|
||||
ProposedFlight(FlightType.ANTISHIP, 2, self.MAX_ANTISHIP_RANGE),
|
||||
# TODO: Max escort range.
|
||||
ProposedFlight(
|
||||
FlightType.ESCORT, 2, self.MAX_BAI_RANGE, EscortType.AirToAir
|
||||
),
|
||||
ProposedFlight(
|
||||
FlightType.SEAD, 2, self.MAX_BAI_RANGE, EscortType.Sead
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
for group in self.objective_finder.threatening_ships():
|
||||
yield ProposedMission(
|
||||
group,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user