Auto-ato AWACS & Tankers settings (#198)

* Auto-ato AWACS & Tankers settings

Split off the **Automatic AWACS package planning** and **Automatic Theater tanker package planning** settings from **Automatic package planning behavior** so players can choose to have AWACS and theater tankers auto-planned, while managing everything else themselves.

* Drop logic to child-classes

* Enable AWACS auto-planning by default

* Switch order of preconditions

---------

Co-authored-by: Raffson <Raffson@users.noreply.github.com>
This commit is contained in:
MetalStormGhost 2023-08-12 22:09:19 +03:00 committed by GitHub
parent 046dccc4d5
commit 7a9a8e1b4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 10 deletions

View File

@ -7,6 +7,7 @@
* **[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**.
* **[Options]** Split off the **Automatic AWACS package planning** and **Automatic Theater tanker package planning** settings from **Automatic package planning behavior** so players can choose to have AWACS and theater tankers auto-planned, while managing everything else themselves.
* **[Modding]** Updated support for Su-30 mod to V2.1.12 beta
* **[Modding]** Updated support for Su-57 mod to build-04

View File

@ -11,6 +11,11 @@ from game.theater import MissionTarget
@dataclass
class PlanAewc(PackagePlanningTask[MissionTarget]):
def preconditions_met(self, state: TheaterState) -> bool:
if (
state.context.coalition.player
and not state.context.settings.auto_ato_behavior_awacs
):
return False
if not super().preconditions_met(state):
return False
return self.target in state.aewc_targets

View File

@ -11,6 +11,11 @@ from game.theater import MissionTarget
@dataclass
class PlanRefueling(PackagePlanningTask[MissionTarget]):
def preconditions_met(self, state: TheaterState) -> bool:
if (
state.context.coalition.player
and not state.context.settings.auto_ato_behavior_tankers
):
return False
if not super().preconditions_met(state):
return False
return self.target in state.refueling_targets

View File

@ -198,40 +198,40 @@ class Settings:
),
)
autoplan_tankers_for_strike: bool = boolean_option(
"Autoplanner plans refueling flights for Strike packages",
"Auto-planner plans refueling flights for Strike packages",
page=CAMPAIGN_DOCTRINE_PAGE,
section=GENERAL_SECTION,
default=True,
invert=False,
detail=(
"If checked, the autoplanner will include tankers in Strike packages, "
"If checked, the auto-planner will include tankers in Strike packages, "
"provided the faction has access to them."
),
)
autoplan_tankers_for_oca: bool = boolean_option(
"Autoplanner plans refueling flights for OCA packages",
"Auto-planner plans refueling flights for OCA packages",
page=CAMPAIGN_DOCTRINE_PAGE,
section=GENERAL_SECTION,
default=True,
invert=False,
detail=(
"If checked, the autoplanner will include tankers in OCA packages, "
"If checked, the auto-planner will include tankers in OCA packages, "
"provided the faction has access to them."
),
)
autoplan_tankers_for_dead: bool = boolean_option(
"Autoplanner plans refueling flights for DEAD packages",
"Auto-planner plans refueling flights for DEAD packages",
page=CAMPAIGN_DOCTRINE_PAGE,
section=GENERAL_SECTION,
default=True,
invert=False,
detail=(
"If checked, the autoplanner will include tankers in DEAD packages, "
"If checked, the auto-planner will include tankers in DEAD packages, "
"provided the faction has access to them."
),
)
oca_target_autoplanner_min_aircraft_count: int = bounded_int_option(
"Minimum number of aircraft (at vulnerable airfields) for autoplanner to plan OCA packages against",
"Minimum number of aircraft (at vulnerable airfields) for auto-planner to plan OCA packages against",
page=CAMPAIGN_DOCTRINE_PAGE,
section=GENERAL_SECTION,
default=20,
@ -239,11 +239,11 @@ class Settings:
max=100,
detail=(
"How many aircraft there has to be at an airfield for "
"the autoplanner to plan an OCA strike against it."
"the auto-planner to plan an OCA strike against it."
),
)
opfor_autoplanner_aggressiveness: int = bounded_int_option(
"OPFOR autoplanner aggressiveness (%)",
"OPFOR auto-planner aggressiveness (%)",
page=CAMPAIGN_DOCTRINE_PAGE,
section=GENERAL_SECTION,
default=20,
@ -251,7 +251,7 @@ class Settings:
max=100,
detail=(
"Chance (larger number -> higher chance) that the OPFOR AI "
"autoplanner will take risks and plan flights against targets "
"auto-planner will take risks and plan flights against targets "
"within threatened airspace."
),
)
@ -425,6 +425,18 @@ class Settings:
"auto-planning disables auto-purchase."
),
)
auto_ato_behavior_awacs: bool = boolean_option(
"Automatic AWACS package planning",
CAMPAIGN_MANAGEMENT_PAGE,
HQ_AUTOMATION_SECTION,
default=True,
)
auto_ato_behavior_tankers: bool = boolean_option(
"Automatic Theater tanker package planning",
CAMPAIGN_MANAGEMENT_PAGE,
HQ_AUTOMATION_SECTION,
default=False,
)
auto_ato_player_missions_asap: bool = boolean_option(
"Automatically generated packages with players are scheduled ASAP",
CAMPAIGN_MANAGEMENT_PAGE,