mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
new point generation
This commit is contained in:
parent
5bda4abfce
commit
dd9fe87ff4
@ -1183,23 +1183,29 @@ class FlightPlanBuilder:
|
|||||||
return start, end
|
return start, end
|
||||||
|
|
||||||
def aewc_orbit(self, location: MissionTarget) -> Point:
|
def aewc_orbit(self, location: MissionTarget) -> Point:
|
||||||
closest_airfield = location
|
heading = 0
|
||||||
heading = location.position.heading_between_point(closest_airfield.position)
|
distance = 0
|
||||||
|
|
||||||
position = ShapelyPoint(
|
while True:
|
||||||
self.package.target.position.x, self.package.target.position.y
|
# Generate our Orbit point
|
||||||
)
|
orbit_point = location.position.point_from_heading(heading, distance)
|
||||||
|
# Check if our generated point is in a threat zone
|
||||||
if meters(position.distance(self.threat_zones.all)) == meters(0):
|
test_pos = ShapelyPoint(
|
||||||
distance_to_no_fly = (
|
orbit_point.x, orbit_point.y
|
||||||
meters(position.distance(self.threat_zones.all))
|
|
||||||
- self.doctrine.cap_engagement_range
|
|
||||||
- nautical_miles(5)
|
|
||||||
)
|
)
|
||||||
else:
|
|
||||||
distance_to_no_fly = meters(0)
|
|
||||||
|
|
||||||
return location.position.point_from_heading(heading, int(distance_to_no_fly.meters))
|
if heading > 360:
|
||||||
|
if meters(test_pos.distance(self.threat_zones.all)) == meters(0):
|
||||||
|
distance += int(nautical_miles(50).meters)
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
heading = 0
|
||||||
|
elif meters(test_pos.distance(self.threat_zones.all)) == meters(0):
|
||||||
|
heading += 60
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
|
||||||
|
return orbit_point
|
||||||
|
|
||||||
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