mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Remove egress points from most flight plans.
These don't have any function. Remove them and remove the angled attack heading from the IP.
This commit is contained in:
parent
f7bbe0fa94
commit
dfcd372d2d
@ -1,7 +1,9 @@
|
|||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from game.data.groundunitclass import GroundUnitClass
|
from game.data.groundunitclass import GroundUnitClass
|
||||||
|
from game.savecompat import has_save_compat_for
|
||||||
from game.utils import Distance, feet, nautical_miles
|
from game.utils import Distance, feet, nautical_miles
|
||||||
|
|
||||||
|
|
||||||
@ -38,9 +40,8 @@ class Doctrine:
|
|||||||
push_distance: Distance
|
push_distance: Distance
|
||||||
join_distance: Distance
|
join_distance: Distance
|
||||||
split_distance: Distance
|
split_distance: Distance
|
||||||
ingress_egress_distance: Distance
|
ingress_distance: Distance
|
||||||
ingress_altitude: Distance
|
ingress_altitude: Distance
|
||||||
egress_altitude: Distance
|
|
||||||
|
|
||||||
min_patrol_altitude: Distance
|
min_patrol_altitude: Distance
|
||||||
max_patrol_altitude: Distance
|
max_patrol_altitude: Distance
|
||||||
@ -75,6 +76,13 @@ class Doctrine:
|
|||||||
|
|
||||||
mission_ranges: MissionPlannerMaxRanges = field(default=MissionPlannerMaxRanges())
|
mission_ranges: MissionPlannerMaxRanges = field(default=MissionPlannerMaxRanges())
|
||||||
|
|
||||||
|
@has_save_compat_for(5)
|
||||||
|
def __setstate__(self, state: dict[str, Any]) -> None:
|
||||||
|
if "ingress_distance" not in state:
|
||||||
|
state["ingress_distance"] = state["ingress_egress_distance"]
|
||||||
|
del state["ingress_egress_distance"]
|
||||||
|
self.__dict__.update(state)
|
||||||
|
|
||||||
|
|
||||||
MODERN_DOCTRINE = Doctrine(
|
MODERN_DOCTRINE = Doctrine(
|
||||||
cap=True,
|
cap=True,
|
||||||
@ -87,9 +95,8 @@ MODERN_DOCTRINE = Doctrine(
|
|||||||
push_distance=nautical_miles(20),
|
push_distance=nautical_miles(20),
|
||||||
join_distance=nautical_miles(20),
|
join_distance=nautical_miles(20),
|
||||||
split_distance=nautical_miles(20),
|
split_distance=nautical_miles(20),
|
||||||
ingress_egress_distance=nautical_miles(45),
|
ingress_distance=nautical_miles(45),
|
||||||
ingress_altitude=feet(20000),
|
ingress_altitude=feet(20000),
|
||||||
egress_altitude=feet(20000),
|
|
||||||
min_patrol_altitude=feet(15000),
|
min_patrol_altitude=feet(15000),
|
||||||
max_patrol_altitude=feet(33000),
|
max_patrol_altitude=feet(33000),
|
||||||
pattern_altitude=feet(5000),
|
pattern_altitude=feet(5000),
|
||||||
@ -125,9 +132,8 @@ COLDWAR_DOCTRINE = Doctrine(
|
|||||||
push_distance=nautical_miles(10),
|
push_distance=nautical_miles(10),
|
||||||
join_distance=nautical_miles(10),
|
join_distance=nautical_miles(10),
|
||||||
split_distance=nautical_miles(10),
|
split_distance=nautical_miles(10),
|
||||||
ingress_egress_distance=nautical_miles(30),
|
ingress_distance=nautical_miles(30),
|
||||||
ingress_altitude=feet(18000),
|
ingress_altitude=feet(18000),
|
||||||
egress_altitude=feet(18000),
|
|
||||||
min_patrol_altitude=feet(10000),
|
min_patrol_altitude=feet(10000),
|
||||||
max_patrol_altitude=feet(24000),
|
max_patrol_altitude=feet(24000),
|
||||||
pattern_altitude=feet(5000),
|
pattern_altitude=feet(5000),
|
||||||
@ -163,9 +169,8 @@ WWII_DOCTRINE = Doctrine(
|
|||||||
join_distance=nautical_miles(5),
|
join_distance=nautical_miles(5),
|
||||||
split_distance=nautical_miles(5),
|
split_distance=nautical_miles(5),
|
||||||
rendezvous_altitude=feet(10000),
|
rendezvous_altitude=feet(10000),
|
||||||
ingress_egress_distance=nautical_miles(7),
|
ingress_distance=nautical_miles(7),
|
||||||
ingress_altitude=feet(8000),
|
ingress_altitude=feet(8000),
|
||||||
egress_altitude=feet(8000),
|
|
||||||
min_patrol_altitude=feet(4000),
|
min_patrol_altitude=feet(4000),
|
||||||
max_patrol_altitude=feet(15000),
|
max_patrol_altitude=feet(15000),
|
||||||
pattern_altitude=feet(5000),
|
pattern_altitude=feet(5000),
|
||||||
|
|||||||
@ -40,7 +40,6 @@ class Task:
|
|||||||
class PackageWaypoints:
|
class PackageWaypoints:
|
||||||
join: Point
|
join: Point
|
||||||
ingress: Point
|
ingress: Point
|
||||||
egress: Point
|
|
||||||
split: Point
|
split: Point
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -542,7 +542,6 @@ class StrikeFlightPlan(FormationFlightPlan):
|
|||||||
join: FlightWaypoint
|
join: FlightWaypoint
|
||||||
ingress: FlightWaypoint
|
ingress: FlightWaypoint
|
||||||
targets: List[FlightWaypoint]
|
targets: List[FlightWaypoint]
|
||||||
egress: FlightWaypoint
|
|
||||||
split: FlightWaypoint
|
split: FlightWaypoint
|
||||||
nav_from: List[FlightWaypoint]
|
nav_from: List[FlightWaypoint]
|
||||||
land: FlightWaypoint
|
land: FlightWaypoint
|
||||||
@ -557,7 +556,6 @@ class StrikeFlightPlan(FormationFlightPlan):
|
|||||||
yield self.join
|
yield self.join
|
||||||
yield self.ingress
|
yield self.ingress
|
||||||
yield from self.targets
|
yield from self.targets
|
||||||
yield self.egress
|
|
||||||
yield self.split
|
yield self.split
|
||||||
yield from self.nav_from
|
yield from self.nav_from
|
||||||
yield self.land
|
yield self.land
|
||||||
@ -569,7 +567,6 @@ class StrikeFlightPlan(FormationFlightPlan):
|
|||||||
def package_speed_waypoints(self) -> Set[FlightWaypoint]:
|
def package_speed_waypoints(self) -> Set[FlightWaypoint]:
|
||||||
return {
|
return {
|
||||||
self.ingress,
|
self.ingress,
|
||||||
self.egress,
|
|
||||||
self.split,
|
self.split,
|
||||||
} | set(self.targets)
|
} | set(self.targets)
|
||||||
|
|
||||||
@ -633,8 +630,8 @@ class StrikeFlightPlan(FormationFlightPlan):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def split_time(self) -> timedelta:
|
def split_time(self) -> timedelta:
|
||||||
travel_time = self.travel_time_between_waypoints(self.egress, self.split)
|
travel_time = self.travel_time_between_waypoints(self.ingress, self.split)
|
||||||
return self.egress_time + travel_time
|
return self.ingress_time + travel_time
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ingress_time(self) -> timedelta:
|
def ingress_time(self) -> timedelta:
|
||||||
@ -644,19 +641,9 @@ class StrikeFlightPlan(FormationFlightPlan):
|
|||||||
)
|
)
|
||||||
return tot - travel_time
|
return tot - travel_time
|
||||||
|
|
||||||
@property
|
|
||||||
def egress_time(self) -> timedelta:
|
|
||||||
tot = self.tot
|
|
||||||
travel_time = self.travel_time_between_waypoints(
|
|
||||||
self.target_area_waypoint, self.egress
|
|
||||||
)
|
|
||||||
return tot + travel_time
|
|
||||||
|
|
||||||
def tot_for_waypoint(self, waypoint: FlightWaypoint) -> Optional[timedelta]:
|
def tot_for_waypoint(self, waypoint: FlightWaypoint) -> Optional[timedelta]:
|
||||||
if waypoint == self.ingress:
|
if waypoint == self.ingress:
|
||||||
return self.ingress_time
|
return self.ingress_time
|
||||||
elif waypoint == self.egress:
|
|
||||||
return self.egress_time
|
|
||||||
elif waypoint in self.targets:
|
elif waypoint in self.targets:
|
||||||
return self.tot
|
return self.tot
|
||||||
return super().tot_for_waypoint(waypoint)
|
return super().tot_for_waypoint(waypoint)
|
||||||
@ -982,7 +969,7 @@ class FlightPlanBuilder:
|
|||||||
|
|
||||||
for join_point in self.preferred_join_points():
|
for join_point in self.preferred_join_points():
|
||||||
join_distance = meters(join_point.distance_to_point(target))
|
join_distance = meters(join_point.distance_to_point(target))
|
||||||
if join_distance > self.doctrine.ingress_egress_distance:
|
if join_distance > self.doctrine.ingress_distance:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
# The entire path to the target is threatened. Use the fallback behavior for
|
# The entire path to the target is threatened. Use the fallback behavior for
|
||||||
@ -995,11 +982,9 @@ class FlightPlanBuilder:
|
|||||||
|
|
||||||
# The first case described above. The ingress and join points are placed
|
# The first case described above. The ingress and join points are placed
|
||||||
# reasonably relative to each other.
|
# reasonably relative to each other.
|
||||||
egress_point = self._egress_point(attack_heading)
|
|
||||||
self.package.waypoints = PackageWaypoints(
|
self.package.waypoints = PackageWaypoints(
|
||||||
WaypointBuilder.perturb(join_point),
|
WaypointBuilder.perturb(join_point),
|
||||||
ingress_point,
|
ingress_point,
|
||||||
egress_point,
|
|
||||||
WaypointBuilder.perturb(join_point),
|
WaypointBuilder.perturb(join_point),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1010,13 +995,11 @@ class FlightPlanBuilder:
|
|||||||
from gen.ato import PackageWaypoints
|
from gen.ato import PackageWaypoints
|
||||||
|
|
||||||
ingress_point = self._ingress_point(self._target_heading_to_package_airfield())
|
ingress_point = self._ingress_point(self._target_heading_to_package_airfield())
|
||||||
egress_point = self._egress_point(self._target_heading_to_package_airfield())
|
|
||||||
join_point = self._rendezvous_point(ingress_point)
|
join_point = self._rendezvous_point(ingress_point)
|
||||||
split_point = self._rendezvous_point(self.package.target.position)
|
split_point = self._rendezvous_point(self.package.target.position)
|
||||||
self.package.waypoints = PackageWaypoints(
|
self.package.waypoints = PackageWaypoints(
|
||||||
join_point,
|
join_point,
|
||||||
ingress_point,
|
ingress_point,
|
||||||
egress_point,
|
|
||||||
split_point,
|
split_point,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1535,10 +1518,8 @@ class FlightPlanBuilder:
|
|||||||
assert self.package.waypoints is not None
|
assert self.package.waypoints is not None
|
||||||
|
|
||||||
builder = WaypointBuilder(flight, self.coalition)
|
builder = WaypointBuilder(flight, self.coalition)
|
||||||
ingress, target, egress = builder.escort(
|
ingress, target = builder.escort(
|
||||||
self.package.waypoints.ingress,
|
self.package.waypoints.ingress, self.package.target
|
||||||
self.package.target,
|
|
||||||
self.package.waypoints.egress,
|
|
||||||
)
|
)
|
||||||
hold = builder.hold(self._hold_point(flight))
|
hold = builder.hold(self._hold_point(flight))
|
||||||
join = builder.join(self.package.waypoints.join)
|
join = builder.join(self.package.waypoints.join)
|
||||||
@ -1556,7 +1537,6 @@ class FlightPlanBuilder:
|
|||||||
join=join,
|
join=join,
|
||||||
ingress=ingress,
|
ingress=ingress,
|
||||||
targets=[target],
|
targets=[target],
|
||||||
egress=egress,
|
|
||||||
split=split,
|
split=split,
|
||||||
nav_from=builder.nav_path(
|
nav_from=builder.nav_path(
|
||||||
split.position, flight.arrival.position, self.doctrine.ingress_altitude
|
split.position, flight.arrival.position, self.doctrine.ingress_altitude
|
||||||
@ -1804,7 +1784,6 @@ class FlightPlanBuilder:
|
|||||||
ingress_type, self.package.waypoints.ingress, location
|
ingress_type, self.package.waypoints.ingress, location
|
||||||
),
|
),
|
||||||
targets=target_waypoints,
|
targets=target_waypoints,
|
||||||
egress=builder.egress(self.package.waypoints.egress, location),
|
|
||||||
split=split,
|
split=split,
|
||||||
nav_from=builder.nav_path(
|
nav_from=builder.nav_path(
|
||||||
split.position, flight.arrival.position, self.doctrine.ingress_altitude
|
split.position, flight.arrival.position, self.doctrine.ingress_altitude
|
||||||
@ -1848,7 +1827,7 @@ class FlightPlanBuilder:
|
|||||||
"""Returns the position of the rendezvous point.
|
"""Returns the position of the rendezvous point.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
attack_transition: The ingress or egress point for this rendezvous.
|
attack_transition: The ingress or target point for this rendezvous.
|
||||||
"""
|
"""
|
||||||
if self._rendezvous_should_retreat(attack_transition):
|
if self._rendezvous_should_retreat(attack_transition):
|
||||||
return self._retreating_rendezvous_point(attack_transition)
|
return self._retreating_rendezvous_point(attack_transition)
|
||||||
@ -1856,12 +1835,7 @@ class FlightPlanBuilder:
|
|||||||
|
|
||||||
def _ingress_point(self, heading: float) -> Point:
|
def _ingress_point(self, heading: float) -> Point:
|
||||||
return self.package.target.position.point_from_heading(
|
return self.package.target.position.point_from_heading(
|
||||||
heading - 180 + 15, self.doctrine.ingress_egress_distance.meters
|
heading - 180, self.doctrine.ingress_distance.meters
|
||||||
)
|
|
||||||
|
|
||||||
def _egress_point(self, heading: float) -> Point:
|
|
||||||
return self.package.target.position.point_from_heading(
|
|
||||||
heading - 180 - 15, self.doctrine.ingress_egress_distance.meters
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def _target_heading_to_package_airfield(self) -> float:
|
def _target_heading_to_package_airfield(self) -> float:
|
||||||
|
|||||||
@ -427,21 +427,18 @@ class WaypointBuilder:
|
|||||||
self,
|
self,
|
||||||
ingress: Point,
|
ingress: Point,
|
||||||
target: MissionTarget,
|
target: MissionTarget,
|
||||||
egress: Point,
|
) -> Tuple[FlightWaypoint, FlightWaypoint]:
|
||||||
) -> Tuple[FlightWaypoint, FlightWaypoint, FlightWaypoint]:
|
|
||||||
"""Creates the waypoints needed to escort the package.
|
"""Creates the waypoints needed to escort the package.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
ingress: The package ingress point.
|
ingress: The package ingress point.
|
||||||
target: The mission target.
|
target: The mission target.
|
||||||
egress: The package egress point.
|
|
||||||
"""
|
"""
|
||||||
# This would preferably be no points at all, and instead the Escort task
|
# This would preferably be no points at all, and instead the Escort task
|
||||||
# would begin on the join point and end on the split point, however the
|
# would begin on the join point and end on the split point, however the
|
||||||
# escort task does not appear to work properly (see the longer
|
# escort task does not appear to work properly (see the longer
|
||||||
# description in gen.aircraft.JoinPointBuilder), so instead we give
|
# description in gen.aircraft.JoinPointBuilder), so instead we give
|
||||||
# the escort flights a flight plan including the ingress point, target
|
# the escort flights a flight plan including the ingress point and target area.
|
||||||
# area, and egress point.
|
|
||||||
ingress_wp = self.ingress(FlightWaypointType.INGRESS_ESCORT, ingress, target)
|
ingress_wp = self.ingress(FlightWaypointType.INGRESS_ESCORT, ingress, target)
|
||||||
|
|
||||||
waypoint = FlightWaypoint(
|
waypoint = FlightWaypoint(
|
||||||
@ -455,9 +452,7 @@ class WaypointBuilder:
|
|||||||
waypoint.name = "TARGET"
|
waypoint.name = "TARGET"
|
||||||
waypoint.description = "Escort the package"
|
waypoint.description = "Escort the package"
|
||||||
waypoint.pretty_name = "Target area"
|
waypoint.pretty_name = "Target area"
|
||||||
|
return ingress_wp, waypoint
|
||||||
egress_wp = self.egress(egress, target)
|
|
||||||
return ingress_wp, waypoint, egress_wp
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def pickup(control_point: ControlPoint) -> FlightWaypoint:
|
def pickup(control_point: ControlPoint) -> FlightWaypoint:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user