mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
refactor of previous commits
refactor to enum typing and many other fixes fix tests attempt to fix some typescript more typescript fixes more typescript test fixes revert all API changes update to pydcs mypy fixes Use properties to check if player is blue/red/neutral update requirements.txt black -_- bump pydcs and fix mypy add opponent property bump pydcs
This commit is contained in:
@@ -19,7 +19,7 @@ from game.config import REWARDS
|
||||
from game.data.building_data import FORTIFICATION_BUILDINGS
|
||||
from game.server import EventStream
|
||||
from game.sim.gameupdateevents import GameUpdateEvents
|
||||
from game.theater import ControlPoint, TheaterGroundObject
|
||||
from game.theater import ControlPoint, TheaterGroundObject, Player
|
||||
from game.theater.theatergroundobject import (
|
||||
BuildingGroundObject,
|
||||
)
|
||||
@@ -87,12 +87,12 @@ class QGroundObjectMenu(QDialog):
|
||||
|
||||
if isinstance(self.ground_object, BuildingGroundObject):
|
||||
self.mainLayout.addWidget(self.buildingBox)
|
||||
if self.cp.captured:
|
||||
if self.cp.captured.is_blue:
|
||||
self.mainLayout.addWidget(self.financesBox)
|
||||
else:
|
||||
self.mainLayout.addWidget(self.intelBox)
|
||||
self.mainLayout.addWidget(self.orientationBox)
|
||||
if self.ground_object.is_iads and self.cp.is_friendly(to_player=False):
|
||||
if self.ground_object.is_iads and self.cp.is_friendly(to_player=Player.RED):
|
||||
self.mainLayout.addWidget(self.hiddenBox)
|
||||
|
||||
self.actionLayout = QHBoxLayout()
|
||||
@@ -118,8 +118,10 @@ class QGroundObjectMenu(QDialog):
|
||||
|
||||
@property
|
||||
def show_buy_sell_actions(self) -> bool:
|
||||
if self.cp.captured.is_neutral:
|
||||
return False
|
||||
buysell_allowed = self.game.settings.enable_enemy_buy_sell
|
||||
buysell_allowed |= self.cp.captured
|
||||
buysell_allowed |= self.cp.captured.is_blue
|
||||
return buysell_allowed
|
||||
|
||||
def doLayout(self):
|
||||
@@ -133,7 +135,7 @@ class QGroundObjectMenu(QDialog):
|
||||
QLabel(f"<b>Unit {str(unit.display_name)}</b>"), i, 0
|
||||
)
|
||||
|
||||
if not unit.alive and unit.repairable and self.cp.captured:
|
||||
if not unit.alive and unit.repairable and self.cp.captured.is_blue:
|
||||
price = unit.unit_type.price if unit.unit_type else 0
|
||||
repair = QPushButton(f"Repair [{price}M]")
|
||||
repair.setProperty("style", "btn-success")
|
||||
|
||||
Reference in New Issue
Block a user