Fine-tune target waypoints for Strike Eagle

This commit is contained in:
Raffson 2024-03-10 00:49:36 +01:00
parent a9287809a3
commit 3cd1b2f80a
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99
4 changed files with 15 additions and 4 deletions

View File

@ -10,6 +10,7 @@ from dcs import Point
from dcs.planes import C_101CC, C_101EB, Su_33, FA_18C_hornet
from game.dcs.aircrafttype import AircraftType
from game.theater import ControlPoint, MissionTarget
from pydcs_extensions.hercules.hercules import Hercules
from .flightmembers import FlightMembers
from .flightroster import FlightRoster
@ -34,7 +35,6 @@ if TYPE_CHECKING:
from game.sim.gameupdateevents import GameUpdateEvents
from game.sim.simulationresults import SimulationResults
from game.squadrons import Squadron, Pilot
from game.theater import ControlPoint
from game.transfers import TransferOrder
from game.data.weapons import WeaponType
from .flightmember import FlightMember
@ -224,6 +224,13 @@ class Flight(
def points(self) -> List[FlightWaypoint]:
return self.flight_plan.waypoints[1:]
@property
def custom_targets(self) -> List[MissionTarget]:
return [
MissionTarget(wpt.name, wpt.position)
for wpt in self.flight_plan.layout.custom_waypoints
]
def position(self) -> Point:
return self.state.estimate_position()

View File

@ -124,7 +124,8 @@ class PydcsWaypointBuilder:
return False
def register_special_strike_points(
self, targets: Iterable[Union[MissionTarget, TheaterUnit]]
self, targets: Iterable[Union[MissionTarget, TheaterUnit]],
start: int = 1,
) -> None:
"""Create special strike waypoints for various aircraft"""
for i, t in enumerate(targets):
@ -135,7 +136,7 @@ class PydcsWaypointBuilder:
# 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"
t.position, f"M{(i//8)+start}.{i%8+1}\nH-1\nA0\nV0"
)
def register_special_ingress_points(self) -> None:

View File

@ -2,7 +2,7 @@ import copy
from typing import Union
from dcs import Point
from dcs.planes import B_17G, B_52H, Tu_22M3, B_1B
from dcs.planes import B_17G, B_52H, Tu_22M3, B_1B, F_15ESE
from dcs.point import MovingPoint
from dcs.task import Bombing, Expend, OptFormation, WeaponType, CarpetBombing
@ -76,4 +76,6 @@ class StrikeIngressBuilder(PydcsWaypointBuilder):
# Register special waypoints
if not self._special_wpts_injected:
self.register_special_strike_points(self.waypoint.targets)
if self.flight.unit_type.dcs_unit_type == F_15ESE:
self.register_special_strike_points(self.flight.custom_targets, 2)
self._special_wpts_injected = True

View File

@ -97,6 +97,7 @@ class QPredefinedWaypointSelectionComboBox(QFilteredComboBox):
wpt.description = f"Friendly unit: {target.name}"
else:
wpt.description = f"Enemy unit: {target.name}"
wpt.waypoint_type = FlightWaypointType.TARGET_POINT
i = add_model_item(i, model, wpt.pretty_name, wpt)
if self.include_airbases: