mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Give AEW&C a significant buffer from threats.
This commit is contained in:
parent
389f60786a
commit
d498bb9cff
@ -1057,7 +1057,7 @@ class FlightPlanBuilder:
|
|||||||
"""
|
"""
|
||||||
location = self.package.target
|
location = self.package.target
|
||||||
|
|
||||||
start = self.aewc_orbit(location)
|
orbit_location = self.aewc_orbit(location)
|
||||||
|
|
||||||
# As high as possible to maximize detection and on-station time.
|
# As high as possible to maximize detection and on-station time.
|
||||||
if flight.unit_type == E_2C:
|
if flight.unit_type == E_2C:
|
||||||
@ -1072,22 +1072,22 @@ class FlightPlanBuilder:
|
|||||||
patrol_alt = feet(25000)
|
patrol_alt = feet(25000)
|
||||||
|
|
||||||
builder = WaypointBuilder(flight, self.game, self.is_player)
|
builder = WaypointBuilder(flight, self.game, self.is_player)
|
||||||
start = builder.orbit(start, patrol_alt)
|
orbit_location = builder.orbit(orbit_location, patrol_alt)
|
||||||
|
|
||||||
return AwacsFlightPlan(
|
return AwacsFlightPlan(
|
||||||
package=self.package,
|
package=self.package,
|
||||||
flight=flight,
|
flight=flight,
|
||||||
takeoff=builder.takeoff(flight.departure),
|
takeoff=builder.takeoff(flight.departure),
|
||||||
nav_to=builder.nav_path(
|
nav_to=builder.nav_path(
|
||||||
flight.departure.position, start.position, patrol_alt
|
flight.departure.position, orbit_location.position, patrol_alt
|
||||||
),
|
),
|
||||||
nav_from=builder.nav_path(
|
nav_from=builder.nav_path(
|
||||||
start.position, flight.arrival.position, patrol_alt
|
orbit_location.position, flight.arrival.position, patrol_alt
|
||||||
),
|
),
|
||||||
land=builder.land(flight.arrival),
|
land=builder.land(flight.arrival),
|
||||||
divert=builder.divert(flight.divert),
|
divert=builder.divert(flight.divert),
|
||||||
bullseye=builder.bullseye(),
|
bullseye=builder.bullseye(),
|
||||||
hold=start,
|
hold=orbit_location,
|
||||||
hold_duration=timedelta(hours=4),
|
hold_duration=timedelta(hours=4),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1339,20 +1339,24 @@ class FlightPlanBuilder:
|
|||||||
return start, end
|
return start, end
|
||||||
|
|
||||||
def aewc_orbit(self, location: MissionTarget) -> Point:
|
def aewc_orbit(self, location: MissionTarget) -> Point:
|
||||||
# in threat zone
|
|
||||||
if self.threat_zones.threatened(location.position):
|
|
||||||
# Borderpoint
|
|
||||||
closest_boundary = self.threat_zones.closest_boundary(location.position)
|
closest_boundary = self.threat_zones.closest_boundary(location.position)
|
||||||
|
heading_to_threat_boundary = location.position.heading_between_point(
|
||||||
# Heading + Distance to border point
|
closest_boundary
|
||||||
heading = location.position.heading_between_point(closest_boundary)
|
)
|
||||||
distance = location.position.distance_to_point(closest_boundary)
|
distance_to_threat = meters(
|
||||||
|
location.position.distance_to_point(closest_boundary)
|
||||||
return location.position.point_from_heading(heading, distance)
|
)
|
||||||
|
orbit_heading = heading_to_threat_boundary
|
||||||
# this Part is fine. No threat zone, just use our point
|
# Station 100nm outside the threat zone.
|
||||||
|
threat_buffer = nautical_miles(100)
|
||||||
|
if self.threat_zones.threatened(location.position):
|
||||||
|
orbit_distance = distance_to_threat + threat_buffer
|
||||||
else:
|
else:
|
||||||
return location.position
|
orbit_distance = distance_to_threat - threat_buffer
|
||||||
|
|
||||||
|
return location.position.point_from_heading(
|
||||||
|
orbit_heading, orbit_distance.meters
|
||||||
|
)
|
||||||
|
|
||||||
def racetrack_for_frontline(
|
def racetrack_for_frontline(
|
||||||
self, origin: Point, front_line: FrontLine
|
self, origin: Point, front_line: FrontLine
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user