mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Fine-tuning stuff for 'SEAD Sweep'
This commit is contained in:
parent
031feeed6f
commit
6c210c9d15
@ -19,7 +19,7 @@ if TYPE_CHECKING:
|
|||||||
@dataclass
|
@dataclass
|
||||||
class FormationLayout(LoiterLayout, ABC):
|
class FormationLayout(LoiterLayout, ABC):
|
||||||
nav_to: list[FlightWaypoint]
|
nav_to: list[FlightWaypoint]
|
||||||
join: FlightWaypoint
|
join: Optional[FlightWaypoint]
|
||||||
split: FlightWaypoint
|
split: FlightWaypoint
|
||||||
refuel: Optional[FlightWaypoint]
|
refuel: Optional[FlightWaypoint]
|
||||||
nav_from: list[FlightWaypoint]
|
nav_from: list[FlightWaypoint]
|
||||||
@ -73,10 +73,7 @@ class FormationFlightPlan(LoiterFlightPlan, ABC):
|
|||||||
return min(speeds)
|
return min(speeds)
|
||||||
|
|
||||||
def speed_between_waypoints(self, a: FlightWaypoint, b: FlightWaypoint) -> Speed:
|
def speed_between_waypoints(self, a: FlightWaypoint, b: FlightWaypoint) -> Speed:
|
||||||
if b in self.package_speed_waypoints:
|
if self.package.formation_speed and b in self.package_speed_waypoints:
|
||||||
# Should be impossible, as any package with at least one
|
|
||||||
# FormationFlightPlan flight needs a formation speed.
|
|
||||||
assert self.package.formation_speed is not None
|
|
||||||
return self.package.formation_speed
|
return self.package.formation_speed
|
||||||
return super().speed_between_waypoints(a, b)
|
return super().speed_between_waypoints(a, b)
|
||||||
|
|
||||||
|
|||||||
@ -111,9 +111,19 @@ class FormationAttackFlightPlan(FormationFlightPlan, ABC):
|
|||||||
)
|
)
|
||||||
return tot - travel_time
|
return tot - travel_time
|
||||||
|
|
||||||
|
@property
|
||||||
|
def initial_time(self) -> timedelta:
|
||||||
|
tot = self.tot
|
||||||
|
travel_time = self.travel_time_between_waypoints(
|
||||||
|
self.layout.initial, self.target_area_waypoint
|
||||||
|
)
|
||||||
|
return tot - travel_time
|
||||||
|
|
||||||
def tot_for_waypoint(self, waypoint: FlightWaypoint) -> timedelta | None:
|
def tot_for_waypoint(self, waypoint: FlightWaypoint) -> timedelta | None:
|
||||||
if waypoint == self.layout.ingress:
|
if waypoint == self.layout.ingress:
|
||||||
return self.ingress_time
|
return self.ingress_time
|
||||||
|
elif waypoint == self.layout.initial:
|
||||||
|
return self.initial_time
|
||||||
elif waypoint in self.layout.targets:
|
elif waypoint in self.layout.targets:
|
||||||
return self.tot
|
return self.tot
|
||||||
return super().tot_for_waypoint(waypoint)
|
return super().tot_for_waypoint(waypoint)
|
||||||
@ -127,9 +137,11 @@ class FormationAttackLayout(FormationLayout):
|
|||||||
|
|
||||||
def iter_waypoints(self) -> Iterator[FlightWaypoint]:
|
def iter_waypoints(self) -> Iterator[FlightWaypoint]:
|
||||||
yield self.departure
|
yield self.departure
|
||||||
yield self.hold
|
if self.hold:
|
||||||
|
yield self.hold
|
||||||
yield from self.nav_to
|
yield from self.nav_to
|
||||||
yield self.join
|
if self.join:
|
||||||
|
yield self.join
|
||||||
yield self.ingress
|
yield self.ingress
|
||||||
if self.initial is not None:
|
if self.initial is not None:
|
||||||
yield self.initial
|
yield self.initial
|
||||||
@ -170,8 +182,17 @@ class FormationAttackBuilder(IBuilder[FlightPlanT, LayoutT], ABC):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
hold = builder.hold(self._hold_point())
|
hold = None
|
||||||
join = builder.join(self.package.waypoints.join)
|
join = None
|
||||||
|
if (
|
||||||
|
self.flight is self.package.primary_flight
|
||||||
|
or self.package.primary_flight
|
||||||
|
and isinstance(
|
||||||
|
self.package.primary_flight.flight_plan, FormationAttackFlightPlan
|
||||||
|
)
|
||||||
|
):
|
||||||
|
hold = builder.hold(self._hold_point())
|
||||||
|
join = builder.join(self.package.waypoints.join)
|
||||||
split = builder.split(self.package.waypoints.split)
|
split = builder.split(self.package.waypoints.split)
|
||||||
refuel = builder.refuel(self.package.waypoints.refuel)
|
refuel = builder.refuel(self.package.waypoints.refuel)
|
||||||
|
|
||||||
@ -189,7 +210,9 @@ class FormationAttackBuilder(IBuilder[FlightPlanT, LayoutT], ABC):
|
|||||||
departure=builder.takeoff(self.flight.departure),
|
departure=builder.takeoff(self.flight.departure),
|
||||||
hold=hold,
|
hold=hold,
|
||||||
nav_to=builder.nav_path(
|
nav_to=builder.nav_path(
|
||||||
hold.position, join.position, self.doctrine.ingress_altitude
|
hold.position if hold else self.flight.departure.position,
|
||||||
|
join.position if join else ingress.position,
|
||||||
|
self.doctrine.ingress_altitude,
|
||||||
),
|
),
|
||||||
join=join,
|
join=join,
|
||||||
ingress=ingress,
|
ingress=ingress,
|
||||||
|
|||||||
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from typing import Any, TYPE_CHECKING, TypeGuard
|
from typing import Any, TYPE_CHECKING, TypeGuard, Optional
|
||||||
|
|
||||||
from game.typeguard import self_type_guard
|
from game.typeguard import self_type_guard
|
||||||
from .flightplan import FlightPlan
|
from .flightplan import FlightPlan
|
||||||
@ -15,7 +15,7 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class LoiterLayout(StandardLayout, ABC):
|
class LoiterLayout(StandardLayout, ABC):
|
||||||
hold: FlightWaypoint
|
hold: Optional[FlightWaypoint]
|
||||||
|
|
||||||
|
|
||||||
class LoiterFlightPlan(StandardFlightPlan[Any], ABC):
|
class LoiterFlightPlan(StandardFlightPlan[Any], ABC):
|
||||||
|
|||||||
@ -26,7 +26,8 @@ class SweepLayout(LoiterLayout):
|
|||||||
|
|
||||||
def iter_waypoints(self) -> Iterator[FlightWaypoint]:
|
def iter_waypoints(self) -> Iterator[FlightWaypoint]:
|
||||||
yield self.departure
|
yield self.departure
|
||||||
yield self.hold
|
if self.hold:
|
||||||
|
yield self.hold
|
||||||
yield from self.nav_to
|
yield from self.nav_to
|
||||||
yield self.sweep_start
|
yield self.sweep_start
|
||||||
yield self.sweep_end
|
yield self.sweep_end
|
||||||
|
|||||||
@ -458,7 +458,11 @@ class WaypointBuilder:
|
|||||||
assert self.flight.package.waypoints
|
assert self.flight.package.waypoints
|
||||||
ingress = self.flight.package.waypoints.ingress
|
ingress = self.flight.package.waypoints.ingress
|
||||||
ingress2tgt_dist = ingress.distance_to_point(target.position)
|
ingress2tgt_dist = ingress.distance_to_point(target.position)
|
||||||
threat_range = 1.1 * max([x.threat_range for x in target.strike_targets]).meters
|
threat_range = nautical_miles(5).meters
|
||||||
|
if target.strike_targets:
|
||||||
|
threat_range = (
|
||||||
|
1.1 * max([x.threat_range for x in target.strike_targets]).meters
|
||||||
|
)
|
||||||
hdg = target.position.heading_between_point(ingress)
|
hdg = target.position.heading_between_point(ingress)
|
||||||
hold = target.position.point_from_heading(
|
hold = target.position.point_from_heading(
|
||||||
hdg, min(threat_range, ingress2tgt_dist * 0.95)
|
hdg, min(threat_range, ingress2tgt_dist * 0.95)
|
||||||
|
|||||||
@ -176,6 +176,7 @@ class Package(RadioFrequencyContainer):
|
|||||||
FlightType.TRANSPORT,
|
FlightType.TRANSPORT,
|
||||||
FlightType.AIR_ASSAULT,
|
FlightType.AIR_ASSAULT,
|
||||||
FlightType.SEAD,
|
FlightType.SEAD,
|
||||||
|
FlightType.SEAD_SWEEP,
|
||||||
FlightType.TARCAP,
|
FlightType.TARCAP,
|
||||||
FlightType.BARCAP,
|
FlightType.BARCAP,
|
||||||
FlightType.AEWC,
|
FlightType.AEWC,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user