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)