mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Generate anti-ship missions with group attack.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/3068.
This commit is contained in:
parent
82daa631bf
commit
9a59db1ed8
@ -10,6 +10,7 @@ Saves from 8.x are not compatible with 9.0.0.
|
||||
## Fixes
|
||||
|
||||
* **[Data]** Fixed the class of the Samuel Chase so it can't be picked for a AAA or SHORAD site.
|
||||
* **[Mission Generation]** Restored previous AI behavior for anti-ship missions. A DCS update caused only a single aircraft in a flight to attack. The full flight will now attack like they used to.
|
||||
|
||||
# 8.1.0
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ class Builder(FormationAttackBuilder[AntiShipFlightPlan, FormationAttackLayout])
|
||||
else:
|
||||
raise InvalidObjectiveLocation(self.flight.flight_type, location)
|
||||
|
||||
return self._build(FlightWaypointType.INGRESS_BAI, targets)
|
||||
return self._build(FlightWaypointType.INGRESS_ANTI_SHIP, targets)
|
||||
|
||||
@staticmethod
|
||||
def anti_ship_targets_for_tgo(tgo: NavalGroundObject) -> list[StrikeTarget]:
|
||||
|
||||
@ -50,3 +50,4 @@ class FlightWaypointType(IntEnum):
|
||||
CARGO_STOP = 30 # Stopover landing point using the LandingReFuAr waypoint type
|
||||
INGRESS_AIR_ASSAULT = 31
|
||||
RECOVERY_TANKER = 32
|
||||
INGRESS_ANTI_SHIP = 33
|
||||
|
||||
45
game/missiongenerator/aircraft/waypoints/antishipingress.py
Normal file
45
game/missiongenerator/aircraft/waypoints/antishipingress.py
Normal file
@ -0,0 +1,45 @@
|
||||
import logging
|
||||
|
||||
from dcs.point import MovingPoint
|
||||
from dcs.task import AttackGroup, OptFormation, WeaponType
|
||||
|
||||
from game.theater import NavalControlPoint, TheaterGroundObject
|
||||
from game.transfers import MultiGroupTransport
|
||||
from .pydcswaypointbuilder import PydcsWaypointBuilder
|
||||
|
||||
|
||||
class AntiShipIngressBuilder(PydcsWaypointBuilder):
|
||||
def add_tasks(self, waypoint: MovingPoint) -> None:
|
||||
# TODO: Add common "UnitGroupTarget" base type.
|
||||
group_names = []
|
||||
target = self.package.target
|
||||
if isinstance(target, TheaterGroundObject):
|
||||
for group in target.groups:
|
||||
group_names.append(group.group_name)
|
||||
elif isinstance(target, MultiGroupTransport):
|
||||
group_names.append(target.name)
|
||||
elif isinstance(target, NavalControlPoint):
|
||||
carrier_name = target.get_carrier_group_name()
|
||||
if carrier_name:
|
||||
group_names.append(carrier_name)
|
||||
else:
|
||||
logging.error(
|
||||
"Unexpected target type for anti-ship mission: %s",
|
||||
target.__class__.__name__,
|
||||
)
|
||||
return
|
||||
|
||||
for group_name in group_names:
|
||||
miz_group = self.mission.find_group(group_name)
|
||||
if miz_group is None:
|
||||
logging.error(
|
||||
"Could not find group for anti-ship mission %s", group_name
|
||||
)
|
||||
continue
|
||||
|
||||
task = AttackGroup(
|
||||
miz_group.id, weapon_type=WeaponType.Auto, group_attack=True
|
||||
)
|
||||
waypoint.tasks.append(task)
|
||||
|
||||
waypoint.tasks.append(OptFormation.trail_open())
|
||||
@ -24,6 +24,7 @@ from game.missiongenerator.missiondata import MissionData
|
||||
from game.settings import Settings
|
||||
from game.unitmap import UnitMap
|
||||
from game.utils import pairwise
|
||||
from .antishipingress import AntiShipIngressBuilder
|
||||
from .baiingress import BaiIngressBuilder
|
||||
from .casingress import CasIngressBuilder
|
||||
from .deadingress import DeadIngressBuilder
|
||||
@ -127,6 +128,7 @@ class WaypointGenerator:
|
||||
self, waypoint: FlightWaypoint, generated_waypoint_index: int
|
||||
) -> PydcsWaypointBuilder:
|
||||
builders = {
|
||||
FlightWaypointType.INGRESS_ANTI_SHIP: AntiShipIngressBuilder,
|
||||
FlightWaypointType.INGRESS_BAI: BaiIngressBuilder,
|
||||
FlightWaypointType.INGRESS_CAS: CasIngressBuilder,
|
||||
FlightWaypointType.INGRESS_DEAD: DeadIngressBuilder,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user