mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
* Improve Ingress WP attack tasking and update pydcs - Updated the Attack Tasking of SEAD, DEAD, Strike and BAI to match the pydcs changes - Changed DEAD, BAI and SEAD AttackGroup task to expend=auto. This solves an issue where the AI uses all Ammo on one single target as we defined the expend param to All instead of Auto which is used by default. * Set Expend=All for SEAD Ingress This ensures that the AI will only do one Attack Pass and also really suppress the Target what they are expected to do.
45 lines
1.5 KiB
Python
45 lines
1.5 KiB
Python
import copy
|
|
|
|
from dcs.planes import B_17G, B_52H, Tu_22M3
|
|
from dcs.point import MovingPoint
|
|
from dcs.task import Bombing, OptFormation, WeaponType, Expend
|
|
|
|
from .pydcswaypointbuilder import PydcsWaypointBuilder
|
|
|
|
|
|
class StrikeIngressBuilder(PydcsWaypointBuilder):
|
|
def add_tasks(self, waypoint: MovingPoint) -> None:
|
|
if self.group.units[0].unit_type in [B_17G, B_52H, Tu_22M3]:
|
|
self.add_bombing_tasks(waypoint)
|
|
else:
|
|
self.add_strike_tasks(waypoint)
|
|
|
|
waypoint.tasks.append(OptFormation.trail_open())
|
|
|
|
def add_bombing_tasks(self, waypoint: MovingPoint) -> None:
|
|
targets = self.waypoint.targets
|
|
if not targets:
|
|
return
|
|
|
|
center = copy.copy(targets[0].position)
|
|
for target in targets[1:]:
|
|
center += target.position
|
|
center /= len(targets)
|
|
bombing = Bombing(
|
|
center, weapon_type=WeaponType.Bombs, expend=Expend.All, group_attack=True
|
|
)
|
|
waypoint.tasks.append(bombing)
|
|
|
|
def add_strike_tasks(self, waypoint: MovingPoint) -> None:
|
|
for target in self.waypoint.targets:
|
|
bombing = Bombing(
|
|
target.position, weapon_type=WeaponType.Auto, group_attack=True
|
|
)
|
|
# If there is only one target, drop all ordnance in one pass.
|
|
if len(self.waypoint.targets) == 1:
|
|
bombing.params["expend"] = Expend.All.value
|
|
waypoint.tasks.append(bombing)
|
|
|
|
# Register special waypoints
|
|
self.register_special_waypoints(self.waypoint.targets)
|