Added support for ground power truck types in farp_truck_types_for_country(). Aircraft which require ground power to start, when ground power trucks have been disabled for performance reasons, will now be warm started automatically.

This commit is contained in:
MetalStormGhost 2023-10-05 19:59:26 +03:00 committed by Raffson
parent d271428f9d
commit 1ebc289fb7
3 changed files with 50 additions and 7 deletions

View File

@ -20,6 +20,7 @@
* **[Autoplanner]** Support for auto-planning Air Assaults * **[Autoplanner]** Support for auto-planning Air Assaults
* **[UI]** Improved frequency selector to support all modeled bands for every aircraft's intra-flight radio * **[UI]** Improved frequency selector to support all modeled bands for every aircraft's intra-flight radio
* **[Options]** New options in Settings: Helicopter waypoint altitude (feet AGL) for combat & cruise waypoints * **[Options]** New options in Settings: Helicopter waypoint altitude (feet AGL) for combat & cruise waypoints
* **[Options]** New options in Settings: Spawn ground power trucks at ground starts in airbases/roadbases
## Fixes ## Fixes
* **[Mission Generation]** Anti-ship strikes should use "group attack" in their attack-task * **[Mission Generation]** Anti-ship strikes should use "group attack" in their attack-task

View File

@ -6,7 +6,16 @@ from dcs import Mission
from dcs.country import Country from dcs.country import Country
from dcs.mapping import Vector2, Point from dcs.mapping import Vector2, Point
from dcs.mission import StartType as DcsStartType from dcs.mission import StartType as DcsStartType
from dcs.planes import F_14A, Su_33 from dcs.planes import (
F_14A,
F_14A_135_GR,
F_14B,
F_5E_3,
F_86F_Sabre,
C_101CC,
Su_33,
MiG_15bis,
)
from dcs.point import PointAction from dcs.point import PointAction
from dcs.ships import KUZNECOW from dcs.ships import KUZNECOW
from dcs.terrain import NoParkingSlotError from dcs.terrain import NoParkingSlotError
@ -26,6 +35,7 @@ from game.missiongenerator.missiondata import MissionData
from game.naming import namegen from game.naming import namegen
from game.theater import Airfield, ControlPoint, Fob, NavalControlPoint, OffMapSpawn from game.theater import Airfield, ControlPoint, Fob, NavalControlPoint, OffMapSpawn
from game.utils import feet, meters from game.utils import feet, meters
from pydcs_extensions import A_4E_C
WARM_START_HELI_ALT = meters(500) WARM_START_HELI_ALT = meters(500)
WARM_START_ALTITUDE = meters(3000) WARM_START_ALTITUDE = meters(3000)
@ -360,11 +370,16 @@ class FlightGroupSpawner:
def _generate_at_cp_ground_spawn( def _generate_at_cp_ground_spawn(
self, name: str, cp: ControlPoint self, name: str, cp: ControlPoint
) -> Optional[FlyingGroup[Any]]: ) -> Optional[FlyingGroup[Any]]:
is_airbase = False
is_roadbase = False
try: try:
if len(self.ground_spawns_roadbase[cp]) > 0: if len(self.ground_spawns_roadbase[cp]) > 0:
ground_spawn = self.ground_spawns_roadbase[cp].pop() ground_spawn = self.ground_spawns_roadbase[cp].pop()
is_roadbase = True
else: else:
ground_spawn = self.ground_spawns[cp].pop() ground_spawn = self.ground_spawns[cp].pop()
is_airbase = True
except IndexError as ex: except IndexError as ex:
logging.warning("Not enough STOL slots available at " + str(ex)) logging.warning("Not enough STOL slots available at " + str(ex))
return None return None
@ -377,6 +392,24 @@ class FlightGroupSpawner:
group.points[0].type = "TakeOffGround" group.points[0].type = "TakeOffGround"
group.units[0].heading = ground_spawn[0].units[0].heading group.units[0].heading = ground_spawn[0].units[0].heading
# Hot start aircraft which require ground power to start, when ground power
# trucks have been disabled for performance reasons
ground_power_available = (
is_airbase
and self.flight.coalition.game.settings.ground_start_ground_power_trucks
) or (
is_roadbase
and self.flight.coalition.game.settings.ground_start_ground_power_trucks_roadbase
)
if self.start_type is not StartType.COLD or (
not ground_power_available
and self.flight.unit_type.dcs_unit_type
in [A_4E_C, F_5E_3, F_86F_Sabre, MiG_15bis, F_14A_135_GR, F_14B, C_101CC]
):
group.points[0].action = PointAction.FromGroundAreaHot
group.points[0].type = "TakeOffGroundHot"
try: try:
cp.coalition.game.scenery_clear_zones cp.coalition.game.scenery_clear_zones
except AttributeError: except AttributeError:

