Improve bomber tasking

This commit is contained in:
Raffson 2022-12-02 15:03:53 +01:00
parent ae561e5564
commit 243ded448d
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99
2 changed files with 44 additions and 39 deletions

View File

@ -11,7 +11,10 @@ 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]:
bomber = self.group.units[0].unit_type in [B_17G, B_52H, Tu_22M3]
if bomber:
if self.group.units[0].unit_type == B_52H:
self.add_strike_tasks(waypoint, WeaponType.Guided)
self.add_bombing_tasks(waypoint)
else:
self.add_strike_tasks(waypoint)
@ -27,16 +30,18 @@ class StrikeIngressBuilder(PydcsWaypointBuilder):
for target in targets[1:]:
center += target.position
center /= len(targets)
ga = True if self.flight.count > 1 else False
bombing = Bombing(
center, weapon_type=WeaponType.Bombs, expend=Expend.All, group_attack=True
center, weapon_type=WeaponType.Bombs, expend=Expend.All, group_attack=ga
)
waypoint.tasks.append(bombing)
def add_strike_tasks(self, waypoint: MovingPoint) -> None:
def add_strike_tasks(
self, waypoint: MovingPoint, weapon_type: WeaponType = WeaponType.Auto
) -> None:
ga = True if self.flight.count > 1 else False
for target in self.waypoint.targets:
bombing = Bombing(
target.position, weapon_type=WeaponType.Auto, group_attack=True
)
bombing = Bombing(target.position, weapon_type=weapon_type, group_attack=ga)
# If there is only one target, drop all ordnance in one pass.
if len(self.waypoint.targets) == 1:
bombing.params["expend"] = Expend.All.value

View File

@ -2,6 +2,39 @@ local unitPayloads = {
["name"] = "B-52H",
["payloads"] = {
[1] = {
["name"] = "ANTISHIP",
["pylons"] = {
[1] = {
["CLSID"] = "{46ACDCF8-5451-4E26-BDDB-E78D5830E93C}",
["num"] = 2,
},
},
["tasks"] = {
[1] = 30,
},
},
[2] = {
["name"] = "STRIKE",
["pylons"] = {
[1] = {
["CLSID"] = "{696CFFC4-0BDE-42A8-BE4B-0BE3D9DD723C}",
["num"] = 1,
},
[2] = {
["CLSID"] = "{8DCAF3A3-7FCF-41B8-BB88-58DEDA878EDE}",
["num"] = 2,
},
[3] = {
["CLSID"] = "{696CFFC4-0BDE-42A8-BE4B-0BE3D9DD723C}",
["num"] = 3,
},
},
["tasks"] = {
[1] = 32,
[2] = 34,
},
},
[3] = {
["name"] = "SEAD",
["pylons"] = {
[1] = {
@ -21,39 +54,6 @@ local unitPayloads = {
[1] = 33,
},
},
[2] = {
["name"] = "ANTISHIP",
["pylons"] = {
[1] = {
["CLSID"] = "{46ACDCF8-5451-4E26-BDDB-E78D5830E93C}",
["num"] = 2,
},
},
["tasks"] = {
[1] = 30,
},
},
[3] = {
["name"] = "STRIKE",
["pylons"] = {
[1] = {
["CLSID"] = "{696CFFC4-0BDE-42A8-BE4B-0BE3D9DD723C}",
["num"] = 1,
},
[2] = {
["CLSID"] = "{6C47D097-83FF-4FB2-9496-EAB36DDF0B05}",
["num"] = 2,
},
[3] = {
["CLSID"] = "{696CFFC4-0BDE-42A8-BE4B-0BE3D9DD723C}",
["num"] = 3,
},
},
["tasks"] = {
[1] = 32,
[2] = 34,
},
},
[4] = {
["name"] = "CAP",
["pylons"] = {