mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
This class does far too many things and the file is huge. Split it up into a few more classes.
36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
import logging
|
|
|
|
from dcs.point import MovingPoint
|
|
from dcs.task import EngageTargetsInZone, Targets
|
|
|
|
from game.theater import Airfield
|
|
from game.utils import nautical_miles
|
|
from .pydcswaypointbuilder import PydcsWaypointBuilder
|
|
|
|
|
|
class OcaAircraftIngressBuilder(PydcsWaypointBuilder):
|
|
def build(self) -> MovingPoint:
|
|
waypoint = super().build()
|
|
|
|
target = self.package.target
|
|
if not isinstance(target, Airfield):
|
|
logging.error(
|
|
"Unexpected target type for OCA Strike mission: %s",
|
|
target.__class__.__name__,
|
|
)
|
|
return waypoint
|
|
|
|
task = EngageTargetsInZone(
|
|
position=target.position,
|
|
# Al Dhafra is 4 nm across at most. Add a little wiggle room in case
|
|
# the airport position from DCS is not centered.
|
|
radius=int(nautical_miles(3).meters),
|
|
targets=[Targets.All.Air],
|
|
)
|
|
task.params["attackQtyLimit"] = False
|
|
task.params["directionEnabled"] = False
|
|
task.params["altitudeEnabled"] = False
|
|
task.params["groupAttack"] = True
|
|
waypoint.tasks.append(task)
|
|
return waypoint
|