mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Remove CTLD logic from Airlift flightplan for AI
This commit is contained in:
parent
336df10da2
commit
9e625b0e5e
@ -23,12 +23,16 @@ class AirliftLayout(StandardLayout):
|
|||||||
# airfield for cargo planes, as the cargo is pre-loaded. Helicopters will still pick
|
# airfield for cargo planes, as the cargo is pre-loaded. Helicopters will still pick
|
||||||
# up the cargo near the airfield.
|
# up the cargo near the airfield.
|
||||||
pickup: FlightWaypoint | None
|
pickup: FlightWaypoint | None
|
||||||
|
# pickup_zone will be used for player flights to create the CTLD stuff
|
||||||
|
ctld_pickup_zone: FlightWaypoint | None
|
||||||
nav_to_drop_off: list[FlightWaypoint]
|
nav_to_drop_off: list[FlightWaypoint]
|
||||||
# There will not be a drop-off waypoint when the drop-off airfield and the arrival
|
# There will not be a drop-off waypoint when the drop-off airfield and the arrival
|
||||||
# airfield is the same for a cargo plane, as planes will land to unload and we don't
|
# airfield is the same for a cargo plane, as planes will land to unload and we don't
|
||||||
# want a double landing. Helicopters will still drop their cargo near the airfield
|
# want a double landing. Helicopters will still drop their cargo near the airfield
|
||||||
# before landing.
|
# before landing.
|
||||||
drop_off: FlightWaypoint | None
|
drop_off: FlightWaypoint | None
|
||||||
|
# drop_off_zone will be used for player flights to create the CTLD stuff
|
||||||
|
ctld_drop_off_zone: FlightWaypoint | None
|
||||||
nav_to_home: list[FlightWaypoint]
|
nav_to_home: list[FlightWaypoint]
|
||||||
|
|
||||||
def iter_waypoints(self) -> Iterator[FlightWaypoint]:
|
def iter_waypoints(self) -> Iterator[FlightWaypoint]:
|
||||||
@ -36,9 +40,13 @@ class AirliftLayout(StandardLayout):
|
|||||||
yield from self.nav_to_pickup
|
yield from self.nav_to_pickup
|
||||||
if self.pickup is not None:
|
if self.pickup is not None:
|
||||||
yield self.pickup
|
yield self.pickup
|
||||||
|
if self.ctld_pickup_zone is not None:
|
||||||
|
yield self.ctld_pickup_zone
|
||||||
yield from self.nav_to_drop_off
|
yield from self.nav_to_drop_off
|
||||||
if self.drop_off is not None:
|
if self.drop_off is not None:
|
||||||
yield self.drop_off
|
yield self.drop_off
|
||||||
|
if self.ctld_drop_off_zone is not None:
|
||||||
|
yield self.ctld_drop_off_zone
|
||||||
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:
|
||||||
@ -86,33 +94,33 @@ class Builder(IBuilder[AirliftFlightPlan, AirliftLayout]):
|
|||||||
builder = WaypointBuilder(self.flight, self.coalition)
|
builder = WaypointBuilder(self.flight, self.coalition)
|
||||||
|
|
||||||
pickup = None
|
pickup = None
|
||||||
refuel = None
|
|
||||||
drop_off = None
|
drop_off = None
|
||||||
|
pickup_zone = None
|
||||||
|
drop_off_zone = None
|
||||||
|
|
||||||
|
if cargo.origin != self.flight.departure:
|
||||||
|
pickup = builder.cargo_pickup(cargo.origin, False)
|
||||||
|
if cargo.next_stop != self.flight.arrival:
|
||||||
|
drop_off = builder.cargo_dropoff(cargo.next_stop, False)
|
||||||
|
|
||||||
if self.flight.is_helo:
|
if self.flight.is_helo:
|
||||||
# Create a pickupzone where the cargo will be spawned
|
# Create CTLD Zones for Helo flights
|
||||||
pickup_zone = MissionTarget(
|
pickup_zone = builder.cargo_pickup(
|
||||||
"Pickup Zone", cargo.origin.position.random_point_within(1000, 200)
|
MissionTarget(
|
||||||
|
"Pickup Zone", cargo.origin.position.random_point_within(1000, 200)
|
||||||
|
),
|
||||||
|
True,
|
||||||
)
|
)
|
||||||
pickup = builder.cargo_pickup(pickup_zone, True)
|
drop_off_zone = builder.cargo_dropoff(
|
||||||
# If The cargo is at the departure controlpoint, the pickup waypoint should
|
MissionTarget(
|
||||||
# only be created for client flights
|
"Dropoff zone",
|
||||||
pickup.only_for_player = cargo.origin == self.flight.departure
|
cargo.next_stop.position.random_point_within(1000, 200),
|
||||||
|
),
|
||||||
# Create a dropoff zone where the cargo should be dropped
|
True,
|
||||||
drop_off_zone = MissionTarget(
|
|
||||||
"Dropoff zone",
|
|
||||||
cargo.next_stop.position.random_point_within(1000, 200),
|
|
||||||
)
|
)
|
||||||
drop_off = builder.cargo_dropoff(drop_off_zone, True)
|
# Show the zone waypoints only to the player
|
||||||
|
pickup_zone.only_for_player = True
|
||||||
# Add an additional refuel waypoint
|
drop_off_zone.only_for_player = True
|
||||||
refuel = builder.land_refuel(cargo.next_stop)
|
|
||||||
else:
|
|
||||||
# Fixed Wing will get landing&refuel waypoints for pickup and dropoff
|
|
||||||
if cargo.origin != self.flight.departure:
|
|
||||||
pickup = builder.cargo_pickup(cargo.origin, False)
|
|
||||||
if cargo.next_stop != self.flight.arrival:
|
|
||||||
drop_off = builder.cargo_dropoff(cargo.next_stop, False)
|
|
||||||
|
|
||||||
nav_to_pickup = builder.nav_path(
|
nav_to_pickup = builder.nav_path(
|
||||||
self.flight.departure.position,
|
self.flight.departure.position,
|
||||||
@ -135,6 +143,7 @@ class Builder(IBuilder[AirliftFlightPlan, AirliftLayout]):
|
|||||||
departure=builder.takeoff(self.flight.departure),
|
departure=builder.takeoff(self.flight.departure),
|
||||||
nav_to_pickup=nav_to_pickup,
|
nav_to_pickup=nav_to_pickup,
|
||||||
pickup=pickup,
|
pickup=pickup,
|
||||||
|
ctld_pickup_zone=pickup_zone,
|
||||||
nav_to_drop_off=builder.nav_path(
|
nav_to_drop_off=builder.nav_path(
|
||||||
cargo.origin.position,
|
cargo.origin.position,
|
||||||
cargo.next_stop.position,
|
cargo.next_stop.position,
|
||||||
@ -142,6 +151,7 @@ class Builder(IBuilder[AirliftFlightPlan, AirliftLayout]):
|
|||||||
altitude_is_agl,
|
altitude_is_agl,
|
||||||
),
|
),
|
||||||
drop_off=drop_off,
|
drop_off=drop_off,
|
||||||
|
ctld_drop_off_zone=drop_off_zone,
|
||||||
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,
|
||||||
|
|||||||
@ -542,7 +542,7 @@ class WaypointBuilder:
|
|||||||
control_point = pick_up if isinstance(pick_up, ControlPoint) else None
|
control_point = pick_up if isinstance(pick_up, ControlPoint) else None
|
||||||
if is_helo:
|
if is_helo:
|
||||||
return FlightWaypoint(
|
return FlightWaypoint(
|
||||||
"PICKUP",
|
"PICKUPZONE",
|
||||||
FlightWaypointType.PICKUP_ZONE,
|
FlightWaypointType.PICKUP_ZONE,
|
||||||
pick_up.position,
|
pick_up.position,
|
||||||
meters(0),
|
meters(0),
|
||||||
@ -578,7 +578,7 @@ class WaypointBuilder:
|
|||||||
"Helicopter airlift drop-off targets should not be control points"
|
"Helicopter airlift drop-off targets should not be control points"
|
||||||
)
|
)
|
||||||
return FlightWaypoint(
|
return FlightWaypoint(
|
||||||
"DROPOFF",
|
"DROPOFFZONE",
|
||||||
FlightWaypointType.DROPOFF_ZONE,
|
FlightWaypointType.DROPOFF_ZONE,
|
||||||
drop_off.position,
|
drop_off.position,
|
||||||
meters(0),
|
meters(0),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user