mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Show SAM range on map.
This commit is contained in:
parent
f698cb66b8
commit
f5a5fb765b
@ -771,6 +771,7 @@ FACTIONS = {
|
||||
|
||||
AirDefence.AAA_Vulcan_M163,
|
||||
AirDefence.SAM_Linebacker_M6,
|
||||
AirDefence.SAM_Hawk_PCP,
|
||||
|
||||
CVN_74_John_C__Stennis,
|
||||
LHA_1_Tarawa,
|
||||
@ -808,8 +809,7 @@ FACTIONS = {
|
||||
Unarmed.Transport_M818,
|
||||
Infantry.Infantry_M4,
|
||||
|
||||
AirDefence.AAA_Vulcan_M163,
|
||||
AirDefence.SAM_Linebacker_M6,
|
||||
AirDefence.SAM_Hawk_PCP,
|
||||
|
||||
CVN_74_John_C__Stennis,
|
||||
LHA_1_Tarawa,
|
||||
@ -847,6 +847,7 @@ FACTIONS = {
|
||||
Unarmed.Transport_M818,
|
||||
Infantry.Infantry_M4,
|
||||
|
||||
AirDefence.SAM_Hawk_PCP,
|
||||
AirDefence.SAM_Patriot_EPP_III,
|
||||
|
||||
CVN_74_John_C__Stennis,
|
||||
@ -874,6 +875,7 @@ FACTIONS = {
|
||||
Infantry.Infantry_M4,
|
||||
|
||||
AirDefence.SAM_Roland_ADS,
|
||||
AirDefence.SAM_Hawk_PCP,
|
||||
|
||||
CVN_74_John_C__Stennis,
|
||||
LHA_1_Tarawa,
|
||||
@ -905,6 +907,7 @@ FACTIONS = {
|
||||
|
||||
AirDefence.SPAAA_Gepard,
|
||||
AirDefence.SAM_Roland_ADS,
|
||||
AirDefence.SAM_Hawk_PCP,
|
||||
|
||||
CVN_74_John_C__Stennis,
|
||||
LHA_1_Tarawa,
|
||||
|
||||
@ -54,6 +54,7 @@ def generate_anti_air_group(game, parent_cp, ground_object, faction:str):
|
||||
AirDefence.SPAAA_Gepard: GepardGenerator,
|
||||
AirDefence.SAM_Roland_ADS: RolandGenerator,
|
||||
AirDefence.SAM_Patriot_LN_M901: PatriotGenerator,
|
||||
AirDefence.SAM_Patriot_EPP_III: PatriotGenerator,
|
||||
AirDefence.SAM_Chaparral_M48: ChaparralGenerator,
|
||||
|
||||
AirDefence.SAM_SA_2_LN_SM_90: SA2Generator,
|
||||
|
||||
@ -28,7 +28,9 @@ COLORS: Dict[str, QColor] = {
|
||||
"green": QColor(128, 186, 128),
|
||||
"bright_green": QColor(64, 200, 64),
|
||||
"black": QColor(0, 0, 0),
|
||||
"black_transparent": QColor(0, 0, 0, 64)
|
||||
"black_transparent": QColor(0, 0, 0, 64),
|
||||
"blue_transparent": QColor(164, 164, 255, 64),
|
||||
"red_transparent": QColor(255, 125, 125, 64)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
import typing
|
||||
from typing import Dict
|
||||
|
||||
from PySide2.QtCore import Qt, QRect
|
||||
from PySide2.QtCore import Qt, QRect, QPointF
|
||||
from PySide2.QtGui import QPixmap, QBrush, QColor, QWheelEvent, QPen, QFont
|
||||
from PySide2.QtWidgets import QGraphicsView, QFrame, QGraphicsOpacityEffect
|
||||
from dcs import Point
|
||||
|
||||
import qt_ui.uiconstants as CONST
|
||||
from game import Game
|
||||
from game import Game, db
|
||||
from game.event import InfantryTransportEvent, StrikeEvent, BaseAttackEvent, UnitsDeliveryEvent, Event, \
|
||||
FrontlineAttackEvent, FrontlinePatrolEvent, ConvoyStrikeEvent
|
||||
from gen import Conflict
|
||||
@ -75,6 +75,7 @@ class QLiberationMap(QGraphicsView):
|
||||
for cp in self.game.theater.controlpoints:
|
||||
|
||||
pos = self._transform_point(cp.position)
|
||||
|
||||
scene.addItem(QMapControlPoint(self, pos[0] - CONST.CP_SIZE / 2, pos[1] - CONST.CP_SIZE / 2, CONST.CP_SIZE,
|
||||
CONST.CP_SIZE, cp, self.game))
|
||||
|
||||
@ -89,6 +90,23 @@ class QLiberationMap(QGraphicsView):
|
||||
go_pos = self._transform_point(ground_object.position)
|
||||
scene.addItem(QMapGroundObject(self, go_pos[0], go_pos[1], 16, 16, cp, ground_object))
|
||||
|
||||
if(ground_object.category == "aa"):
|
||||
max_range = 0
|
||||
if ground_object.groups:
|
||||
for g in ground_object.groups:
|
||||
for u in g.units:
|
||||
unit = db.unit_type_from_name(u.type)
|
||||
if unit.threat_range > max_range:
|
||||
max_range = unit.threat_range
|
||||
if cp.captured:
|
||||
pen = QPen(brush=CONST.COLORS["blue"])
|
||||
brush = CONST.COLORS["blue_transparent"]
|
||||
else:
|
||||
pen = QPen(brush=CONST.COLORS["red"])
|
||||
brush = CONST.COLORS["red_transparent"]
|
||||
scene.addEllipse(go_pos[0] - max_range/300.0 + 8, go_pos[1] - max_range/300.0 + 8, max_range/150.0, max_range/150.0, pen, brush)
|
||||
|
||||
|
||||
if self.get_display_rule("lines"):
|
||||
self.scene_create_lines_for_cp(cp)
|
||||
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
from PySide2.QtCore import QPoint, QRect, QPointF
|
||||
from PySide2.QtGui import QPainter
|
||||
from PySide2.QtWidgets import QGraphicsRectItem
|
||||
|
||||
import qt_ui.uiconstants as CONST
|
||||
from game import db
|
||||
from theater import TheaterGroundObject, ControlPoint
|
||||
|
||||
|
||||
@ -33,7 +35,6 @@ class QMapGroundObject(QGraphicsRectItem):
|
||||
|
||||
def paint(self, painter, option, widget=None):
|
||||
#super(QMapControlPoint, self).paint(painter, option, widget)
|
||||
|
||||
if self.parent.get_display_rule("go"):
|
||||
painter.save()
|
||||
if not self.model.is_dead and not self.cp.captured:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user