mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
AI unlimited fuel initial implementation (#227)
* Unlimited fuel for AI flights. For player flights, included at startup, for AI flights with join/split, applied at join/split. * Unlimited fuel for AI flights. For player flights, included at startup, for AI flights with join/split, applied at join/split. * Corrected default value of ai_unlimited_fuel to False in configure_behavior * ai_unlimited_fuel : set argument based on setting and simplify activation section * AI Unlimited Fuel : enable at start, disable at racetrack start/join, enable at racetrack end/split * Correct typing : bool to Optional[bool] --------- Co-authored-by: tmz42 <thomas.monnzie@gmail.com>
This commit is contained in:
parent
5ca12373d8
commit
79b1d949ce
@ -30,6 +30,7 @@
|
|||||||
* **[COMMs]** Ability to set a specific callsign to a flight.
|
* **[COMMs]** Ability to set a specific callsign to a flight.
|
||||||
* **[Mission Generator]** Channel terrain fix on exclusion zones, sea zones and inclusion zones
|
* **[Mission Generator]** Channel terrain fix on exclusion zones, sea zones and inclusion zones
|
||||||
* **[Options]** Cheat-option for accessing Air Wing Config Dialog after campaign start
|
* **[Options]** Cheat-option for accessing Air Wing Config Dialog after campaign start
|
||||||
|
* **[Options]** Option to enable unlimited fuel for AI (player and non-player flights)
|
||||||
|
|
||||||
## 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
|
||||||
|
|||||||
@ -26,6 +26,7 @@ from dcs.task import (
|
|||||||
MainTask,
|
MainTask,
|
||||||
PinpointStrike,
|
PinpointStrike,
|
||||||
AFAC,
|
AFAC,
|
||||||
|
SetUnlimitedFuelCommand,
|
||||||
)
|
)
|
||||||
from dcs.unitgroup import FlyingGroup
|
from dcs.unitgroup import FlyingGroup
|
||||||
|
|
||||||
@ -93,8 +94,18 @@ class AircraftBehavior:
|
|||||||
restrict_jettison: Optional[bool] = None,
|
restrict_jettison: Optional[bool] = None,
|
||||||
mission_uses_gun: bool = True,
|
mission_uses_gun: bool = True,
|
||||||
rtb_on_bingo: bool = True,
|
rtb_on_bingo: bool = True,
|
||||||
|
ai_unlimited_fuel: Optional[bool] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
group.points[0].tasks.clear()
|
group.points[0].tasks.clear()
|
||||||
|
if ai_unlimited_fuel is None:
|
||||||
|
ai_unlimited_fuel = (
|
||||||
|
flight.squadron.coalition.game.settings.ai_unlimited_fuel
|
||||||
|
)
|
||||||
|
|
||||||
|
# Activate AI unlimited fuel for all flights at startup
|
||||||
|
if ai_unlimited_fuel:
|
||||||
|
group.points[0].tasks.append(SetUnlimitedFuelCommand(True))
|
||||||
|
|
||||||
group.points[0].tasks.append(OptReactOnThreat(react_on_threat))
|
group.points[0].tasks.append(OptReactOnThreat(react_on_threat))
|
||||||
if roe is not None:
|
if roe is not None:
|
||||||
group.points[0].tasks.append(OptROE(roe))
|
group.points[0].tasks.append(OptROE(roe))
|
||||||
|
|||||||
@ -9,16 +9,22 @@ from dcs.task import (
|
|||||||
OptFormation,
|
OptFormation,
|
||||||
Targets,
|
Targets,
|
||||||
OptROE,
|
OptROE,
|
||||||
|
SetUnlimitedFuelCommand,
|
||||||
)
|
)
|
||||||
|
|
||||||
from game.ato import FlightType
|
from game.ato import FlightType
|
||||||
from game.theater import NavalControlPoint
|
from game.theater import NavalControlPoint
|
||||||
from game.utils import nautical_miles, feet
|
from game.utils import nautical_miles, feet
|
||||||
|
from game.settings import Settings
|
||||||
from .pydcswaypointbuilder import PydcsWaypointBuilder
|
from .pydcswaypointbuilder import PydcsWaypointBuilder
|
||||||
|
|
||||||
|
|
||||||
class JoinPointBuilder(PydcsWaypointBuilder):
|
class JoinPointBuilder(PydcsWaypointBuilder):
|
||||||
def add_tasks(self, waypoint: MovingPoint) -> None:
|
def add_tasks(self, waypoint: MovingPoint) -> None:
|
||||||
|
# Unlimited fuel option : disable at join. Must be first option to work.
|
||||||
|
if self.flight.squadron.coalition.game.settings.ai_unlimited_fuel:
|
||||||
|
waypoint.tasks.insert(0, SetUnlimitedFuelCommand(False))
|
||||||
|
|
||||||
if self.flight.is_helo:
|
if self.flight.is_helo:
|
||||||
waypoint.tasks.append(OptFormation.rotary_wedge())
|
waypoint.tasks.append(OptFormation.rotary_wedge())
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -8,6 +8,7 @@ from dcs.task import (
|
|||||||
OrbitAction,
|
OrbitAction,
|
||||||
Tanker,
|
Tanker,
|
||||||
Targets,
|
Targets,
|
||||||
|
SetUnlimitedFuelCommand,
|
||||||
)
|
)
|
||||||
|
|
||||||
from game.ato import FlightType
|
from game.ato import FlightType
|
||||||
@ -20,6 +21,10 @@ class RaceTrackBuilder(PydcsWaypointBuilder):
|
|||||||
def add_tasks(self, waypoint: MovingPoint) -> None:
|
def add_tasks(self, waypoint: MovingPoint) -> None:
|
||||||
flight_plan = self.flight.flight_plan
|
flight_plan = self.flight.flight_plan
|
||||||
|
|
||||||
|
# Unlimited fuel option : disable at racetrack start. Must be first option to work.
|
||||||
|
if self.flight.squadron.coalition.game.settings.ai_unlimited_fuel:
|
||||||
|
waypoint.tasks.insert(0, SetUnlimitedFuelCommand(False))
|
||||||
|
|
||||||
if not isinstance(flight_plan, PatrollingFlightPlan):
|
if not isinstance(flight_plan, PatrollingFlightPlan):
|
||||||
flight_plan_type = flight_plan.__class__.__name__
|
flight_plan_type = flight_plan.__class__.__name__
|
||||||
logging.error(
|
logging.error(
|
||||||
|
|||||||
@ -1,12 +1,20 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from dcs.point import MovingPoint
|
from dcs.point import MovingPoint
|
||||||
|
from dcs.task import SetUnlimitedFuelCommand
|
||||||
|
|
||||||
from game.ato.flightplans.patrolling import PatrollingFlightPlan
|
from game.ato.flightplans.patrolling import PatrollingFlightPlan
|
||||||
from .pydcswaypointbuilder import PydcsWaypointBuilder
|
from .pydcswaypointbuilder import PydcsWaypointBuilder
|
||||||
|
|
||||||
|
|
||||||
class RaceTrackEndBuilder(PydcsWaypointBuilder):
|
class RaceTrackEndBuilder(PydcsWaypointBuilder):
|
||||||
|
def add_tasks(self, waypoint: MovingPoint) -> None:
|
||||||
|
flight_plan = self.flight.flight_plan
|
||||||
|
|
||||||
|
# Unlimited fuel option : enable at racetrack end. Must be first option to work.
|
||||||
|
if self.flight.squadron.coalition.game.settings.ai_unlimited_fuel:
|
||||||
|
waypoint.tasks.insert(0, SetUnlimitedFuelCommand(True))
|
||||||
|
|
||||||
def build(self) -> MovingPoint:
|
def build(self) -> MovingPoint:
|
||||||
waypoint = super().build()
|
waypoint = super().build()
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,17 @@
|
|||||||
from dcs.point import MovingPoint
|
from dcs.point import MovingPoint
|
||||||
from dcs.task import OptECMUsing, OptFormation, RunScript
|
from dcs.task import OptECMUsing, OptFormation, RunScript, SetUnlimitedFuelCommand
|
||||||
|
|
||||||
|
from game.settings import Settings
|
||||||
|
|
||||||
from .pydcswaypointbuilder import PydcsWaypointBuilder
|
from .pydcswaypointbuilder import PydcsWaypointBuilder
|
||||||
|
|
||||||
|
|
||||||
class SplitPointBuilder(PydcsWaypointBuilder):
|
class SplitPointBuilder(PydcsWaypointBuilder):
|
||||||
def add_tasks(self, waypoint: MovingPoint) -> None:
|
def add_tasks(self, waypoint: MovingPoint) -> None:
|
||||||
|
# Unlimited fuel option : enable at split. Must be first option to work.
|
||||||
|
if self.flight.squadron.coalition.game.settings.ai_unlimited_fuel:
|
||||||
|
waypoint.tasks.insert(0, SetUnlimitedFuelCommand(True))
|
||||||
|
|
||||||
if not self.flight.flight_type.is_air_to_air:
|
if not self.flight.flight_type.is_air_to_air:
|
||||||
# Capture any non A/A type to avoid issues with SPJs that use the primary radar such as the F/A-18C.
|
# Capture any non A/A type to avoid issues with SPJs that use the primary radar such as the F/A-18C.
|
||||||
# You can bully them with STT to not be able to fire radar guided missiles at you,
|
# You can bully them with STT to not be able to fire radar guided missiles at you,
|
||||||
|
|||||||
@ -822,6 +822,16 @@ class Settings:
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ai_unlimited_fuel: bool = boolean_option(
|
||||||
|
"AI flights have unlimited fuel",
|
||||||
|
MISSION_GENERATOR_PAGE,
|
||||||
|
GAMEPLAY_SECTION,
|
||||||
|
default=True,
|
||||||
|
detail=(
|
||||||
|
"AI aircraft have unlimited fuel applied at start, removed at join/racetrack start, and reapplied at split/racetrack end for applicable flights. "
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
# Performance
|
# Performance
|
||||||
perf_smoke_gen: bool = boolean_option(
|
perf_smoke_gen: bool = boolean_option(
|
||||||
"Smoke visual effect on the front line",
|
"Smoke visual effect on the front line",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user