mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Only allow recruiting carrier units in aircraft carrier groups. Generate one group on carrier when possible.
This commit is contained in:
@@ -69,7 +69,7 @@ class QLiberationMap(QGraphicsView):
|
||||
#self.add_game_events()
|
||||
|
||||
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,
|
||||
|
||||
@@ -30,29 +30,33 @@ class QMapControlPoint(QGraphicsRectItem):
|
||||
painter.setBrush(self.brush_color)
|
||||
painter.setPen(self.pen_color)
|
||||
|
||||
if self.isUnderMouse():
|
||||
painter.setBrush(CONST.COLORS["white"])
|
||||
painter.setPen(self.pen_color)
|
||||
if self.model.has_runway():
|
||||
if self.isUnderMouse():
|
||||
painter.setBrush(CONST.COLORS["white"])
|
||||
painter.setPen(self.pen_color)
|
||||
|
||||
r = option.rect
|
||||
painter.drawChord(r, -180*16, -180*16)
|
||||
r = option.rect
|
||||
painter.drawChord(r, -180*16, -180*16)
|
||||
|
||||
gauge = QRect(r.x(),
|
||||
r.y()+CONST.CP_SIZE/2 + 2,
|
||||
r.width(),
|
||||
CONST.CP_SIZE / 4)
|
||||
gauge = QRect(r.x(),
|
||||
r.y()+CONST.CP_SIZE/2 + 2,
|
||||
r.width(),
|
||||
CONST.CP_SIZE / 4)
|
||||
|
||||
painter.setBrush(CONST.COLORS["bright_red"])
|
||||
painter.setPen(CONST.COLORS["black"])
|
||||
painter.drawRect(gauge)
|
||||
painter.setBrush(CONST.COLORS["bright_red"])
|
||||
painter.setPen(CONST.COLORS["black"])
|
||||
painter.drawRect(gauge)
|
||||
|
||||
gauge2 = QRect(r.x(),
|
||||
r.y() + CONST.CP_SIZE / 2 + 2,
|
||||
r.width()*self.model.base.strength,
|
||||
CONST.CP_SIZE / 4)
|
||||
gauge2 = QRect(r.x(),
|
||||
r.y() + CONST.CP_SIZE / 2 + 2,
|
||||
r.width()*self.model.base.strength,
|
||||
CONST.CP_SIZE / 4)
|
||||
|
||||
painter.setBrush(CONST.COLORS["green"])
|
||||
painter.drawRect(gauge2)
|
||||
painter.setBrush(CONST.COLORS["green"])
|
||||
painter.drawRect(gauge2)
|
||||
else:
|
||||
# TODO : not drawing sunk carriers. Can be improved to display sunk carrier.
|
||||
pass
|
||||
painter.restore()
|
||||
|
||||
def hoverEnterEvent(self, event: QGraphicsSceneHoverEvent):
|
||||
|
||||
@@ -6,7 +6,7 @@ from PySide2.QtWidgets import QHBoxLayout, QLabel, QWidget, QDialog, QVBoxLayout
|
||||
QGroupBox, QSizePolicy, QSpacerItem
|
||||
from dcs.unittype import UnitType
|
||||
|
||||
from game.event import UnitsDeliveryEvent
|
||||
from game.event import UnitsDeliveryEvent, ControlPointType
|
||||
from qt_ui.widgets.QBudgetBox import QBudgetBox
|
||||
from qt_ui.widgets.base.QAirportInformation import QAirportInformation
|
||||
from qt_ui.widgets.base.QBaseInformation import QBaseInformation
|
||||
@@ -23,6 +23,7 @@ class QBaseMenu(QDialog):
|
||||
|
||||
self.cp = controlPoint
|
||||
self.game = game
|
||||
self.is_carrier = self.cp.cptype in [ControlPointType.AIRCRAFT_CARRIER_GROUP, ControlPointType.LHA_GROUP]
|
||||
|
||||
try:
|
||||
self.airport = game.theater.terrain.airport_by_id(self.cp.id)
|
||||
@@ -98,6 +99,9 @@ class QBaseMenu(QDialog):
|
||||
|
||||
for task_type in units.keys():
|
||||
|
||||
if task_type == PinpointStrike and self.is_carrier:
|
||||
continue
|
||||
|
||||
units_column = list(set(units[task_type]))
|
||||
if len(units_column) == 0: continue
|
||||
units_column.sort(key=lambda x: db.PRICES[x])
|
||||
@@ -107,6 +111,8 @@ class QBaseMenu(QDialog):
|
||||
task_box.setLayout(task_box_layout)
|
||||
row = 0
|
||||
for unit_type in units_column:
|
||||
if self.is_carrier and not unit_type in db.CARRIER_CAPABLE:
|
||||
continue
|
||||
row = self.add_purchase_row(unit_type, task_box_layout, row)
|
||||
|
||||
stretch = QVBoxLayout()
|
||||
|
||||
Reference in New Issue
Block a user