mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Improve threat zone display options.
This commit is contained in:
parent
52b63927b4
commit
56d7993c8f
@ -47,6 +47,19 @@ class FlightPathOptions(DisplayGroup):
|
||||
self.all = DisplayRule("Show All Flight Paths", True)
|
||||
|
||||
|
||||
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)
|
||||
self.all = DisplayRule(
|
||||
f"Show full {coalition_name.lower()} threat zones", False)
|
||||
self.aircraft = DisplayRule(
|
||||
f"Show {coalition_name.lower()} aircraft threat tones", False)
|
||||
self.air_defenses = DisplayRule(
|
||||
f"Show {coalition_name.lower()} air defenses threat zones", False)
|
||||
|
||||
|
||||
class DisplayOptions:
|
||||
ground_objects = DisplayRule("Ground Objects", True)
|
||||
control_points = DisplayRule("Control Points", True)
|
||||
@ -59,8 +72,8 @@ class DisplayOptions:
|
||||
culling = DisplayRule("Display Culling Zones", False)
|
||||
flight_paths = FlightPathOptions()
|
||||
actual_frontline_pos = DisplayRule("Display Actual Frontline Location", False)
|
||||
blue_threat_zone = DisplayRule("Display Blue Threat Zones", False)
|
||||
red_threat_zone = DisplayRule("Display Red Threat Zones", False)
|
||||
blue_threat_zones = ThreatZoneOptions("Blue")
|
||||
red_threat_zones = ThreatZoneOptions("Red")
|
||||
|
||||
@classmethod
|
||||
def menu_items(cls) -> Iterator[Union[DisplayGroup, DisplayRule]]:
|
||||
|
||||
@ -43,7 +43,7 @@ from game.weather import TimeOfDay
|
||||
from gen import Conflict
|
||||
from gen.flights.flight import Flight, FlightWaypoint, FlightWaypointType
|
||||
from gen.flights.flightplan import FlightPlan
|
||||
from qt_ui.displayoptions import DisplayOptions
|
||||
from qt_ui.displayoptions import DisplayOptions, ThreatZoneOptions
|
||||
from qt_ui.models import GameModel
|
||||
from qt_ui.widgets.map.QFrontLine import QFrontLine
|
||||
from qt_ui.widgets.map.QLiberationScene import QLiberationScene
|
||||
@ -298,9 +298,18 @@ class QLiberationMap(QGraphicsView):
|
||||
self.draw_shapely_poly(scene, poly, CONST.COLORS["transparent"], brush)
|
||||
|
||||
def display_threat_zones(self, scene: QGraphicsScene,
|
||||
player: bool) -> None:
|
||||
options: ThreatZoneOptions, player: bool) -> None:
|
||||
"""Draws the threat zones on the map."""
|
||||
threat_poly = self.game.threat_zone_for(player).all
|
||||
threat_zones = self.game.threat_zone_for(player)
|
||||
if options.all:
|
||||
threat_poly = threat_zones.all
|
||||
elif options.aircraft:
|
||||
threat_poly = threat_zones.airbases
|
||||
elif options.air_defenses:
|
||||
threat_poly = threat_zones.air_defenses
|
||||
else:
|
||||
return
|
||||
|
||||
if isinstance(threat_poly, MultiPolygon):
|
||||
polys = threat_poly.geoms
|
||||
else:
|
||||
@ -364,11 +373,10 @@ class QLiberationMap(QGraphicsView):
|
||||
if DisplayOptions.culling and self.game.settings.perf_culling:
|
||||
self.display_culling(scene)
|
||||
|
||||
if DisplayOptions.blue_threat_zone:
|
||||
self.display_threat_zones(scene, player=True)
|
||||
|
||||
if DisplayOptions.red_threat_zone:
|
||||
self.display_threat_zones(scene, player=False)
|
||||
self.display_threat_zones(scene, DisplayOptions.blue_threat_zones,
|
||||
player=True)
|
||||
self.display_threat_zones(scene, DisplayOptions.red_threat_zones,
|
||||
player=False)
|
||||
|
||||
for cp in self.game.theater.controlpoints:
|
||||
|
||||
|
||||
@ -168,18 +168,21 @@ class QLiberationWindow(QMainWindow):
|
||||
|
||||
displayMenu = self.menu.addMenu("&Display")
|
||||
|
||||
last_was_group = True
|
||||
|
||||
last_was_group = False
|
||||
for item in DisplayOptions.menu_items():
|
||||
if isinstance(item, DisplayRule):
|
||||
if last_was_group:
|
||||
displayMenu.addSeparator()
|
||||
self.display_bar.addSeparator()
|
||||
action = self.make_display_rule_action(item)
|
||||
displayMenu.addAction(action)
|
||||
if action.icon():
|
||||
self.display_bar.addAction(action)
|
||||
last_was_group = False
|
||||
elif isinstance(item, DisplayGroup):
|
||||
if not last_was_group:
|
||||
displayMenu.addSeparator()
|
||||
self.display_bar.addSeparator()
|
||||
displayMenu.addSeparator()
|
||||
self.display_bar.addSeparator()
|
||||
group = QActionGroup(displayMenu)
|
||||
for display_rule in item:
|
||||
action = self.make_display_rule_action(display_rule, group)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user