Disband squadrons sinking with ship + Sink/Resurrect cheat

This commit is contained in:
Raffson 2024-06-30 01:41:09 +02:00
parent 22f7767b99
commit 6dc5296130
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99
4 changed files with 40 additions and 5 deletions

View File

@ -18,12 +18,14 @@
* **[Campaign Design]** Support for Kola map by Orbx * **[Campaign Design]** Support for Kola map by Orbx
* **[UI]** Zoom level retained when switching campaigns * **[UI]** Zoom level retained when switching campaigns
* **[UX]** Allow changing squadrons in flight's edit dialog * **[UX]** Allow changing squadrons in flight's edit dialog
* **[Cheats]** Sink/Resurrect carriers instead of showing an error during cheat-capture (use AWCD-cheat to add squadrons upon resurrection)
## Fixes ## Fixes
* **[UI/UX]** A-10A flights can be edited again * **[UI/UX]** A-10A flights can be edited again
* **[Mission Generation]** IADS bug sometimes triggering "no skynet usable units" error during mission generation * **[Mission Generation]** IADS bug sometimes triggering "no skynet usable units" error during mission generation
* **[New Game Wizard]** Campaign errors show a dialog again and avoid CTDs * **[New Game Wizard]** Campaign errors show a dialog again and avoid CTDs
* **[UI]** Landmap wasn't updating when switching to a different theater * **[UI]** Landmap wasn't updating when switching to a different theater
* **[Mission Results Processor]** Squadrons of a sunken carrier are now disbanded
# Retribution v1.3.1 # Retribution v1.3.1
#### Note: Re-save your missions in DCS' Mission Editor to avoid possible crashes due to datalink (usually the case when F-16C blk50s are used) when hosting missions on a dedicated server. #### Note: Re-save your missions in DCS' Mission Editor to avoid possible crashes due to datalink (usually the case when F-16C blk50s are used) when hosting missions on a dedicated server.

View File

@ -283,6 +283,10 @@ class TheaterGroundObject(MissionTarget, SidcDescribable, ABC):
def coalition(self) -> Coalition: def coalition(self) -> Coalition:
return self.control_point.coalition return self.control_point.coalition
@property
def is_naval_control_point(self) -> bool:
return False
class BuildingGroundObject(TheaterGroundObject): class BuildingGroundObject(TheaterGroundObject):
def __init__( def __init__(
@ -384,6 +388,10 @@ class GenericCarrierGroundObject(NavalGroundObject, ABC):
def is_control_point(self) -> bool: def is_control_point(self) -> bool:
return True return True
@property
def is_naval_control_point(self) -> bool:
return True
# TODO: Why is this both a CP and a TGO? # TODO: Why is this both a CP and a TGO?
class CarrierGroundObject(GenericCarrierGroundObject): class CarrierGroundObject(GenericCarrierGroundObject):

View File

@ -66,6 +66,18 @@ class TheaterUnit:
if self.ground_object.is_iads: if self.ground_object.is_iads:
iads = self.ground_object.control_point.coalition.game.theater.iads_network iads = self.ground_object.control_point.coalition.game.theater.iads_network
iads.update_tgo(self.ground_object, events) iads.update_tgo(self.ground_object, events)
if self.ground_object.is_naval_control_point:
cp = self.ground_object.control_point
for squadron in cp.squadrons:
cp.coalition.air_wing.squadrons[squadron.aircraft].remove(squadron)
def revive(self, events: GameUpdateEvents) -> None:
self.alive = True
self.ground_object.threat_poly()
events.update_tgo(self.ground_object)
if self.ground_object.is_iads:
iads = self.ground_object.control_point.coalition.game.theater.iads_network
iads.update_tgo(self.ground_object, events)
@property @property
def unit_name(self) -> str: def unit_name(self) -> str:

View File

@ -159,7 +159,8 @@ class QBaseMenu2(QDialog):
transfer_button.clicked.connect(self.open_transfer_dialog) transfer_button.clicked.connect(self.open_transfer_dialog)
if self.cheat_capturable: if self.cheat_capturable:
capture_button = QPushButton("CHEAT: Capture") label = "Sink/Resurrect" if self.cp.is_fleet else "Capture"
capture_button = QPushButton(f"CHEAT: {label}")
capture_button.setProperty("style", "btn-danger") capture_button.setProperty("style", "btn-danger")
bottom_row.addWidget(capture_button) bottom_row.addWidget(capture_button)
capture_button.clicked.connect(self.cheat_capture) capture_button.clicked.connect(self.cheat_capture)
@ -181,11 +182,23 @@ class QBaseMenu2(QDialog):
def cheat_capture(self) -> None: def cheat_capture(self) -> None:
events = GameUpdateEvents() events = GameUpdateEvents()
self.cp.capture(self.game_model.game, events, for_player=not self.cp.captured) if self.cp.is_fleet:
for go in self.cp.ground_objects:
if go.is_naval_control_point:
if go.alive_unit_count > 0:
for u in go.units:
u.kill(events)
else:
for u in go.units:
u.revive(events)
else:
self.cp.capture(
self.game_model.game, events, for_player=not self.cp.captured
)
mrp = MissionResultsProcessor(self.game_model.game) mrp = MissionResultsProcessor(self.game_model.game)
mrp.redeploy_units(self.cp) mrp.redeploy_units(self.cp)
# Reinitialized ground planners and the like. The ATO needs to be reset because # Reinitialized ground planners and the like. The ATO needs to be reset because
# missions planned against the flipped base are no longer valid. # missions planned against the flipped base (or killed carrier) are no longer valid.
self.game_model.game.initialize_turn(events) self.game_model.game.initialize_turn(events)
EventStream.put_nowait(events) EventStream.put_nowait(events)
GameUpdateSignal.get_instance().updateGame(self.game_model.game) GameUpdateSignal.get_instance().updateGame(self.game_model.game)