Fine-tune Strike-ingress waypoint tasks

This commit is contained in:
Raffson 2024-04-27 19:34:57 +02:00
parent 015aa98f4c
commit 19523e35cf
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99

View File

@ -62,11 +62,31 @@ class StrikeIngressBuilder(PydcsWaypointBuilder):
def add_strike_tasks( def add_strike_tasks(
self, waypoint: MovingPoint, weapon_type: WeaponType = WeaponType.Auto self, waypoint: MovingPoint, weapon_type: WeaponType = WeaponType.Auto
) -> None: ) -> None:
bomber = self.group.units[0].unit_type in [B_1B, B_52H]
ratio = len(self.group.units) / len(self.waypoint.targets)
for target in self.waypoint.targets: for target in self.waypoint.targets:
bombing = Bombing(target.position, weapon_type=weapon_type) bombing = Bombing(target.position, weapon_type=weapon_type)
# If there is only one target, drop all ordnance in one pass. # If there is only one target, drop all ordnance in one pass with group attack.
if len(self.waypoint.targets) == 1: if len(self.waypoint.targets) == 1:
bombing.params["expend"] = Expend.All.value bombing.params["expend"] = Expend.All.value
bombing.params["groupAttack"] = True
elif ratio >= 1:
# #TGTs > 1 & #AC >= #TGTs => each AC drops entire payload per TGT
bombing.params["expend"] = Expend.All.value
elif 1 > ratio >= 0.5:
# #TGTs > 1 & 2 * #AC >= #TGTs => each AC drops half payload per TGT
bombing.params["expend"] = Expend.Half.value
elif 0.5 > ratio >= 0.25:
# #TGTs > 1 & 4 * #AC >= #TGTs => each AC drops quarter payload per TGT
bombing.params["expend"] = Expend.Quarter.value
elif 0.25 > ratio >= (1.0 / 6) and bomber:
# #TGTs > 1 & 4 * #AC < #TGTs & bomber => each AC drops 4 bombs per TGT
bombing.params["expend"] = Expend.Four.value
elif bomber:
# #TGTs > 1 & 6 * #AC < #TGTs & bomber => each AC drops 2 bombs per TGT
bombing.params["expend"] = Expend.Two.value
# else => Auto QTY
waypoint.tasks.append(bombing) waypoint.tasks.append(bombing)
waypoint.speed = mach(0.85, meters(waypoint.alt)).meters_per_second waypoint.speed = mach(0.85, meters(waypoint.alt)).meters_per_second