Files
dcs-retribution/game/missiongenerator/aircraft/waypoints/landingzone.py
Raffson 8ae63796cf Increase buffer around landing-zone
This aims to specifically tackle the issue where AI helicopters tend to crash into the depot of the pickup-zone
Resolves #138
2024-01-21 22:36:00 +01:00

22 lines
865 B
Python

from dcs.point import MovingPoint
from dcs.task import Land, RunScript
from .pydcswaypointbuilder import PydcsWaypointBuilder
class LandingZoneBuilder(PydcsWaypointBuilder):
def build(self) -> MovingPoint:
waypoint = super().build()
# Create a landing task, currently only for Helos!
# Calculate a landing point with a small buffer to prevent AI from landing
# directly at the static ammo depot and exploding
landing_point = waypoint.position.random_point_within(30, 20)
# Use Land Task with 30s duration for helos
waypoint.add_task(Land(landing_point, duration=30))
if waypoint.name == "DROPOFFZONE":
script = RunScript(
f'trigger.action.setUserFlag("split-{id(self.package)}", true)'
)
waypoint.tasks.append(script)
return waypoint