mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
More accurate switch-wpt index for escort split-trigger
This commit is contained in:
parent
181f8583d5
commit
f548b27ac5
@ -95,6 +95,13 @@ class FlightType(Enum):
|
|||||||
FlightType.SEAD_SWEEP,
|
FlightType.SEAD_SWEEP,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_escort_type(self) -> bool:
|
||||||
|
return self in {
|
||||||
|
FlightType.ESCORT,
|
||||||
|
FlightType.SEAD_ESCORT
|
||||||
|
}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def entity_type(self) -> AirEntity:
|
def entity_type(self) -> AirEntity:
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -21,7 +21,6 @@ from dcs.task import (
|
|||||||
RunwayAttack,
|
RunwayAttack,
|
||||||
Transport,
|
Transport,
|
||||||
SEAD,
|
SEAD,
|
||||||
SwitchWaypoint,
|
|
||||||
OptJettisonEmptyTanks,
|
OptJettisonEmptyTanks,
|
||||||
MainTask,
|
MainTask,
|
||||||
PinpointStrike,
|
PinpointStrike,
|
||||||
@ -34,7 +33,6 @@ from game.ato import Flight, FlightType
|
|||||||
from game.ato.flightplans.aewc import AewcFlightPlan
|
from game.ato.flightplans.aewc import AewcFlightPlan
|
||||||
from game.ato.flightplans.packagerefueling import PackageRefuelingFlightPlan
|
from game.ato.flightplans.packagerefueling import PackageRefuelingFlightPlan
|
||||||
from game.ato.flightplans.theaterrefueling import TheaterRefuelingFlightPlan
|
from game.ato.flightplans.theaterrefueling import TheaterRefuelingFlightPlan
|
||||||
from game.ato.flightwaypointtype import FlightWaypointType
|
|
||||||
|
|
||||||
|
|
||||||
class AircraftBehavior:
|
class AircraftBehavior:
|
||||||
@ -285,32 +283,13 @@ class AircraftBehavior:
|
|||||||
)
|
)
|
||||||
|
|
||||||
def configure_escort(self, group: FlyingGroup[Any], flight: Flight) -> None:
|
def configure_escort(self, group: FlyingGroup[Any], flight: Flight) -> None:
|
||||||
# Escort groups are actually given the CAP task so they can perform the
|
|
||||||
# Search Then Engage task, which we have to use instead of the Escort
|
|
||||||
# task for the reasons explained in JoinPointBuilder.
|
|
||||||
self.configure_task(flight, group, Escort)
|
self.configure_task(flight, group, Escort)
|
||||||
if flight.flight_plan.is_formation(flight.flight_plan):
|
|
||||||
index = flight.flight_plan.get_index_of_wpt_by_type(
|
|
||||||
FlightWaypointType.SPLIT
|
|
||||||
)
|
|
||||||
if index > 0:
|
|
||||||
group.add_trigger_action(SwitchWaypoint(None, index))
|
|
||||||
else:
|
|
||||||
logging.warning(f"Couldn't determine SPLIT for {group.name}")
|
|
||||||
self.configure_behavior(
|
self.configure_behavior(
|
||||||
flight, group, roe=OptROE.Values.OpenFire, restrict_jettison=True
|
flight, group, roe=OptROE.Values.OpenFire, restrict_jettison=True
|
||||||
)
|
)
|
||||||
|
|
||||||
def configure_sead_escort(self, group: FlyingGroup[Any], flight: Flight) -> None:
|
def configure_sead_escort(self, group: FlyingGroup[Any], flight: Flight) -> None:
|
||||||
# CAS is able to perform all the same tasks as SEAD using a superset of the
|
|
||||||
# available aircraft, and F-14s are not able to be SEAD despite having TALDs.
|
|
||||||
# https://forums.eagle.ru/topic/272112-cannot-assign-f-14-to-sead/
|
|
||||||
self.configure_task(flight, group, SEAD)
|
self.configure_task(flight, group, SEAD)
|
||||||
index = flight.flight_plan.get_index_of_wpt_by_type(FlightWaypointType.SPLIT)
|
|
||||||
if index > 0 and flight.flight_plan.is_formation(flight.flight_plan):
|
|
||||||
group.add_trigger_action(SwitchWaypoint(None, index))
|
|
||||||
if index < 1:
|
|
||||||
logging.warning(f"Couldn't determine SPLIT for {group.name}")
|
|
||||||
self.configure_behavior(
|
self.configure_behavior(
|
||||||
flight,
|
flight,
|
||||||
group,
|
group,
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
from dcs.point import MovingPoint
|
from dcs.point import MovingPoint
|
||||||
from dcs.task import OptECMUsing, OptFormation, RunScript, SetUnlimitedFuelCommand
|
from dcs.task import OptECMUsing, OptFormation, RunScript, SetUnlimitedFuelCommand, SwitchWaypoint
|
||||||
|
|
||||||
from game.settings import Settings
|
|
||||||
|
|
||||||
from .pydcswaypointbuilder import PydcsWaypointBuilder
|
from .pydcswaypointbuilder import PydcsWaypointBuilder
|
||||||
|
|
||||||
@ -34,3 +32,6 @@ class SplitPointBuilder(PydcsWaypointBuilder):
|
|||||||
f'trigger.action.setUserFlag("split-{id(self.package)}", true)'
|
f'trigger.action.setUserFlag("split-{id(self.package)}", true)'
|
||||||
)
|
)
|
||||||
waypoint.tasks.append(script)
|
waypoint.tasks.append(script)
|
||||||
|
elif self.flight.flight_type.is_escort_type:
|
||||||
|
index = len(self.group.points)
|
||||||
|
self.group.add_trigger_action(SwitchWaypoint(None, index))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user