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
4 changed files with 40 additions and 5 deletions

View File

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

View File

@@ -66,6 +66,18 @@ class TheaterUnit:
if self.ground_object.is_iads:
iads = self.ground_object.control_point.coalition.game.theater.iads_network
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
def unit_name(self) -> str: