Convert OPFOR untasked flights into Client slots

Added a new option in settings: Convert untasked OPFOR aircraft into client slots. This option will essentially convert the campaign into a sort of team vs. team engagement. There is still no way to plan the OPFOR missions, and there are no guarantees that there even will be any untasked aircraft available for players.

Split the Disable idle aircraft at airfields setting into Disable untasked BLUFOR aircraft at airfields and Disable untasked OPFOR aircraft at airfields.
This commit is contained in:
MetalStormGhost 2023-08-05 15:50:01 +03:00 committed by Raffson
parent c51fa5c1df
commit 115bd8b22a
5 changed files with 56 additions and 8 deletions

View File

@ -5,6 +5,8 @@
* **[Modding]** Custom weapons injection system (definition in aircraft's yaml file)
* **[Payload Editor]** Ability to save/back-up payloads
* **[Options]** New option in Settings: CAS engagement range (nmi)
* **[Options]** New option in Settings: Convert untasked OPFOR aircraft into client slots
* **[Options]** Split the **Disable idle aircraft at airfields** setting into **Disable untasked BLUFOR aircraft at airfields** and **Disable untasked OPFOR aircraft at airfields**.
## Fixes
* **[Mission Generation]** Anti-ship strikes should use "group attack" in their attack-task

View File

@ -12,11 +12,12 @@ from dcs.country import Country
from dcs.mission import Mission
from dcs.terrain.terrain import NoParkingSlotError
from dcs.triggers import TriggerOnce, Event
from dcs.unit import Skill
from dcs.unitgroup import FlyingGroup, StaticGroup
from game.ato.airtaaskingorder import AirTaskingOrder
from game.ato.flight import Flight
from game.ato.flightstate import Completed
from game.ato.flightstate import Completed, WaitingForStart
from game.ato.flighttype import FlightType
from game.ato.package import Package
from game.ato.starttype import StartType
@ -178,6 +179,17 @@ class AircraftGenerator:
assert isinstance(squadron.location, Airfield) or isinstance(
squadron.location, Fob
)
if (
squadron.coalition.player
and self.game.settings.perf_disable_untasked_blufor_aircraft
):
return
elif (
not squadron.coalition.player
and self.game.settings.perf_disable_untasked_opfor_aircraft
):
return
for _ in range(squadron.untasked_aircraft):
# Creating a flight even those this isn't a fragged mission lets us
# reuse the existing debriefing code.
@ -203,6 +215,20 @@ class AircraftGenerator:
self.mission_data,
).create_idle_aircraft()
if group:
if (
not squadron.coalition.player
and squadron.aircraft.flyable
and (
self.game.settings.enable_squadron_pilot_limits
or squadron.number_of_available_pilots > 0
)
and self.game.settings.untasked_opfor_client_slots
):
flight.state = WaitingForStart(
flight, self.game.settings, self.game.conditions.start_time
)
group.uncontrolled = False
group.units[0].skill = Skill.Client
AircraftPainter(flight, group).apply_livery()
self.unit_map.add_aircraft(group, flight)

View File

@ -108,6 +108,11 @@ class FlightGroupSpawner:
name=namegen.next_aircraft_name(self.country, self.flight),
cp=self.flight.squadron.location,
)
elif isinstance(self.flight.squadron.location, Fob):
group = self._generate_at_cp_ground_spawn(
name=namegen.next_aircraft_name(self.country, self.flight),
cp=self.flight.squadron.location,
)
elif isinstance(self.flight.squadron.location, Airfield):
group = self._generate_at_airfield(
name=namegen.next_aircraft_name(self.country, self.flight),

View File

@ -259,11 +259,10 @@ class MissionGenerator:
self.game.red.ato,
tgo_generator.runways,
)
if not self.game.settings.perf_disable_idle_aircraft:
aircraft_generator.spawn_unused_aircraft(
self.p_country,
self.e_country,
)
aircraft_generator.spawn_unused_aircraft(
self.p_country,
self.e_country,
)
self.mission_data.flights = aircraft_generator.flights

View File

@ -589,6 +589,16 @@ class Settings:
"option only allows the player to wait on the ground.</strong>"
),
)
untasked_opfor_client_slots: bool = boolean_option(
"Convert untasked OPFOR aircraft into client slots",
page=MISSION_GENERATOR_PAGE,
section=GAMEPLAY_SECTION,
default=False,
detail=(
"Warning: Enabling this will significantly reduce the number of "
"targets available for OCA/Aircraft missions."
),
)
atflir_autoswap: bool = boolean_option(
"Auto-swap ATFLIR to LITENING",
MISSION_GENERATOR_PAGE,
@ -802,8 +812,14 @@ class Settings:
section=PERFORMANCE_SECTION,
default=True,
)
perf_disable_idle_aircraft: bool = boolean_option(
"Disable idle aircraft at airfields",
perf_disable_untasked_blufor_aircraft: bool = boolean_option(
"Disable untasked BLUFOR aircraft at airfields",
page=MISSION_GENERATOR_PAGE,
section=PERFORMANCE_SECTION,
default=False,
)
perf_disable_untasked_opfor_aircraft: bool = boolean_option(
"Disable untasked OPFOR aircraft at airfields",
page=MISSION_GENERATOR_PAGE,
section=PERFORMANCE_SECTION,
default=False,