mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Use convoy spawn points defined by the campaign.
The start/end points of the waypoints that define the course of the front line also define the spawn points for convoys. Use them. https://github.com/Khopa/dcs_liberation/issues/824
This commit is contained in:
parent
d4679e0029
commit
d11c9a4615
@ -335,13 +335,20 @@ class MizCampaignLoader:
|
|||||||
f"No control point near the final waypoint of {group.name}"
|
f"No control point near the final waypoint of {group.name}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
convoy_origin = waypoints[0]
|
||||||
|
convoy_destination = waypoints[-1]
|
||||||
|
|
||||||
# Snap the begin and end points to the control points.
|
# Snap the begin and end points to the control points.
|
||||||
waypoints[0] = origin.position
|
waypoints[0] = origin.position
|
||||||
waypoints[-1] = destination.position
|
waypoints[-1] = destination.position
|
||||||
front_line_id = f"{origin.id}|{destination.id}"
|
front_line_id = f"{origin.id}|{destination.id}"
|
||||||
front_lines[front_line_id] = ComplexFrontLine(origin, waypoints)
|
front_lines[front_line_id] = ComplexFrontLine(origin, waypoints)
|
||||||
self.control_points[origin.id].connect(self.control_points[destination.id])
|
self.control_points[origin.id].connect(
|
||||||
self.control_points[destination.id].connect(self.control_points[origin.id])
|
self.control_points[destination.id], convoy_origin
|
||||||
|
)
|
||||||
|
self.control_points[destination.id].connect(
|
||||||
|
self.control_points[origin.id], convoy_destination
|
||||||
|
)
|
||||||
return front_lines
|
return front_lines
|
||||||
|
|
||||||
def objective_info(self, group: Group) -> Tuple[ControlPoint, Distance]:
|
def objective_info(self, group: Group) -> Tuple[ControlPoint, Distance]:
|
||||||
|
|||||||
@ -267,6 +267,7 @@ class ControlPoint(MissionTarget, ABC):
|
|||||||
# TODO: Should be Airbase specific.
|
# TODO: Should be Airbase specific.
|
||||||
self.has_frontline = has_frontline
|
self.has_frontline = has_frontline
|
||||||
self.connected_points: List[ControlPoint] = []
|
self.connected_points: List[ControlPoint] = []
|
||||||
|
self.convoy_spawns: Dict[ControlPoint, Point] = {}
|
||||||
self.base: Base = Base()
|
self.base: Base = Base()
|
||||||
self.cptype = cptype
|
self.cptype = cptype
|
||||||
# TODO: Should be Airbase specific.
|
# TODO: Should be Airbase specific.
|
||||||
@ -392,8 +393,9 @@ class ControlPoint(MissionTarget, ABC):
|
|||||||
...
|
...
|
||||||
|
|
||||||
# TODO: Should be Airbase specific.
|
# TODO: Should be Airbase specific.
|
||||||
def connect(self, to: ControlPoint) -> None:
|
def connect(self, to: ControlPoint, convoy_location: Point) -> None:
|
||||||
self.connected_points.append(to)
|
self.connected_points.append(to)
|
||||||
|
self.convoy_spawns[to] = convoy_location
|
||||||
self.stances[to.id] = CombatStance.DEFENSIVE
|
self.stances[to.id] = CombatStance.DEFENSIVE
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
|
|||||||
@ -31,14 +31,9 @@ class ConvoyGenerator:
|
|||||||
self.generate_convoy_for(transfer)
|
self.generate_convoy_for(transfer)
|
||||||
|
|
||||||
def generate_convoy_for(self, transfer: RoadTransferOrder) -> None:
|
def generate_convoy_for(self, transfer: RoadTransferOrder) -> None:
|
||||||
# TODO: Add convoy spawn points to campaign so these can start on/near a road.
|
|
||||||
# Groups that start with an on-road waypoint that are not on a road will move to
|
|
||||||
# the road one at a time. Spawning them arbitrarily at the control point spawns
|
|
||||||
# them on the runway (or in a FOB structure) and they'll take forever to get to
|
|
||||||
# a road.
|
|
||||||
origin = transfer.position.position
|
|
||||||
next_hop = transfer.path()[0]
|
next_hop = transfer.path()[0]
|
||||||
destination = next_hop.position
|
origin = transfer.position.convoy_spawns[next_hop]
|
||||||
|
destination = next_hop.convoy_spawns[transfer.position]
|
||||||
|
|
||||||
group = self._create_mixed_unit_group(
|
group = self._create_mixed_unit_group(
|
||||||
f"Convoy {next(self.count)}",
|
f"Convoy {next(self.count)}",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user