Fix generation of convoys along non-front routes.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2083
This commit is contained in:
Dan Albert 2022-05-27 17:02:45 -07:00
parent d59653eed9
commit ee3fb6df09

View File

@ -42,15 +42,16 @@ class ConvoyGenerator:
if self.game.settings.convoys_travel_full_distance: if self.game.settings.convoys_travel_full_distance:
end_point = convoy.route_end end_point = convoy.route_end
else: else:
# convoys_travel_full_distance is disabled, so have the convoy only move the first segment on the route. # convoys_travel_full_distance is disabled, so have the convoy only move the
# This option aims to remove long routes for ground vehicles between control points, # first segment on the route. This option aims to remove long routes for
# since the CPU load for pathfinding long routes on DCS can be pretty heavy. # ground vehicles between control points, since the CPU load for pathfinding
frontline = convoy.origin.front_line_with(convoy.destination) # long routes on DCS can be pretty heavy.
route = convoy.origin.convoy_route_to(convoy.destination)
# Select the first route segment from the origin towards the destination # Select the first route segment from the origin towards the destination so
# so the convoy spawns at the origin CP. This allows the convoy to be # the convoy spawns at the origin CP. This allows the convoy to be targeted
# targeted by BAI flights and starts it within the protection umbrella of the CP. # by BAI flights and starts it within the protection umbrella of the CP.
end_point = frontline.segments[0].point_b end_point = route[1]
group.add_waypoint( group.add_waypoint(
end_point, end_point,