Add display option for BARCAP commit range.

This commit is contained in:
Dan Albert 2021-01-16 15:12:52 -08:00
parent 2374239238
commit 1a2475dc25
2 changed files with 27 additions and 3 deletions

View File

@ -53,9 +53,9 @@ class ThreatZoneOptions(DisplayGroup):
def __init__(self, coalition_name: str) -> None:
super().__init__(f"{coalition_name} Threat Zones")
self.none = DisplayRule(
f"Hide {coalition_name.lower()} threat zones", True)
f"Hide {coalition_name.lower()} threat zones", False)
self.all = DisplayRule(
f"Show full {coalition_name.lower()} threat zones", False)
f"Show full {coalition_name.lower()} threat zones", True)
self.aircraft = DisplayRule(
f"Show {coalition_name.lower()} aircraft threat tones", False)
self.air_defenses = DisplayRule(
@ -99,9 +99,11 @@ class DisplayOptions:
map_poly = DisplayRule("Map Polygon Debug Mode", False)
waypoint_info = DisplayRule("Waypoint Information", True)
culling = DisplayRule("Display Culling Zones", False)
flight_paths = FlightPathOptions()
actual_frontline_pos = DisplayRule("Display Actual Frontline Location",
False)
barcap_commit_range = DisplayRule("Display selected BARCAP commit range",
False)
flight_paths = FlightPathOptions()
blue_threat_zones = ThreatZoneOptions("Blue")
red_threat_zones = ThreatZoneOptions("Red")
navmeshes = NavMeshOptions()

View File

@ -54,6 +54,7 @@ from gen.flights.flight import (
FlightWaypointType,
)
from gen.flights.flightplan import (
BarCapFlightPlan,
FlightPlan,
FlightPlanBuilder,
InvalidObjectiveLocation,
@ -609,6 +610,27 @@ class QLiberationMap(QGraphicsView):
flight.flight_plan)
prev_pos = tuple(new_pos)
if selected and DisplayOptions.barcap_commit_range:
self.draw_barcap_commit_range(scene, flight)
def draw_barcap_commit_range(self, scene: QGraphicsScene,
flight: Flight) -> None:
if flight.flight_type is not FlightType.BARCAP:
return
if not isinstance(flight.flight_plan, BarCapFlightPlan):
return
start = flight.flight_plan.patrol_start
end = flight.flight_plan.patrol_end
line = LineString([
ShapelyPoint(start.x, start.y),
ShapelyPoint(end.x, end.y),
])
doctrine = self.game.faction_for(flight.departure.captured).doctrine
bubble = line.buffer(doctrine.cap_engagement_range.meters)
self.flight_path_items.append(self.draw_shapely_poly(
scene, bubble, CONST.COLORS["yellow"], CONST.COLORS["transparent"]
))
def draw_waypoint(self, scene: QGraphicsScene,
position: Tuple[float, float], player: bool,
selected: bool) -> None: