This commit is contained in:
Dan Albert
2021-02-12 19:58:30 -08:00
parent 053663bd76
commit a47bef1f13
222 changed files with 8434 additions and 4461 deletions

View File

@@ -9,9 +9,17 @@ from qt_ui.widgets.combos.QFilteredComboBox import QFilteredComboBox
class QPredefinedWaypointSelectionComboBox(QFilteredComboBox):
def __init__(self, game: Game, parent=None, include_targets=True, include_airbases=True,
include_frontlines=True, include_units=True, include_enemy=True, include_friendly=True):
def __init__(
self,
game: Game,
parent=None,
include_targets=True,
include_airbases=True,
include_frontlines=True,
include_units=True,
include_enemy=True,
include_friendly=True,
):
super(QPredefinedWaypointSelectionComboBox, self).__init__(parent)
self.game = game
self.include_targets = include_targets
@@ -34,7 +42,11 @@ class QPredefinedWaypointSelectionComboBox(QFilteredComboBox):
waypoints = [first_waypoint]
if include_all_from_same_location:
for w in self.wpts:
if w is not first_waypoint and w.obj_name and w.obj_name == first_waypoint.obj_name:
if (
w is not first_waypoint
and w.obj_name
and w.obj_name == first_waypoint.obj_name
):
waypoints.append(w)
return waypoints
@@ -53,14 +65,19 @@ class QPredefinedWaypointSelectionComboBox(QFilteredComboBox):
if self.include_frontlines:
for cp in self.game.theater.controlpoints:
if cp.captured:
enemy_cp = [ecp for ecp in cp.connected_points if ecp.captured != cp.captured]
enemy_cp = [
ecp
for ecp in cp.connected_points
if ecp.captured != cp.captured
]
for ecp in enemy_cp:
pos = Conflict.frontline_position(cp, ecp, self.game.theater)[0]
wpt = FlightWaypoint(
FlightWaypointType.CUSTOM,
pos.x,
pos.y,
Distance.from_meters(800))
Distance.from_meters(800),
)
wpt.name = "Frontline " + cp.name + "/" + ecp.name + " [CAS]"
wpt.alt_type = "RADIO"
wpt.pretty_name = wpt.name
@@ -69,14 +86,18 @@ class QPredefinedWaypointSelectionComboBox(QFilteredComboBox):
if self.include_targets:
for cp in self.game.theater.controlpoints:
if (self.include_enemy and not cp.captured) or (self.include_friendly and cp.captured):
if (self.include_enemy and not cp.captured) or (
self.include_friendly and cp.captured
):
for ground_object in cp.ground_objects:
if not ground_object.is_dead and isinstance(ground_object, BuildingGroundObject):
if not ground_object.is_dead and isinstance(
ground_object, BuildingGroundObject
):
wpt = FlightWaypoint(
FlightWaypointType.CUSTOM,
ground_object.position.x,
ground_object.position.y,
Distance.from_meters(0)
Distance.from_meters(0),
)
wpt.alt_type = "RADIO"
wpt.name = ground_object.waypoint_name
@@ -91,19 +112,31 @@ class QPredefinedWaypointSelectionComboBox(QFilteredComboBox):
if self.include_units:
for cp in self.game.theater.controlpoints:
if (self.include_enemy and not cp.captured) or (self.include_friendly and cp.captured):
if (self.include_enemy and not cp.captured) or (
self.include_friendly and cp.captured
):
for ground_object in cp.ground_objects:
if not ground_object.is_dead and ground_object.dcs_identifier == "AA":
if (
not ground_object.is_dead
and ground_object.dcs_identifier == "AA"
):
for g in ground_object.groups:
for j, u in enumerate(g.units):
wpt = FlightWaypoint(
FlightWaypointType.CUSTOM,
u.position.x,
u.position.y,
Distance.from_meters(0)
Distance.from_meters(0),
)
wpt.alt_type = "RADIO"
wpt.name = wpt.name = "[" + str(ground_object.obj_name) + "] : " + u.type + " #" + str(j)
wpt.name = wpt.name = (
"["
+ str(ground_object.obj_name)
+ "] : "
+ u.type
+ " #"
+ str(j)
)
wpt.pretty_name = wpt.name
wpt.targets.append(u)
wpt.obj_name = ground_object.obj_name
@@ -116,17 +149,21 @@ class QPredefinedWaypointSelectionComboBox(QFilteredComboBox):
if self.include_airbases:
for cp in self.game.theater.controlpoints:
if (self.include_enemy and not cp.captured) or (self.include_friendly and cp.captured):
if (self.include_enemy and not cp.captured) or (
self.include_friendly and cp.captured
):
wpt = FlightWaypoint(
FlightWaypointType.CUSTOM,
cp.position.x,
cp.position.y,
Distance.from_meters(0)
Distance.from_meters(0),
)
wpt.alt_type = "RADIO"
wpt.name = cp.name
if cp.captured:
wpt.description = "Position of " + cp.name + " [Friendly Airbase]"
wpt.description = (
"Position of " + cp.name + " [Friendly Airbase]"
)
else:
wpt.description = "Position of " + cp.name + " [Enemy Airbase]"