mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Despawn aircraft returning to off-map CPs
This commit is contained in:
parent
e6e557c18a
commit
181f8583d5
@ -33,6 +33,7 @@
|
||||
* **[Options]** Option to enable unlimited fuel for AI (player and non-player flights)
|
||||
* **[Mission Generator]** F-15E Strike targets are automatically added as Mission Set 1
|
||||
* **[Mission Generator]** Set F-14's IP waypoint according to the flight-plan's ingress point
|
||||
* **[Mission Generator]** Automatically de-spawn aircraft when arrival/divert is an off-map spawn
|
||||
|
||||
## Fixes
|
||||
* **[Mission Generation]** Anti-ship strikes should use "group attack" in their attack-task
|
||||
|
||||
@ -6,13 +6,14 @@ from typing import Any, Iterable, Union
|
||||
from dcs import Mission
|
||||
from dcs.planes import AJS37, F_14A_135_GR, F_14B, JF_17, F_15ESE
|
||||
from dcs.point import MovingPoint, PointAction
|
||||
from dcs.task import RunScript
|
||||
from dcs.unitgroup import FlyingGroup
|
||||
|
||||
from game.ato import Flight, FlightWaypoint
|
||||
from game.ato.flightwaypointtype import FlightWaypointType
|
||||
from game.ato.traveltime import GroundSpeed
|
||||
from game.missiongenerator.missiondata import MissionData
|
||||
from game.theater import MissionTarget, TheaterUnit
|
||||
from game.theater import MissionTarget, TheaterUnit, OffMapSpawn
|
||||
|
||||
TARGET_WAYPOINTS = (
|
||||
FlightWaypointType.TARGET_GROUP_LOC,
|
||||
@ -81,7 +82,17 @@ class PydcsWaypointBuilder:
|
||||
return waypoint
|
||||
|
||||
def add_tasks(self, waypoint: MovingPoint) -> None:
|
||||
pass
|
||||
arrival = self.flight.arrival
|
||||
divert = self.flight.divert
|
||||
offmap = isinstance(arrival, OffMapSpawn) or isinstance(divert, OffMapSpawn)
|
||||
pos = waypoint.position
|
||||
if offmap and (arrival.position == pos or divert and divert.position == pos):
|
||||
waypoint.tasks.append(
|
||||
RunScript(
|
||||
f"local g = Group.getByName('{self.group.name}')\n"
|
||||
f"Group.destroy(g)"
|
||||
)
|
||||
)
|
||||
|
||||
def set_waypoint_tot(self, waypoint: MovingPoint, tot: datetime) -> None:
|
||||
self.waypoint.tot = tot
|
||||
|
||||
@ -1,12 +1,17 @@
|
||||
from dcs.point import MovingPoint
|
||||
from dcs.task import RefuelingTaskAction, ControlledTask
|
||||
|
||||
from game.theater import OffMapSpawn
|
||||
from .pydcswaypointbuilder import PydcsWaypointBuilder
|
||||
|
||||
|
||||
class RefuelPointBuilder(PydcsWaypointBuilder):
|
||||
def add_tasks(self, waypoint: MovingPoint) -> None:
|
||||
refuel = ControlledTask(RefuelingTaskAction())
|
||||
refuel.start_probability(10)
|
||||
waypoint.add_task(refuel)
|
||||
offmap = isinstance(self.flight.arrival, OffMapSpawn)
|
||||
if self.flight.divert:
|
||||
offmap |= isinstance(self.flight.divert, OffMapSpawn)
|
||||
if not offmap:
|
||||
refuel = ControlledTask(RefuelingTaskAction())
|
||||
refuel.start_probability(10)
|
||||
waypoint.add_task(refuel)
|
||||
return super().add_tasks(waypoint)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user