mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Cleanup and reword refuel waypoints
- rename Stopover back to CargoStop - precise some waypoint naming
This commit is contained in:
parent
4f9719abc4
commit
a47cb865fb
@ -111,7 +111,7 @@ class Builder(IBuilder[AirAssaultFlightPlan, AirAssaultLayout]):
|
|||||||
altitude_is_agl,
|
altitude_is_agl,
|
||||||
),
|
),
|
||||||
drop_off=builder.drop_off(drop_off_zone),
|
drop_off=builder.drop_off(drop_off_zone),
|
||||||
stopover=None,
|
refuel=None,
|
||||||
target=assault_area,
|
target=assault_area,
|
||||||
nav_to_home=builder.nav_path(
|
nav_to_home=builder.nav_path(
|
||||||
drop_off_zone.position,
|
drop_off_zone.position,
|
||||||
|
|||||||
@ -22,7 +22,7 @@ class AirliftLayout(StandardLayout):
|
|||||||
pickup: FlightWaypoint | None
|
pickup: FlightWaypoint | None
|
||||||
nav_to_drop_off: list[FlightWaypoint]
|
nav_to_drop_off: list[FlightWaypoint]
|
||||||
drop_off: FlightWaypoint
|
drop_off: FlightWaypoint
|
||||||
stopover: FlightWaypoint | None
|
refuel: FlightWaypoint | None
|
||||||
nav_to_home: list[FlightWaypoint]
|
nav_to_home: list[FlightWaypoint]
|
||||||
|
|
||||||
def iter_waypoints(self) -> Iterator[FlightWaypoint]:
|
def iter_waypoints(self) -> Iterator[FlightWaypoint]:
|
||||||
@ -32,8 +32,8 @@ class AirliftLayout(StandardLayout):
|
|||||||
yield self.pickup
|
yield self.pickup
|
||||||
yield from self.nav_to_drop_off
|
yield from self.nav_to_drop_off
|
||||||
yield self.drop_off
|
yield self.drop_off
|
||||||
if self.stopover is not None:
|
if self.refuel is not None:
|
||||||
yield self.stopover
|
yield self.refuel
|
||||||
yield from self.nav_to_home
|
yield from self.nav_to_home
|
||||||
yield self.arrival
|
yield self.arrival
|
||||||
if self.divert is not None:
|
if self.divert is not None:
|
||||||
@ -77,7 +77,7 @@ class Builder(IBuilder[AirliftFlightPlan, AirliftLayout]):
|
|||||||
builder = WaypointBuilder(self.flight, self.coalition)
|
builder = WaypointBuilder(self.flight, self.coalition)
|
||||||
|
|
||||||
pickup = None
|
pickup = None
|
||||||
stopover = None
|
refuel = None
|
||||||
if self.flight.is_helo:
|
if self.flight.is_helo:
|
||||||
# Create a pickupzone where the cargo will be spawned
|
# Create a pickupzone where the cargo will be spawned
|
||||||
pickup_zone = MissionTarget(
|
pickup_zone = MissionTarget(
|
||||||
@ -96,12 +96,12 @@ class Builder(IBuilder[AirliftFlightPlan, AirliftLayout]):
|
|||||||
drop_off = builder.drop_off(drop_off_zone)
|
drop_off = builder.drop_off(drop_off_zone)
|
||||||
|
|
||||||
# Add an additional stopover point so that the flight can refuel
|
# Add an additional stopover point so that the flight can refuel
|
||||||
stopover = builder.stopover(cargo.next_stop)
|
refuel = builder.land_refuel(cargo.next_stop)
|
||||||
else:
|
else:
|
||||||
# Fixed Wing will get stopover points for pickup and dropoff
|
# Fixed Wing will get stopover points for pickup and dropoff
|
||||||
if cargo.origin != self.flight.departure:
|
if cargo.origin != self.flight.departure:
|
||||||
pickup = builder.stopover(cargo.origin, "PICKUP")
|
pickup = builder.land_refuel(cargo.origin)
|
||||||
drop_off = builder.stopover(cargo.next_stop, "DROP OFF")
|
drop_off = builder.land_refuel(cargo.next_stop)
|
||||||
|
|
||||||
nav_to_pickup = builder.nav_path(
|
nav_to_pickup = builder.nav_path(
|
||||||
self.flight.departure.position,
|
self.flight.departure.position,
|
||||||
@ -118,7 +118,7 @@ class Builder(IBuilder[AirliftFlightPlan, AirliftLayout]):
|
|||||||
# base. Otherwise the Cargo drop will be the new Landing Waypoint and the
|
# base. Otherwise the Cargo drop will be the new Landing Waypoint and the
|
||||||
# AI will end its mission there instead of flying back.
|
# AI will end its mission there instead of flying back.
|
||||||
# https://forum.dcs.world/topic/211775-landing-to-refuel-and-rearm-the-landingrefuar-waypoint/
|
# https://forum.dcs.world/topic/211775-landing-to-refuel-and-rearm-the-landingrefuar-waypoint/
|
||||||
arrival = builder.stopover(self.flight.arrival, "LANDING")
|
arrival = builder.land_refuel(self.flight.arrival, True)
|
||||||
|
|
||||||
return AirliftLayout(
|
return AirliftLayout(
|
||||||
departure=builder.takeoff(self.flight.departure),
|
departure=builder.takeoff(self.flight.departure),
|
||||||
@ -131,7 +131,7 @@ class Builder(IBuilder[AirliftFlightPlan, AirliftLayout]):
|
|||||||
altitude_is_agl,
|
altitude_is_agl,
|
||||||
),
|
),
|
||||||
drop_off=drop_off,
|
drop_off=drop_off,
|
||||||
stopover=stopover,
|
refuel=refuel,
|
||||||
nav_to_home=builder.nav_path(
|
nav_to_home=builder.nav_path(
|
||||||
cargo.origin.position,
|
cargo.origin.position,
|
||||||
self.flight.arrival.position,
|
self.flight.arrival.position,
|
||||||
|
|||||||
@ -494,21 +494,35 @@ class WaypointBuilder:
|
|||||||
)
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def stopover(stopover: ControlPoint, name: str = "STOPOVER") -> FlightWaypoint:
|
def land_refuel(
|
||||||
"""Creates a stopover waypoint.
|
control_point: ControlPoint, is_destination: bool = False
|
||||||
|
) -> FlightWaypoint:
|
||||||
|
"""Creates a land refuel waypoint.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
control_point: Pick up location.
|
control_point: The airbase to refuel.
|
||||||
|
is_destination: Due to an DCS Bug we need to set the last landing waypoint also as LandingReFuAr
|
||||||
"""
|
"""
|
||||||
|
if is_destination:
|
||||||
|
return FlightWaypoint(
|
||||||
|
"LANDING",
|
||||||
|
FlightWaypointType.LAND_REFUEL,
|
||||||
|
control_point.position,
|
||||||
|
meters(0),
|
||||||
|
"RADIO",
|
||||||
|
description=f"Land at {control_point}",
|
||||||
|
pretty_name="Landing",
|
||||||
|
control_point=control_point,
|
||||||
|
)
|
||||||
return FlightWaypoint(
|
return FlightWaypoint(
|
||||||
name,
|
"REFUEL",
|
||||||
FlightWaypointType.STOPOVER,
|
FlightWaypointType.LAND_REFUEL,
|
||||||
stopover.position,
|
control_point.position,
|
||||||
meters(0),
|
meters(0),
|
||||||
"RADIO",
|
"RADIO",
|
||||||
description=f"Stopover at {stopover}",
|
description=f"Refuel at {control_point}",
|
||||||
pretty_name="Stopover location",
|
pretty_name="Refuel",
|
||||||
control_point=stopover,
|
control_point=control_point,
|
||||||
)
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
@ -47,4 +47,4 @@ class FlightWaypointType(IntEnum):
|
|||||||
DROP_OFF = 27
|
DROP_OFF = 27
|
||||||
BULLSEYE = 28
|
BULLSEYE = 28
|
||||||
REFUEL = 29 # Should look for nearby tanker to refuel from.
|
REFUEL = 29 # Should look for nearby tanker to refuel from.
|
||||||
STOPOVER = 30 # Stopover landing point using the LandingReFuAr waypoint type
|
CARGO_STOP = 30 # Stopover landing point using the LandingReFuAr waypoint type
|
||||||
|
|||||||
@ -1,9 +1,4 @@
|
|||||||
from dcs.point import MovingPoint
|
from dcs.point import MovingPoint, PointAction
|
||||||
from dcs.task import Land
|
|
||||||
|
|
||||||
from game.utils import feet
|
|
||||||
from dcs.point import PointAction
|
|
||||||
|
|
||||||
|
|
||||||
from .pydcswaypointbuilder import PydcsWaypointBuilder
|
from .pydcswaypointbuilder import PydcsWaypointBuilder
|
||||||
|
|
||||||
@ -11,16 +6,9 @@ from .pydcswaypointbuilder import PydcsWaypointBuilder
|
|||||||
class CargoStopBuilder(PydcsWaypointBuilder):
|
class CargoStopBuilder(PydcsWaypointBuilder):
|
||||||
def build(self) -> MovingPoint:
|
def build(self) -> MovingPoint:
|
||||||
waypoint = super().build()
|
waypoint = super().build()
|
||||||
# Create a landing task, currently only for Helos!
|
waypoint.type = "LandingReFuAr"
|
||||||
if self.flight.is_helo:
|
waypoint.action = PointAction.LandingReFuAr
|
||||||
# Calculate a landing point with a small buffer to prevent AI from landing
|
waypoint.landing_refuel_rearm_time = 2 # Minutes.
|
||||||
# directly at the static ammo depot and exploding
|
if (control_point := self.waypoint.control_point) is not None:
|
||||||
landing_point = waypoint.position.random_point_within(15, 5)
|
waypoint.airdrome_id = control_point.airdrome_id_for_landing
|
||||||
# Use Land Task with 30s duration for helos
|
|
||||||
waypoint.add_task(Land(landing_point, duration=30))
|
|
||||||
else:
|
|
||||||
# Fixed wing will drop the cargo at the waypoint so we set a lower altitude
|
|
||||||
waypoint.alt = int(feet(10000).meters)
|
|
||||||
waypoint.alt_type = "BARO"
|
|
||||||
waypoint.action = PointAction.FlyOverPoint
|
|
||||||
return waypoint
|
return waypoint
|
||||||
|
|||||||
@ -1,15 +0,0 @@
|
|||||||
from dcs.point import MovingPoint, PointAction
|
|
||||||
from dcs.task import Land
|
|
||||||
|
|
||||||
from .pydcswaypointbuilder import PydcsWaypointBuilder
|
|
||||||
|
|
||||||
|
|
||||||
class StopoverBuilder(PydcsWaypointBuilder):
|
|
||||||
def build(self) -> MovingPoint:
|
|
||||||
waypoint = super().build()
|
|
||||||
waypoint.type = "LandingReFuAr"
|
|
||||||
waypoint.action = PointAction.LandingReFuAr
|
|
||||||
waypoint.landing_refuel_rearm_time = 2 # Minutes.
|
|
||||||
if (control_point := self.waypoint.control_point) is not None:
|
|
||||||
waypoint.airdrome_id = control_point.airdrome_id_for_landing
|
|
||||||
return waypoint
|
|
||||||
@ -16,7 +16,7 @@ from game.ato import Flight, FlightWaypoint
|
|||||||
from game.ato.flightstate import InFlight, WaitingForStart
|
from game.ato.flightstate import InFlight, WaitingForStart
|
||||||
from game.ato.flightwaypointtype import FlightWaypointType
|
from game.ato.flightwaypointtype import FlightWaypointType
|
||||||
from game.ato.starttype import StartType
|
from game.ato.starttype import StartType
|
||||||
from game.missiongenerator.aircraft.waypoints.stopover import StopoverBuilder
|
from game.missiongenerator.aircraft.waypoints.cargostop import CargoStopBuilder
|
||||||
from game.missiongenerator.missiondata import MissionData
|
from game.missiongenerator.missiondata import MissionData
|
||||||
from game.settings import Settings
|
from game.settings import Settings
|
||||||
from game.utils import pairwise
|
from game.utils import pairwise
|
||||||
@ -135,7 +135,7 @@ class WaypointGenerator:
|
|||||||
FlightWaypointType.PATROL_TRACK: RaceTrackBuilder,
|
FlightWaypointType.PATROL_TRACK: RaceTrackBuilder,
|
||||||
FlightWaypointType.PICKUP: CargoStopBuilder,
|
FlightWaypointType.PICKUP: CargoStopBuilder,
|
||||||
FlightWaypointType.REFUEL: RefuelPointBuilder,
|
FlightWaypointType.REFUEL: RefuelPointBuilder,
|
||||||
FlightWaypointType.STOPOVER: StopoverBuilder,
|
FlightWaypointType.CARGO_STOP: CargoStopBuilder,
|
||||||
}
|
}
|
||||||
builder = builders.get(waypoint.waypoint_type, DefaultWaypointBuilder)
|
builder = builders.get(waypoint.waypoint_type, DefaultWaypointBuilder)
|
||||||
return builder(
|
return builder(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user