Waypoint changes (F15E Strike Targets and Tomcat IP) (#236)

* Change indentation of register_special_waypoints (put out of loop)

* Added Strike Targets as F-15E Mission Target points (Set/Mission 1)

* Set up check for ASM : only if non-human flight lead. Add targets to the kneeboard.

* Generate multiple sets (i-e M2.1) for situations where the number of points is more than 8.

Added check condition to kneeboard (otherwise, may result in multiple writes).

* Change name of register_special_waypoints to register_special_strike_points

Add register_special_ingress_points method for special IPs and add to the appropriate classes

* Add changelog entry for Tomcat's IP wpt

* Avoid depending on client slots for special wpts injection

---------

Co-authored-by: tmz42 <thomas.monnzie@gmail.com>
Co-authored-by: Raffson <Raffson@users.noreply.github.com>
This commit is contained in:
tmz42 2024-01-20 16:54:37 +01:00 committed by GitHub
parent df3bd146da
commit d07cb46741
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 47 additions and 7 deletions

View File

@ -31,6 +31,8 @@
* **[Mission Generator]** Channel terrain fix on exclusion zones, sea zones and inclusion zones
* **[Options]** Cheat-option for accessing Air Wing Config Dialog after campaign start
* **[Options]** Option to enable unlimited fuel for AI (player and non-player flights)
* **[Mission Generator]** F-15E Strike targets are automatically added as Mission Set 1
* **[Mission Generator]** Set F-14's IP waypoint according to the flight-plan's ingress point
## Fixes
* **[Mission Generation]** Anti-ship strikes should use "group attack" in their attack-task

View File

@ -9,6 +9,7 @@ from .pydcswaypointbuilder import PydcsWaypointBuilder
class AirAssaultIngressBuilder(PydcsWaypointBuilder):
def add_tasks(self, waypoint: MovingPoint) -> None:
self.register_special_ingress_points()
air_drop = self.group.units[0].unit_type in [Hercules]
if air_drop:
waypoint.speed = knots(230).meters_per_second

View File

@ -9,6 +9,7 @@ from .pydcswaypointbuilder import PydcsWaypointBuilder
class AntiShipIngressBuilder(PydcsWaypointBuilder):
def add_tasks(self, waypoint: MovingPoint) -> None:
self.register_special_ingress_points()
group_names = []
waypoint.tasks.append(OptFormation.finger_four_open())

View File

@ -10,6 +10,7 @@ from .pydcswaypointbuilder import PydcsWaypointBuilder
class BaiIngressBuilder(PydcsWaypointBuilder):
def add_tasks(self, waypoint: MovingPoint) -> None:
self.register_special_ingress_points()
waypoint.tasks.append(OptFormation.trail_open())
# TODO: Add common "UnitGroupTarget" base type.
group_names = []

View File

@ -10,6 +10,7 @@ from .pydcswaypointbuilder import PydcsWaypointBuilder
class CasIngressBuilder(PydcsWaypointBuilder):
def add_tasks(self, waypoint: MovingPoint) -> None:
self.register_special_ingress_points()
if isinstance(self.flight.flight_plan, CasFlightPlan):
patrol_center = (
self.flight.flight_plan.layout.patrol_start.position

View File

@ -10,7 +10,8 @@ from .pydcswaypointbuilder import PydcsWaypointBuilder
class DeadIngressBuilder(PydcsWaypointBuilder):
def add_tasks(self, waypoint: MovingPoint) -> None:
self.register_special_waypoints(self.waypoint.targets)
self.register_special_strike_points(self.waypoint.targets)
self.register_special_ingress_points()
target = self.package.target
if not isinstance(target, TheaterGroundObject):

View File

@ -11,6 +11,7 @@ from .pydcswaypointbuilder import PydcsWaypointBuilder
class OcaAircraftIngressBuilder(PydcsWaypointBuilder):
def add_tasks(self, waypoint: MovingPoint) -> None:
target = self.package.target
self.register_special_ingress_points()
if not isinstance(target, Airfield):
logging.error(
"Unexpected target type for OCA Strike mission: %s",

View File

@ -17,6 +17,7 @@ class OcaRunwayIngressBuilder(PydcsWaypointBuilder):
def add_tasks(self, waypoint: MovingPoint) -> None:
target = self.package.target
waypoint.tasks.append(OptFormation.trail_open())
self.register_special_ingress_points()
if not isinstance(target, Airfield):
logging.error(
"Unexpected target type for runway bombing mission: %s",

View File

@ -4,7 +4,7 @@ from datetime import datetime
from typing import Any, Iterable, Union
from dcs import Mission
from dcs.planes import AJS37, F_14A_135_GR, F_14B, JF_17
from dcs.planes import AJS37, F_14A_135_GR, F_14B, JF_17, F_15ESE
from dcs.point import MovingPoint, PointAction
from dcs.unitgroup import FlyingGroup
@ -103,12 +103,24 @@ class PydcsWaypointBuilder:
else:
return False
def register_special_waypoints(
def register_special_strike_points(
self, targets: Iterable[Union[MissionTarget, TheaterUnit]]
) -> None:
"""Create special target waypoints for various aircraft"""
"""Create special strike waypoints for various aircraft"""
for i, t in enumerate(targets):
if self.group.units[0].unit_type == JF_17 and i < 4:
self.group.add_nav_target_point(t.position, "PP" + str(i + 1))
if self.group.units[0].unit_type in [F_14B, F_14A_135_GR] and i == 0:
self.group.add_nav_target_point(t.position, "ST")
# Add F-15E mission target points as mission 1 (for JDAM for instance)
if self.group.units[0].unit_type == F_15ESE:
self.group.add_nav_target_point(
t.position, f"M{(i//8)+1}.{i%8+1}" f"\nH-1" f"\nA0" f"\nV0"
)
def register_special_ingress_points(self) -> None:
# Register Tomcat Initial Point
if self.flight.client_count and (
self.group.units[0].unit_type in (F_14A_135_GR, F_14B)
):
self.group.add_nav_target_point(self.waypoint.position, "IP")

View File

@ -17,7 +17,8 @@ from .pydcswaypointbuilder import PydcsWaypointBuilder
class SeadIngressBuilder(PydcsWaypointBuilder):
def add_tasks(self, waypoint: MovingPoint) -> None:
self.register_special_waypoints(self.waypoint.targets)
self.register_special_strike_points(self.waypoint.targets)
self.register_special_ingress_points()
target = self.package.target
if not isinstance(target, TheaterGroundObject):

View File

@ -12,6 +12,7 @@ from .pydcswaypointbuilder import PydcsWaypointBuilder
class SeadSweepIngressBuilder(PydcsWaypointBuilder):
def add_tasks(self, waypoint: MovingPoint) -> None:
self.register_special_ingress_points()
# Preemptively use ECM to better avoid getting swatted.
ecm_option = OptECMUsing(value=OptECMUsing.Values.UseIfDetectedLockByRadar)
waypoint.tasks.append(ecm_option)

View File

@ -11,6 +11,8 @@ from .pydcswaypointbuilder import PydcsWaypointBuilder
class StrikeIngressBuilder(PydcsWaypointBuilder):
_special_wpts_injected: bool = False
def add_tasks(self, waypoint: MovingPoint) -> None:
bomber = self.group.units[0].unit_type in [B_17G, Tu_22M3]
bomber_guided = self.group.units[0].unit_type in [B_1B, B_52H]
@ -25,6 +27,7 @@ class StrikeIngressBuilder(PydcsWaypointBuilder):
waypoint.tasks.append(OptFormation.ww2_bomber_element_close())
self.add_bombing_tasks(waypoint)
waypoint.tasks.append(OptFormation.finger_four_open())
self.register_special_ingress_points()
def add_bombing_tasks(self, waypoint: MovingPoint) -> None:
targets = self.waypoint.targets
@ -72,5 +75,7 @@ class StrikeIngressBuilder(PydcsWaypointBuilder):
waypoint.speed = mach(0.85, meters(waypoint.alt)).meters_per_second
# Register special waypoints
self.register_special_waypoints(self.waypoint.targets)
# Register special waypoints
if not self._special_wpts_injected:
self.register_special_strike_points(self.waypoint.targets)
self._special_wpts_injected = True

View File

@ -10,6 +10,7 @@ from .pydcswaypointbuilder import PydcsWaypointBuilder
class SweepIngressBuilder(PydcsWaypointBuilder):
def add_tasks(self, waypoint: MovingPoint) -> None:
self.register_special_ingress_points()
if self.flight.count < 4:
waypoint.tasks.append(OptFormation.line_abreast_open())
else:

View File

@ -35,6 +35,8 @@ from dcs.mission import Mission
from suntime import Sun # type: ignore
from tabulate import tabulate
from dcs.planes import F_15ESE
from game.ato.flighttype import FlightType
from game.ato.flightwaypoint import FlightWaypoint
from game.ato.flightwaypointtype import FlightWaypointType
@ -745,6 +747,15 @@ class StrikeTaskPage(KneeboardPage):
custom_name_title = ""
writer.title(f"{self.flight.callsign} Strike Task Info{custom_name_title}")
if self.flight.units[0].unit_type == F_15ESE:
i: int = 0
for target in self.targets:
if not target.waypoint.pretty_name.__contains__("DTC"):
target.waypoint.pretty_name = (
f"{target.waypoint.pretty_name} (DTC M{(i//8)+1}.{i%9+1})"
)
i = i + 1
writer.table(
[self.target_info_row(t, writer) for t in self.targets],
headers=["STPT", "Description", "Location"],