tmz42 d07cb46741
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>
2024-01-20 15:54:37 +00:00

46 lines
1.7 KiB
Python

import logging
from dcs.point import MovingPoint
from dcs.task import EngageTargets, EngageTargetsInZone, Targets
from game.ato.flightplans.cas import CasFlightPlan
from game.utils import nautical_miles
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
+ self.flight.flight_plan.layout.patrol_end.position
) / 2
waypoint.add_task(
EngageTargetsInZone(
position=patrol_center,
radius=int(self.flight.flight_plan.engagement_distance.meters),
targets=[
Targets.All.GroundUnits.GroundVehicles,
Targets.All.GroundUnits.AirDefence.AAA,
Targets.All.GroundUnits.Infantry,
],
)
)
else:
logging.error("No CAS waypoint found. Falling back to search and engage")
waypoint.add_task(
EngageTargets(
max_distance=int(
nautical_miles(
self.flight.coalition.game.settings.cas_engagement_range_distance
).meters
),
targets=[
Targets.All.GroundUnits.GroundVehicles,
Targets.All.GroundUnits.AirDefence.AAA,
Targets.All.GroundUnits.Infantry,
],
)
)