mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Split Anti-Ship from BAI
This commit is contained in:
parent
2ed85792b9
commit
bbf8e69659
@ -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]:
|
||||
|
||||
@ -49,3 +49,4 @@ class FlightWaypointType(IntEnum):
|
||||
REFUEL = 29 # Should look for nearby tanker to refuel from.
|
||||
CARGO_STOP = 30 # Stopover landing point using the LandingReFuAr waypoint type
|
||||
INGRESS_AIR_ASSAULT = 31
|
||||
INGRESS_ANTI_SHIP = 32
|
||||
|
||||
34
game/missiongenerator/aircraft/waypoints/antishipingress.py
Normal file
34
game/missiongenerator/aircraft/waypoints/antishipingress.py
Normal file
@ -0,0 +1,34 @@
|
||||
import logging
|
||||
|
||||
from dcs.point import MovingPoint
|
||||
from dcs.task import AttackGroup, OptFormation, WeaponType
|
||||
|
||||
from game.theater import NavalControlPoint
|
||||
from .pydcswaypointbuilder import PydcsWaypointBuilder
|
||||
|
||||
|
||||
class AntiShipIngressBuilder(PydcsWaypointBuilder):
|
||||
def add_tasks(self, waypoint: MovingPoint) -> None:
|
||||
group_names = []
|
||||
waypoint.tasks.append(OptFormation.finger_four_open())
|
||||
|
||||
target = self.package.target
|
||||
if 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)
|
||||
waypoint.tasks.append(task)
|
||||
@ -3,13 +3,14 @@ import logging
|
||||
from dcs.point import MovingPoint
|
||||
from dcs.task import AttackGroup, OptFormation, WeaponType
|
||||
|
||||
from game.theater import NavalControlPoint, TheaterGroundObject
|
||||
from game.theater import TheaterGroundObject
|
||||
from game.transfers import MultiGroupTransport
|
||||
from .pydcswaypointbuilder import PydcsWaypointBuilder
|
||||
|
||||
|
||||
class BaiIngressBuilder(PydcsWaypointBuilder):
|
||||
def add_tasks(self, waypoint: MovingPoint) -> None:
|
||||
waypoint.tasks.append(OptFormation.trail_open())
|
||||
# TODO: Add common "UnitGroupTarget" base type.
|
||||
group_names = []
|
||||
target = self.package.target
|
||||
@ -18,10 +19,6 @@ class BaiIngressBuilder(PydcsWaypointBuilder):
|
||||
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 BAI mission: %s",
|
||||
@ -37,5 +34,3 @@ class BaiIngressBuilder(PydcsWaypointBuilder):
|
||||
|
||||
task = AttackGroup(miz_group.id, weapon_type=WeaponType.Auto)
|
||||
waypoint.tasks.append(task)
|
||||
|
||||
waypoint.tasks.append(OptFormation.trail_open())
|
||||
|
||||
@ -21,14 +21,15 @@ from game.missiongenerator.missiondata import MissionData
|
||||
from game.settings import Settings
|
||||
from game.utils import pairwise
|
||||
from .airassaultingress import AirAssaultIngressBuilder
|
||||
from .antishipingress import AntiShipIngressBuilder
|
||||
from .baiingress import BaiIngressBuilder
|
||||
from .landingzone import LandingZoneBuilder
|
||||
from .casingress import CasIngressBuilder
|
||||
from .deadingress import DeadIngressBuilder
|
||||
from .default import DefaultWaypointBuilder
|
||||
from .holdpoint import HoldPointBuilder
|
||||
from .joinpoint import JoinPointBuilder
|
||||
from .landingpoint import LandingPointBuilder
|
||||
from .landingzone import LandingZoneBuilder
|
||||
from .ocaaircraftingress import OcaAircraftIngressBuilder
|
||||
from .ocarunwayingress import OcaRunwayIngressBuilder
|
||||
from .pydcswaypointbuilder import PydcsWaypointBuilder, TARGET_WAYPOINTS
|
||||
@ -138,6 +139,7 @@ class WaypointGenerator:
|
||||
FlightWaypointType.REFUEL: RefuelPointBuilder,
|
||||
FlightWaypointType.CARGO_STOP: CargoStopBuilder,
|
||||
FlightWaypointType.INGRESS_AIR_ASSAULT: AirAssaultIngressBuilder,
|
||||
FlightWaypointType.INGRESS_ANTI_SHIP: AntiShipIngressBuilder,
|
||||
}
|
||||
builder = builders.get(waypoint.waypoint_type, DefaultWaypointBuilder)
|
||||
return builder(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user