View File

@ -80,7 +80,7 @@ AA_CP_MIN_DISTANCE = 40000
def farp_truck_types_for_country( def farp_truck_types_for_country(
country_id: int, country_id: int,
) -> Tuple[Type[VehicleType], Type[VehicleType]]: ) -> Tuple[Type[VehicleType], Type[VehicleType], Type[VehicleType]]:
soviet_tankers: List[Type[VehicleType]] = [ soviet_tankers: List[Type[VehicleType]] = [
Unarmed.ATMZ_5, Unarmed.ATMZ_5,
Unarmed.ATZ_10, Unarmed.ATZ_10,
@ -107,6 +107,11 @@ def farp_truck_types_for_country(
us_trucks: List[Type[VehicleType]] = [Unarmed.M_818] us_trucks: List[Type[VehicleType]] = [Unarmed.M_818]
uk_trucks: List[Type[VehicleType]] = [Unarmed.Bedford_MWD] uk_trucks: List[Type[VehicleType]] = [Unarmed.Bedford_MWD]
ground_power_trucks: List[Type[VehicleType]] = [
Unarmed.Ural_4320_APA_5D,
Unarmed.ZiL_131_APA_80,
]
if country_id in [ if country_id in [
Abkhazia.id, Abkhazia.id,
Algeria.id, Algeria.id,
@ -230,7 +235,9 @@ def farp_truck_types_for_country(
tanker_type = random.choice(tanker_types) tanker_type = random.choice(tanker_types)
ammo_truck_type = random.choice(truck_types) ammo_truck_type = random.choice(truck_types)
return tanker_type, ammo_truck_type power_truck_type = random.choice(ground_power_trucks)
return tanker_type, ammo_truck_type, power_truck_type
class GroundObjectGenerator: class GroundObjectGenerator:
@ -913,8 +920,9 @@ class GroundSpawnRoadbaseGenerator:
self.ground_spawns_roadbase.append((sg, ground_spawn[1])) self.ground_spawns_roadbase.append((sg, ground_spawn[1]))
tanker_type, ammo_truck_type = farp_truck_types_for_country(country.id) tanker_type, ammo_truck_type, power_truck_type = farp_truck_types_for_country(
power_truck_type = Unarmed.Ural_4320_APA_5D country.id
)
# Generate ammo truck/farp and fuel truck/stack for each pad # Generate ammo truck/farp and fuel truck/stack for each pad
if self.game.settings.ground_start_trucks_roadbase: if self.game.settings.ground_start_trucks_roadbase:
@ -1029,8 +1037,9 @@ class GroundSpawnGenerator:
# tanker_type: Type[VehicleType] # tanker_type: Type[VehicleType]
# ammo_truck_type: Type[VehicleType] # ammo_truck_type: Type[VehicleType]
tanker_type, ammo_truck_type = farp_truck_types_for_country(country.id) tanker_type, ammo_truck_type, power_truck_type = farp_truck_types_for_country(
power_truck_type = Unarmed.Ural_4320_APA_5D country.id
)
# Generate a FARP Ammo and Fuel stack for each pad # Generate a FARP Ammo and Fuel stack for each pad
if self.game.settings.ground_start_trucks: if self.game.settings.ground_start_trucks: