Revert "Correct radar detection."

We need this after all, but we do need to audit the list. Will follow
up with that fix.

https://github.com/dcs-liberation/dcs_liberation/issues/1109

This reverts commit f68935735d.
This commit is contained in:
Dan Albert
2021-05-23 01:10:29 -07:00
parent 7450a6b7eb
commit 98e0be6be9
3 changed files with 88 additions and 19 deletions

View File

@@ -1,6 +1,7 @@
from PySide2.QtGui import QStandardItem, QStandardItemModel
from game import Game
from game.data.radar_db import UNITS_WITH_RADAR
from gen import db
from qt_ui.widgets.combos.QFilteredComboBox import QFilteredComboBox
@@ -44,18 +45,21 @@ class QSEADTargetSelectionComboBox(QFilteredComboBox):
for g in cp.ground_objects:
radars = []
max_detection_range = 0
detection_range = 0
threat_range = 0
if g.dcs_identifier == "AA":
for group in g.groups:
for u in group.units:
utype = db.unit_type_from_name(u.type)
detection_range = getattr(utype, "detection_range", 0)
if detection_range > 1000:
max_detection_range = max(
detection_range, max_detection_range
)
radars.append(u)
if utype in UNITS_WITH_RADAR:
if (
hasattr(utype, "detection_range")
and utype.detection_range > 1000
):
if utype.detection_range > detection_range:
detection_range = utype.detection_range
radars.append(u)
if hasattr(utype, "threat_range"):
if utype.threat_range > threat_range:
@@ -77,7 +81,7 @@ class QSEADTargetSelectionComboBox(QFilteredComboBox):
tgt_info.radars = radars
tgt_info.location = g
tgt_info.threat_range = threat_range
tgt_info.detection_range = max_detection_range
tgt_info.detection_range = detection_range
i = add_model_item(i, model, tgt_info)
self.setModel(model)