mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Use ingress/arrival for helicopter join/split wpts
This commit is contained in:
parent
fc467b62e0
commit
e5d199f20b
@ -39,6 +39,7 @@ class AirAssaultLayout(FormationAttackLayout):
|
||||
if self.pickup is not None:
|
||||
yield self.pickup
|
||||
yield from self.nav_to
|
||||
yield self.join
|
||||
yield self.ingress
|
||||
if self.drop_off is not None:
|
||||
yield self.drop_off
|
||||
@ -151,8 +152,8 @@ class Builder(FormationAttackBuilder[AirAssaultFlightPlan, AirAssaultLayout]):
|
||||
top3 = sorted(
|
||||
tgt.ctld_zones, key=lambda x: ingress.position.distance_to_point(x[0])
|
||||
)[:3]
|
||||
closest = random.choice(top3)
|
||||
drop_pos = closest[0].random_point_within(closest[1])
|
||||
pos, dist = random.choice(top3)
|
||||
drop_pos = pos.random_point_within(dist)
|
||||
else:
|
||||
heading = tgt.position.heading_between_point(ingress.position)
|
||||
drop_pos = tgt.position.point_from_heading(heading, 1200)
|
||||
@ -183,8 +184,8 @@ class Builder(FormationAttackBuilder[AirAssaultFlightPlan, AirAssaultLayout]):
|
||||
divert=builder.divert(self.flight.divert),
|
||||
bullseye=builder.bullseye(),
|
||||
hold=None,
|
||||
join=builder.join(pickup_position),
|
||||
split=builder.split(self.package.waypoints.split),
|
||||
join=builder.join(ingress.position),
|
||||
split=builder.split(self.flight.arrival.position),
|
||||
refuel=None,
|
||||
)
|
||||
|
||||
|
||||
@ -42,8 +42,8 @@ class AirliftLayout(StandardLayout):
|
||||
drop_off: FlightWaypoint | None
|
||||
# drop_off_zone will be used for player flights to create the CTLD stuff
|
||||
ctld_drop_off_zone: FlightWaypoint | None
|
||||
return_ascent: FlightWaypoint | None
|
||||
return_descent: FlightWaypoint | None
|
||||
return_ascent: FlightWaypoint
|
||||
return_descent: FlightWaypoint
|
||||
|
||||
def add_waypoint(
|
||||
self, wpt: FlightWaypoint, next_wpt: Optional[FlightWaypoint]
|
||||
@ -83,13 +83,11 @@ class AirliftLayout(StandardLayout):
|
||||
yield self.drop_off_descent
|
||||
if self.drop_off is not None:
|
||||
yield self.drop_off
|
||||
if self.return_ascent is not None:
|
||||
yield self.return_ascent
|
||||
yield self.return_ascent
|
||||
if self.ctld_drop_off_zone is not None:
|
||||
yield self.ctld_drop_off_zone
|
||||
yield from self.nav_from
|
||||
if self.return_descent is not None:
|
||||
yield self.return_descent
|
||||
yield self.return_descent
|
||||
yield self.arrival
|
||||
if self.divert is not None:
|
||||
yield self.divert
|
||||
|
||||
@ -44,16 +44,17 @@ class Builder(FormationAttackBuilder[EscortFlightPlan, FormationAttackLayout]):
|
||||
ingress.only_for_player = True
|
||||
target.only_for_player = True
|
||||
hold = None
|
||||
if not self.primary_flight_is_air_assault:
|
||||
if not self.flight.is_helo:
|
||||
hold = builder.hold(self._hold_point())
|
||||
elif self.package.primary_flight is not None:
|
||||
fp = self.package.primary_flight.flight_plan
|
||||
assert isinstance(fp.layout, AirAssaultLayout)
|
||||
if fp.layout.pickup:
|
||||
hold = builder.hold(fp.layout.pickup.position)
|
||||
|
||||
join = builder.join(self.package.waypoints.join)
|
||||
split = builder.split(self.package.waypoints.split)
|
||||
join_pos = (
|
||||
self.package.waypoints.ingress
|
||||
if self.flight.is_helo
|
||||
else self.package.waypoints.join
|
||||
)
|
||||
join = builder.join(join_pos)
|
||||
|
||||
split = builder.split(self._get_split())
|
||||
|
||||
ingress_alt = self.doctrine.ingress_altitude
|
||||
is_helo = builder.flight.is_helo
|
||||
@ -70,11 +71,13 @@ class Builder(FormationAttackBuilder[EscortFlightPlan, FormationAttackLayout]):
|
||||
layout, AirliftLayout
|
||||
)
|
||||
if isinstance(layout, AirliftLayout):
|
||||
join = builder.join(layout.departure.position)
|
||||
ascent = layout.pickup_ascent or layout.drop_off_ascent
|
||||
assert ascent is not None
|
||||
join = builder.join(ascent.position)
|
||||
else:
|
||||
join = builder.join(layout.ingress.position)
|
||||
if layout.pickup:
|
||||
join = builder.join(layout.pickup.position)
|
||||
if layout.pickup and layout.drop_off_ascent:
|
||||
join = builder.join(layout.drop_off_ascent.position)
|
||||
split = builder.split(layout.arrival.position)
|
||||
if layout.drop_off:
|
||||
initial = builder.escort_hold(
|
||||
|
||||
@ -17,7 +17,7 @@ if TYPE_CHECKING:
|
||||
|
||||
@dataclass
|
||||
class FormationLayout(LoiterLayout, ABC):
|
||||
join: Optional[FlightWaypoint]
|
||||
join: FlightWaypoint
|
||||
split: FlightWaypoint
|
||||
refuel: Optional[FlightWaypoint]
|
||||
|
||||
|
||||
@ -142,8 +142,7 @@ class FormationAttackLayout(FormationLayout):
|
||||
if self.hold:
|
||||
yield self.hold
|
||||
yield from self.nav_to
|
||||
if self.join:
|
||||
yield self.join
|
||||
yield self.join
|
||||
if self.lineup:
|
||||
yield self.lineup
|
||||
yield self.ingress
|
||||
@ -187,11 +186,13 @@ class FormationAttackBuilder(IBuilder[FlightPlanT, LayoutT], ABC):
|
||||
)
|
||||
|
||||
hold = None
|
||||
join = None
|
||||
if not self.primary_flight_is_air_assault:
|
||||
if not self.flight.is_helo:
|
||||
hold = builder.hold(self._hold_point())
|
||||
join = builder.join(self.package.waypoints.join)
|
||||
split = builder.split(self.package.waypoints.split)
|
||||
join_pos = self.package.waypoints.join
|
||||
if self.flight.is_helo:
|
||||
join_pos = self.package.waypoints.ingress
|
||||
join = builder.join(join_pos)
|
||||
split = builder.split(self._get_split())
|
||||
refuel = self._build_refuel(builder)
|
||||
|
||||
ingress = builder.ingress(
|
||||
@ -299,3 +300,13 @@ class FormationAttackBuilder(IBuilder[FlightPlanT, LayoutT], ABC):
|
||||
return HoldZoneGeometry(
|
||||
target, origin, ip, join, self.coalition, self.theater
|
||||
).find_best_hold_point()
|
||||
|
||||
def _get_split(self) -> Point:
|
||||
assert self.package.waypoints is not None
|
||||
assert self.package.primary_flight is not None
|
||||
split_pos = (
|
||||
self.package.primary_flight.arrival.position
|
||||
if self.package.primary_flight.is_helo
|
||||
else self.package.waypoints.split
|
||||
)
|
||||
return split_pos
|
||||
|
||||
@ -11,7 +11,8 @@ from .pydcswaypointbuilder import PydcsWaypointBuilder
|
||||
class BaiIngressBuilder(PydcsWaypointBuilder):
|
||||
def add_tasks(self, waypoint: MovingPoint) -> None:
|
||||
self.register_special_ingress_points()
|
||||
waypoint.tasks.append(OptFormation.trail_open())
|
||||
if not self.flight.is_helo:
|
||||
waypoint.tasks.append(OptFormation.trail_open())
|
||||
# TODO: Add common "UnitGroupTarget" base type.
|
||||
group_names = []
|
||||
target = self.package.target
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user