AI Strike flight with user generated STRIKE, will now perform their bombing task correctly.

This commit is contained in:
Khopa 2020-05-31 18:02:00 +02:00
parent 0b9d827ad6
commit 02886a09d3
4 changed files with 23 additions and 18 deletions

View File

@ -455,15 +455,18 @@ class AircraftConflictGenerator:
group.points[0].tasks.append(OptRestrictJettison(True))
i = 1
bombing_point_found = False
for point in flight.points:
group.add_waypoint(Point(point.x,point.y), point.alt)
for t in point.targets:
if hasattr(t, "obj_name"):
buildings = self.game.theater.find_ground_objects_by_obj_name(t.obj_name)
for building in buildings:
group.points[i].tasks.append(Bombing(building.position))
else:
group.points[i].tasks.append(Bombing(t.position))
if not bombing_point_found:
for t in point.targets:
if hasattr(t, "obj_name"):
buildings = self.game.theater.find_ground_objects_by_obj_name(t.obj_name)
for building in buildings:
group.points[i].tasks.append(Bombing(building.position))
else:
group.points[i].tasks.append(Bombing(t.position))
bombing_point_found = True
i = i + 1

View File

@ -333,7 +333,7 @@ class FlightPlanner:
point = FlightWaypoint(u.position.x, u.position.y, 0)
point.description = "STRIKE " + "[" + str(location.obj_name) + "] : " + u.type + " #" + str(j)
point.pretty_name = "STRIKE " + "[" + str(location.obj_name) + "] : " + u.type + " #" + str(j)
point.targets.append(location)
ingress_point.targets.append(location)
flight.points.append(point)
else:
point = FlightWaypoint(location.position.x, location.position.y, 0)

View File

@ -105,6 +105,7 @@ class QPredefinedWaypointSelectionComboBox(QComboBox):
wpt.name = wpt.name = "[" + str(ground_object.obj_name) + "] : " + ground_object.category + " #" + str(ground_object.object_id)
wpt.pretty_name = wpt.name
wpt.obj_name = ground_object.obj_name
wpt.targets.append(ground_object)
if cp.captured:
wpt.description = "Friendly Building"
else:
@ -120,6 +121,7 @@ class QPredefinedWaypointSelectionComboBox(QComboBox):
wpt = FlightWaypoint(u.position.x, u.position.y, 0)
wpt.name = wpt.name = "[" + str(ground_object.obj_name) + "] : " + u.type + " #" + str(j)
wpt.pretty_name = wpt.name
wpt.targets.append(u)
wpt.obj_name = ground_object.obj_name
if cp.captured:
wpt.description = "Friendly unit : " + u.type

View File

@ -262,22 +262,22 @@ def generate_cp_ground_points(cp: ControlPoint, theater, game, group_id, templat
g.group_id = group_id
g.object_id = object_id
g.cp_id = cp.id
g.airbase_gorup = False
g.airbase_group = False
g.obj_name = obj_name
g.dcs_identifier = object["type"]
g.heading = object["heading"]
g.position = Point(point.x + object["offset"].x, point.y + object["offset"].y)
if g.dcs_identifier == "AA":
if cp.captured:
faction = game.player_name
else:
faction = game.enemy_name
g.groups = []
group = generate_anti_air_group(game, cp, g, faction)
if group is not None:
g.groups.append(group)
#if g.dcs_identifier == "AA":
# if cp.captured:
# faction = game.player_name
# else:
# faction = game.enemy_name
# g.groups = []
# group = generate_anti_air_group(game, cp, g, faction)
# if group is not None:
# g.groups.append(group)
cp.ground_objects.append(g)
return group_id