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)