Files
dcs-retribution/game/missiongenerator/aircraft/waypoints/deadingress.py
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

63 lines
2.0 KiB
Python

import logging
import math
from dcs.point import MovingPoint
from dcs.task import AttackGroup, OptECMUsing, WeaponType, Expend
from game.theater import TheaterGroundObject
from .pydcswaypointbuilder import PydcsWaypointBuilder
class DeadIngressBuilder(PydcsWaypointBuilder):
def add_tasks(self, waypoint: MovingPoint) -> None:
self.register_special_strike_points(self.waypoint.targets)
self.register_special_ingress_points()
target = self.package.target
if not isinstance(target, TheaterGroundObject):
logging.error(
"Unexpected target type for DEAD mission: %s",
target.__class__.__name__,
)
return
# Preemptively use ECM to better avoid getting swatted.
ecm_option = OptECMUsing(value=OptECMUsing.Values.UseIfDetectedLockByRadar)
waypoint.tasks.append(ecm_option)
for group in target.groups:
miz_group = self.mission.find_group(group.group_name)
if miz_group is None:
logging.error(
f"Could not find group for DEAD mission {group.group_name}"
)
continue
task = AttackGroup(
miz_group.id,
weapon_type=WeaponType.ARM,
expend=Expend.All,
altitude=waypoint.alt,
group_attack=True,
)
waypoint.tasks.append(task)
task = AttackGroup(
miz_group.id,
weapon_type=WeaponType.Guided,
altitude=waypoint.alt,
)
waypoint.tasks.append(task)
dir = target.position.heading_between_point(waypoint.position)
task = AttackGroup(
miz_group.id,
weapon_type=WeaponType.Unguided,
expend=Expend.All,
direction=math.radians(dir),
altitude=waypoint.alt,
)
task.params["altitudeEnabled"] = False
waypoint.tasks.append(task)