Added more display options for SAMS

This commit is contained in:
Khopa 2020-10-12 18:12:45 +02:00
parent 974b6590d8
commit 9c58e73b39
2 changed files with 12 additions and 8 deletions

View File

@ -51,7 +51,9 @@ class DisplayOptions:
control_points = DisplayRule("Control Points", True)
lines = DisplayRule("Lines", True)
events = DisplayRule("Events", True)
sam_ranges = DisplayRule("SAM Ranges", True)
sam_ranges = DisplayRule("Ally SAM Threat Range", False)
enemy_sam_ranges = DisplayRule("Enemy SAM Threat Range", True)
detection_range = DisplayRule("SAM Detection Range", False)
waypoint_info = DisplayRule("Waypoint Information", True)
flight_paths = FlightPathOptions()

View File

@ -49,7 +49,7 @@ class QLiberationMap(QGraphicsView):
# A tuple of (package index, flight index), or none.
self.selected_flight: Optional[Tuple[int, int]] = None
self.setMinimumSize(800,600)
self.setMinimumSize(800, 600)
self.setMaximumHeight(2160)
self._zoom = 0
self.factor = 1
@ -99,8 +99,6 @@ class QLiberationMap(QGraphicsView):
if self.game is not None:
self.reload_scene()
"""
Uncomment to set up theather reference points
@ -175,14 +173,17 @@ class QLiberationMap(QGraphicsView):
if ground_object.obj_name in added_objects:
continue
go_pos = self._transform_point(ground_object.position)
if not ground_object.airbase_group:
buildings = self.game.theater.find_ground_objects_by_obj_name(ground_object.obj_name)
scene.addItem(QMapGroundObject(self, go_pos[0], go_pos[1], 14, 12, cp, ground_object, self.game, buildings))
is_aa = ground_object.category == "aa"
if is_aa and DisplayOptions.sam_ranges:
should_display = ((DisplayOptions.sam_ranges and cp.captured)
or
(DisplayOptions.enemy_sam_ranges and not cp.captured))
if is_aa and should_display:
threat_range = 0
detection_range = 0
can_fire = False
@ -205,8 +206,9 @@ class QLiberationMap(QGraphicsView):
detection_radius = Point(*go_pos).distance_to_point(Point(*detection_pos))
# Add detection range circle
scene.addEllipse(go_pos[0] - detection_radius/2 + 7, go_pos[1] - detection_radius/2 + 6,
detection_radius, detection_radius, self.detection_pen(cp.captured))
if DisplayOptions.detection_range:
scene.addEllipse(go_pos[0] - detection_radius/2 + 7, go_pos[1] - detection_radius/2 + 6,
detection_radius, detection_radius, self.detection_pen(cp.captured))
# Add threat range circle
scene.addEllipse(go_pos[0] - threat_radius / 2 + 7, go_pos[1] - threat_radius / 2 + 6,