mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Add visual debugging for other fligth plans.
This commit is contained in:
parent
575f4e1786
commit
91d9bbdc97
@ -537,6 +537,11 @@ class ConflictTheater:
|
|||||||
if distance < closest_distance:
|
if distance < closest_distance:
|
||||||
closest = tgo
|
closest = tgo
|
||||||
closest_distance = distance
|
closest_distance = distance
|
||||||
|
for conflict in self.conflicts():
|
||||||
|
distance = conflict.position.distance_to_point(point)
|
||||||
|
if distance < closest_distance:
|
||||||
|
closest = conflict
|
||||||
|
closest_distance = distance
|
||||||
return closest
|
return closest
|
||||||
|
|
||||||
def closest_opposing_control_points(self) -> Tuple[ControlPoint, ControlPoint]:
|
def closest_opposing_control_points(self) -> Tuple[ControlPoint, ControlPoint]:
|
||||||
|
|||||||
@ -82,6 +82,10 @@ class PathDebugOptions(DisplayGroup):
|
|||||||
super().__init__("Shortest paths", debug_only=True)
|
super().__init__("Shortest paths", debug_only=True)
|
||||||
self.hide = DisplayRule("DEBUG Hide paths", True)
|
self.hide = DisplayRule("DEBUG Hide paths", True)
|
||||||
self.shortest_path = DisplayRule("DEBUG Show shortest path", False)
|
self.shortest_path = DisplayRule("DEBUG Show shortest path", False)
|
||||||
|
self.barcap = DisplayRule("DEBUG Show BARCAP plan", False)
|
||||||
|
self.cas = DisplayRule("DEBUG Show CAS plan", False)
|
||||||
|
self.sweep = DisplayRule("DEBUG Show fighter sweep plan", False)
|
||||||
|
self.strike = DisplayRule("DEBUG Show strike plan", False)
|
||||||
self.tarcap = DisplayRule("DEBUG Show TARCAP plan", False)
|
self.tarcap = DisplayRule("DEBUG Show TARCAP plan", False)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -52,7 +52,11 @@ from gen.flights.flight import (
|
|||||||
FlightWaypoint,
|
FlightWaypoint,
|
||||||
FlightWaypointType,
|
FlightWaypointType,
|
||||||
)
|
)
|
||||||
from gen.flights.flightplan import FlightPlan, FlightPlanBuilder
|
from gen.flights.flightplan import (
|
||||||
|
FlightPlan,
|
||||||
|
FlightPlanBuilder,
|
||||||
|
InvalidObjectiveLocation,
|
||||||
|
)
|
||||||
from qt_ui.displayoptions import DisplayOptions, ThreatZoneOptions
|
from qt_ui.displayoptions import DisplayOptions, ThreatZoneOptions
|
||||||
from qt_ui.models import GameModel
|
from qt_ui.models import GameModel
|
||||||
from qt_ui.widgets.map.QFrontLine import QFrontLine
|
from qt_ui.widgets.map.QFrontLine import QFrontLine
|
||||||
@ -429,8 +433,8 @@ class QLiberationMap(QGraphicsView):
|
|||||||
|
|
||||||
prev_pos = new_pos
|
prev_pos = new_pos
|
||||||
|
|
||||||
def draw_tarcap_plan(self, scene: QGraphicsScene, point_near_target: Point,
|
def draw_test_flight_plan(self, scene: QGraphicsScene, task: FlightType,
|
||||||
player: bool) -> None:
|
point_near_target: Point, player: bool) -> None:
|
||||||
for line in self.shortest_path_segments:
|
for line in self.shortest_path_segments:
|
||||||
try:
|
try:
|
||||||
scene.removeItem(line)
|
scene.removeItem(line)
|
||||||
@ -447,12 +451,14 @@ class QLiberationMap(QGraphicsView):
|
|||||||
origin = self.game.theater.enemy_points()[0]
|
origin = self.game.theater.enemy_points()[0]
|
||||||
|
|
||||||
package = Package(target)
|
package = Package(target)
|
||||||
flight = Flight(package, F_16C_50, 2, FlightType.TARCAP,
|
flight = Flight(package, F_16C_50, 2, task, start_type="Warm",
|
||||||
start_type="Warm", departure=origin, arrival=origin,
|
departure=origin, arrival=origin, divert=None)
|
||||||
divert=None)
|
|
||||||
package.add_flight(flight)
|
package.add_flight(flight)
|
||||||
planner = FlightPlanBuilder(self.game, package, is_player=player)
|
planner = FlightPlanBuilder(self.game, package, is_player=player)
|
||||||
planner.populate_flight_plan(flight)
|
try:
|
||||||
|
planner.populate_flight_plan(flight)
|
||||||
|
except InvalidObjectiveLocation:
|
||||||
|
return
|
||||||
|
|
||||||
self.draw_flight_plan(scene, flight, selected=True)
|
self.draw_flight_plan(scene, flight, selected=True)
|
||||||
|
|
||||||
@ -1052,10 +1058,22 @@ class QLiberationMap(QGraphicsView):
|
|||||||
self.draw_shortest_path(
|
self.draw_shortest_path(
|
||||||
self.scene(), self.game.navmesh_for(player=debug_blue),
|
self.scene(), self.game.navmesh_for(player=debug_blue),
|
||||||
mouse_world_pos, player=False)
|
mouse_world_pos, player=False)
|
||||||
|
elif not DisplayOptions.path_debug.hide:
|
||||||
if DisplayOptions.path_debug.tarcap:
|
if DisplayOptions.path_debug.barcap:
|
||||||
self.draw_tarcap_plan(self.scene(), mouse_world_pos,
|
task = FlightType.BARCAP
|
||||||
player=debug_blue)
|
elif DisplayOptions.path_debug.cas:
|
||||||
|
task = FlightType.CAS
|
||||||
|
elif DisplayOptions.path_debug.sweep:
|
||||||
|
task = FlightType.SWEEP
|
||||||
|
elif DisplayOptions.path_debug.strike:
|
||||||
|
task = FlightType.STRIKE
|
||||||
|
elif DisplayOptions.path_debug.tarcap:
|
||||||
|
task = FlightType.TARCAP
|
||||||
|
else:
|
||||||
|
raise ValueError(
|
||||||
|
"Unexpected value for DisplayOptions.path_debug")
|
||||||
|
self.draw_test_flight_plan(self.scene(), task, mouse_world_pos,
|
||||||
|
player=debug_blue)
|
||||||
|
|
||||||
def sceneMousePressEvent(self, event: QGraphicsSceneMouseEvent):
|
def sceneMousePressEvent(self, event: QGraphicsSceneMouseEvent):
|
||||||
if self.state == QLiberationMapState.MOVING_UNIT:
|
if self.state == QLiberationMapState.MOVING_UNIT:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user