mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Fine-tune TGO-purchasability logic
This commit is contained in:
parent
2c270306a1
commit
f9e7772e09
@ -376,7 +376,7 @@ class NavalGroundObject(TheaterGroundObject, ABC):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def purchasable(self) -> bool:
|
def purchasable(self) -> bool:
|
||||||
return False
|
return self.control_point.coalition.game.turn == 0
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_iads(self) -> bool:
|
def is_iads(self) -> bool:
|
||||||
@ -460,7 +460,7 @@ class MissileSiteGroundObject(TheaterGroundObject):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def purchasable(self) -> bool:
|
def purchasable(self) -> bool:
|
||||||
return False
|
return self.control_point.coalition.game.turn == 0
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def should_head_to_conflict(self) -> bool:
|
def should_head_to_conflict(self) -> bool:
|
||||||
@ -501,7 +501,7 @@ class CoastalSiteGroundObject(TheaterGroundObject):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def purchasable(self) -> bool:
|
def purchasable(self) -> bool:
|
||||||
return False
|
return self.control_point.coalition.game.turn == 0
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def should_head_to_conflict(self) -> bool:
|
def should_head_to_conflict(self) -> bool:
|
||||||
|
|||||||
@ -33,6 +33,8 @@ from game.theater.theatergroundobject import (
|
|||||||
SamGroundObject,
|
SamGroundObject,
|
||||||
VehicleGroupGroundObject,
|
VehicleGroupGroundObject,
|
||||||
ShipGroundObject,
|
ShipGroundObject,
|
||||||
|
MissileSiteGroundObject,
|
||||||
|
CoastalSiteGroundObject,
|
||||||
)
|
)
|
||||||
from qt_ui.uiconstants import EVENT_ICONS
|
from qt_ui.uiconstants import EVENT_ICONS
|
||||||
|
|
||||||
@ -282,6 +284,12 @@ class QGroundObjectBuyMenu(QDialog):
|
|||||||
elif isinstance(ground_object, ShipGroundObject):
|
elif isinstance(ground_object, ShipGroundObject):
|
||||||
role = GroupRole.NAVAL
|
role = GroupRole.NAVAL
|
||||||
tasks.append(GroupTask.NAVY)
|
tasks.append(GroupTask.NAVY)
|
||||||
|
elif isinstance(ground_object, MissileSiteGroundObject):
|
||||||
|
role = GroupRole.DEFENSES
|
||||||
|
tasks.append(GroupTask.MISSILE)
|
||||||
|
elif isinstance(ground_object, CoastalSiteGroundObject):
|
||||||
|
role = GroupRole.DEFENSES
|
||||||
|
tasks.append(GroupTask.COASTAL)
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError(f"Unhandled TGO type {ground_object.__class__}")
|
raise NotImplementedError(f"Unhandled TGO type {ground_object.__class__}")
|
||||||
|
|
||||||
|
|||||||
@ -104,14 +104,14 @@ class QGroundObjectMenu(QDialog):
|
|||||||
self.buy_replace.clicked.connect(self.buy_group)
|
self.buy_replace.clicked.connect(self.buy_group)
|
||||||
self.buy_replace.setProperty("style", "btn-success")
|
self.buy_replace.setProperty("style", "btn-success")
|
||||||
|
|
||||||
if self.ground_object.purchasable or self.game.turn == 0:
|
if self.ground_object.purchasable:
|
||||||
|
# if not purchasable but is_iads => naval unit
|
||||||
if self.total_value > 0:
|
if self.total_value > 0:
|
||||||
self.actionLayout.addWidget(self.sell_all_button)
|
self.actionLayout.addWidget(self.sell_all_button)
|
||||||
self.actionLayout.addWidget(self.buy_replace)
|
self.actionLayout.addWidget(self.buy_replace)
|
||||||
|
|
||||||
if self.show_buy_sell_actions and (
|
if self.show_buy_sell_actions and self.ground_object.purchasable:
|
||||||
self.ground_object.purchasable or self.game.turn == 0
|
# if not purchasable but is_iads => naval unit
|
||||||
):
|
|
||||||
self.mainLayout.addLayout(self.actionLayout)
|
self.mainLayout.addLayout(self.actionLayout)
|
||||||
self.setLayout(self.mainLayout)
|
self.setLayout(self.mainLayout)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user