From 211ec86e2ea689123709db3d83a9666e042b2330 Mon Sep 17 00:00:00 2001 From: zhexu14 <64713351+zhexu14@users.noreply.github.com> Date: Thu, 28 Dec 2023 09:04:16 +1100 Subject: [PATCH] Apache speed fix (#3315) This PR 1) introduces a cruise_speed parameter to the AircraftType class and uses it as an override for default TOT/Ground Speed calculations and 2) sets this for the AH64. The reason for this change is that air starts with the Apache at a speed >130kt seems to completely break the FCR, even if you subsequently slow down. In the development branch, Liberation sets the Apache to travel at 168kt, so any player air starting won't be able to use their FCR and it wouldn't be readily apparent as to why. In the longer run this parameter may also be useful for other aircraft e.g. to override the cruise speed to the most efficient etc. --- game/ato/traveltime.py | 3 +++ game/dcs/aircrafttype.py | 6 ++++++ resources/units/aircraft/AH-64D_BLK_II.yaml | 1 + 3 files changed, 10 insertions(+) diff --git a/game/ato/traveltime.py b/game/ato/traveltime.py index f71cd9dd..a56943ca 100644 --- a/game/ato/traveltime.py +++ b/game/ato/traveltime.py @@ -18,6 +18,9 @@ class GroundSpeed: # on fuel, but mission speed will be fast enough to keep the flight # safer. + if flight.squadron.aircraft.cruise_speed is not None: + return mach(flight.squadron.aircraft.cruise_speed.mach(), altitude) + # DCS's max speed is in kph at 0 MSL. max_speed = flight.unit_type.max_speed if max_speed > SPEED_OF_SOUND_AT_SEA_LEVEL: diff --git a/game/dcs/aircrafttype.py b/game/dcs/aircrafttype.py index 09a0f228..ff34d0de 100644 --- a/game/dcs/aircrafttype.py +++ b/game/dcs/aircrafttype.py @@ -182,6 +182,9 @@ class AircraftType(UnitType[Type[FlyingType]]): #: planner will consider this aircraft usable for a mission. max_mission_range: Distance + #: Speed used for TOT calculations + cruise_speed: Optional[Speed] + fuel_consumption: Optional[FuelConsumption] default_livery: Optional[str] @@ -495,6 +498,9 @@ class AircraftType(UnitType[Type[FlyingType]]): patrol_altitude=patrol_config.altitude, patrol_speed=patrol_config.speed, max_mission_range=mission_range, + cruise_speed=knots(data["cruise_speed_kt_indicated"]) + if "cruise_speed_kt_indicated" in data + else None, fuel_consumption=fuel_consumption, default_livery=data.get("default_livery"), intra_flight_radio=radio_config.intra_flight, diff --git a/resources/units/aircraft/AH-64D_BLK_II.yaml b/resources/units/aircraft/AH-64D_BLK_II.yaml index 4f84a175..15f87b71 100644 --- a/resources/units/aircraft/AH-64D_BLK_II.yaml +++ b/resources/units/aircraft/AH-64D_BLK_II.yaml @@ -19,6 +19,7 @@ manufacturer: Boeing origin: USA price: 20 role: Attack +cruise_speed_kt_indicated: 120 variants: AH-64D Apache Longbow: {} radios: