From 1bb7e1bf470aec7d3a2dd4b29d41d4befd408c63 Mon Sep 17 00:00:00 2001 From: RndName Date: Tue, 29 Mar 2022 14:58:20 +0200 Subject: [PATCH] Change SEAD task to Search and Engage for ARM weapon SEAD flights will have the Search and Engage Group Task instead of the current AttackGroup task when the flight has ARM weapons in the Loadout. This resolves an issue with AI not able to attack a SAM when skynet is used. This is due to the RADAR not emitting and the AI therefore just diving into the SAM. Non-ARM Loadouts will still use the AttackGroup task. This ensures that for example the ADM-141 TALD used by the F-14s will work correctly --- game/data/weapons.py | 1 + .../aircraft/waypoints/seadingress.py | 30 ++++++++++++++----- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/game/data/weapons.py b/game/data/weapons.py index 8e7c86c9..23db497d 100644 --- a/game/data/weapons.py +++ b/game/data/weapons.py @@ -94,6 +94,7 @@ class Weapon: @unique class WeaponType(Enum): + ARM = "ARM" LGB = "LGB" TGP = "TGP" UNKNOWN = "unknown" diff --git a/game/missiongenerator/aircraft/waypoints/seadingress.py b/game/missiongenerator/aircraft/waypoints/seadingress.py index 1c57f81c..ea9fa03c 100644 --- a/game/missiongenerator/aircraft/waypoints/seadingress.py +++ b/game/missiongenerator/aircraft/waypoints/seadingress.py @@ -1,7 +1,8 @@ import logging from dcs.point import MovingPoint -from dcs.task import AttackGroup, OptECMUsing, WeaponType +from dcs.task import AttackGroup, EngageGroup, OptECMUsing, WeaponType as DcsWeaponType +from game.data.weapons import WeaponType from game.theater import TheaterGroundObject from .pydcswaypointbuilder import PydcsWaypointBuilder @@ -27,13 +28,26 @@ class SeadIngressBuilder(PydcsWaypointBuilder): ) continue - task = AttackGroup(miz_group.id, weapon_type=WeaponType.Guided) - task.params["expend"] = "All" - task.params["attackQtyLimit"] = False - task.params["directionEnabled"] = False - task.params["altitudeEnabled"] = False - task.params["groupAttack"] = True - waypoint.tasks.append(task) + if self.flight.loadout.has_weapon_of_type(WeaponType.ARM): + # Special handling for ARM Weapon types: + # The SEAD flight will Search for the targeted group and then engage it + # if it is found only. This will prevent AI from having huge problems + # when skynet is enabled and the Radar is not emitting. They dive + # into the SAM instead of waiting for it to come alive + engage_task = EngageGroup(miz_group.id) + engage_task.params["weaponType"] = DcsWeaponType.Guided.value + waypoint.tasks.append(engage_task) + else: + # All non ARM types like Decoys will use the normal AttackGroup Task + attack_task = AttackGroup( + miz_group.id, weapon_type=DcsWeaponType.Guided + ) + attack_task.params["expend"] = "All" + attack_task.params["attackQtyLimit"] = False + attack_task.params["directionEnabled"] = False + attack_task.params["altitudeEnabled"] = False + attack_task.params["groupAttack"] = True + waypoint.tasks.append(attack_task) # Preemptively use ECM to better avoid getting swatted. ecm_option = OptECMUsing(value=OptECMUsing.Values.UseIfDetectedLockByRadar)