Perturb join waypoint for helicopters

This commit is contained in:
Raffson 2024-07-21 19:50:00 +02:00
parent 98b49d5fca
commit b7ad1048bd
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99
3 changed files with 4 additions and 3 deletions

View File

@ -11,6 +11,7 @@ from .formationattack import (
) )
from .waypointbuilder import WaypointBuilder from .waypointbuilder import WaypointBuilder
from .. import FlightType from .. import FlightType
from ...utils import feet
class EscortFlightPlan(FormationAttackFlightPlan): class EscortFlightPlan(FormationAttackFlightPlan):
@ -34,7 +35,7 @@ class Builder(FormationAttackBuilder[EscortFlightPlan, FormationAttackLayout]):
hold = builder.hold(self._hold_point()) hold = builder.hold(self._hold_point())
join_pos = ( join_pos = (
self.package.waypoints.ingress WaypointBuilder.perturb(self.package.waypoints.ingress, feet(500))
if self.flight.is_helo if self.flight.is_helo
else self.package.waypoints.join else self.package.waypoints.join
) )

View File

@ -193,6 +193,7 @@ class FormationAttackBuilder(IBuilder[FlightPlanT, LayoutT], ABC):
join_pos = self.package.waypoints.join join_pos = self.package.waypoints.join
if self.flight.is_helo: if self.flight.is_helo:
join_pos = self.package.waypoints.ingress join_pos = self.package.waypoints.ingress
join_pos = WaypointBuilder.perturb(join_pos, feet(500))
join = builder.join(join_pos) join = builder.join(join_pos)
split = builder.split(self._get_split()) split = builder.split(self._get_split())
refuel = self._build_refuel(builder) refuel = self._build_refuel(builder)

View File

@ -790,8 +790,7 @@ class WaypointBuilder:
return previous_threatened and next_threatened return previous_threatened and next_threatened
@staticmethod @staticmethod
def perturb(point: Point) -> Point: def perturb(point: Point, deviation: Distance = nautical_miles(1)) -> Point:
deviation = nautical_miles(1)
x_adj = random.randint(int(-deviation.meters), int(deviation.meters)) x_adj = random.randint(int(-deviation.meters), int(deviation.meters))
y_adj = random.randint(int(-deviation.meters), int(deviation.meters)) y_adj = random.randint(int(-deviation.meters), int(deviation.meters))
return point + Vector2(x_adj, y_adj) return point + Vector2(x_adj, y_adj)