Attempt at fixing too slow helicopter speeds

This commit is contained in:
Raffson 2024-07-21 02:21:51 +02:00
parent f405ffdfe2
commit e9d0273056
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99
7 changed files with 12 additions and 44 deletions

View File

@ -65,7 +65,7 @@ class AirAssaultFlightPlan(FormationAttackFlightPlan, UiZoneDisplay):
def tot_waypoint(self) -> FlightWaypoint: def tot_waypoint(self) -> FlightWaypoint:
if self.flight.is_helo and self.layout.drop_off is not None: if self.flight.is_helo and self.layout.drop_off is not None:
return self.layout.drop_off return self.layout.drop_off
return self.layout.targets[0] return self.target_area_waypoint
@property @property
def ingress_time(self) -> datetime: def ingress_time(self) -> datetime:
@ -75,13 +75,6 @@ class AirAssaultFlightPlan(FormationAttackFlightPlan, UiZoneDisplay):
) )
return tot - travel_time return tot - travel_time
def tot_for_waypoint(self, waypoint: FlightWaypoint) -> datetime | None:
if waypoint is self.tot_waypoint:
return self.tot
elif waypoint is self.layout.ingress:
return self.ingress_time
return None
def depart_time_for_waypoint(self, waypoint: FlightWaypoint) -> datetime | None: def depart_time_for_waypoint(self, waypoint: FlightWaypoint) -> datetime | None:
return None return None
@ -89,10 +82,6 @@ class AirAssaultFlightPlan(FormationAttackFlightPlan, UiZoneDisplay):
def ctld_target_zone_radius(self) -> Distance: def ctld_target_zone_radius(self) -> Distance:
return meters(2500) return meters(2500)
@property
def mission_begin_on_station_time(self) -> datetime | None:
return None
@property @property
def mission_departure_time(self) -> datetime: def mission_departure_time(self) -> datetime:
return self.package.time_over_target return self.package.time_over_target

View File

@ -59,8 +59,6 @@ class Builder(FormationAttackBuilder[EscortFlightPlan, FormationAttackLayout]):
join = builder.join(ascent.position) join = builder.join(ascent.position)
if layout.pickup and layout.drop_off_ascent: if layout.pickup and layout.drop_off_ascent:
join = builder.join(layout.drop_off_ascent.position) join = builder.join(layout.drop_off_ascent.position)
elif layout.pickup:
join = builder.join(layout.pickup.position)
split = builder.split(layout.arrival.position) split = builder.split(layout.arrival.position)
if layout.drop_off: if layout.drop_off:
initial = builder.escort_hold( initial = builder.escort_hold(

View File

@ -105,19 +105,6 @@ class FlightPlan(ABC, Generic[LayoutT]):
# #
# Plus, it's a loiter point so there's no reason to hurry. # Plus, it's a loiter point so there's no reason to hurry.
factor = 0.75 factor = 0.75
elif (
self.flight.is_helo
and (
a.waypoint_type == FlightWaypointType.JOIN
or "INGRESS" in a.waypoint_type.name
or a.waypoint_type == FlightWaypointType.CUSTOM
)
and self.package.primary_flight
and not self.package.primary_flight.flight_plan.is_airassault
):
# Helicopter flights should be slowed down between JOIN & INGRESS
# to allow the escort to keep up while engaging targets along the way.
factor = 0.50
# TODO: Adjust if AGL. # TODO: Adjust if AGL.
# We don't have an exact heightmap, but we should probably be performing # We don't have an exact heightmap, but we should probably be performing
# *some* adjustment for NTTR since the minimum altitude of the map is # *some* adjustment for NTTR since the minimum altitude of the map is

View File

@ -64,8 +64,10 @@ 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 self.package.formation_speed and b in self.package_speed_waypoints: if (
return self.package.formation_speed speed := self.package.formation_speed(self.flight.is_helo)
) and b in self.package_speed_waypoints:
return speed
return super().speed_between_waypoints(a, b) return super().speed_between_waypoints(a, b)
@property @property

View File

@ -11,7 +11,7 @@ from dcs import Point
from game.flightplan import HoldZoneGeometry from game.flightplan import HoldZoneGeometry
from game.theater import MissionTarget from game.theater import MissionTarget
from game.utils import Speed, meters, nautical_miles from game.utils import meters, nautical_miles
from .flightplan import FlightPlan from .flightplan import FlightPlan
from .formation import FormationFlightPlan, FormationLayout from .formation import FormationFlightPlan, FormationLayout
from .ibuilder import IBuilder from .ibuilder import IBuilder
@ -33,16 +33,6 @@ class FormationAttackFlightPlan(FormationFlightPlan, ABC):
self.layout.split, self.layout.split,
} | set(self.layout.targets) } | set(self.layout.targets)
def speed_between_waypoints(self, a: FlightWaypoint, b: FlightWaypoint) -> Speed:
# FlightWaypoint is only comparable by identity, so adding
# target_area_waypoint to package_speed_waypoints is useless.
if b.waypoint_type == FlightWaypointType.TARGET_GROUP_LOC:
# 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 super().speed_between_waypoints(a, b)
@property @property
def tot_waypoint(self) -> FlightWaypoint: def tot_waypoint(self) -> FlightWaypoint:
return self.layout.targets[0] return self.layout.targets[0]

View File

@ -54,8 +54,7 @@ class Package(RadioFrequencyContainer):
def has_players(self) -> bool: def has_players(self) -> bool:
return any(flight.client_count for flight in self.flights) return any(flight.client_count for flight in self.flights)
@property def formation_speed(self, is_helo: bool) -> Optional[Speed]:
def formation_speed(self) -> Optional[Speed]:
"""The speed of the package when in formation. """The speed of the package when in formation.
If none of the flights in the package will join a formation, this If none of the flights in the package will join a formation, this
@ -66,7 +65,10 @@ class Package(RadioFrequencyContainer):
""" """
speeds = [] speeds = []
for flight in self.flights: for flight in self.flights:
if isinstance(flight.flight_plan, FormationFlightPlan): if (
isinstance(flight.flight_plan, FormationFlightPlan)
and flight.is_helo == is_helo
):
speeds.append(flight.flight_plan.best_flight_formation_speed) speeds.append(flight.flight_plan.best_flight_formation_speed)
if not speeds: if not speeds:
return None return None

View File

@ -30,7 +30,7 @@ class GroundSpeed:
# as it can at sea level. This probably isn't great assumption, but # as it can at sea level. This probably isn't great assumption, but
# might. be sufficient given the wiggle room. We can come up with # might. be sufficient given the wiggle room. We can come up with
# another heuristic if needed. # another heuristic if needed.
cruise_mach = max_speed.mach() * (0.60 if flight.is_helo else 0.85) cruise_mach = max_speed.mach() * (0.7 if flight.is_helo else 0.85)
return mach(cruise_mach, altitude if not flight.is_helo else meters(0)) return mach(cruise_mach, altitude if not flight.is_helo else meters(0))