Fix naval squadron retreat bug (#567)

This commit is contained in:
Druss99 2025-09-07 11:37:07 -04:00 committed by GitHub
parent e4586add72
commit 121ca20edb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 4 deletions

View File

@ -23,6 +23,7 @@
* **[Squadrons]** Fixed a bug where loading an air wing config would not properly load all squadrons
* **[Flight Plans]** Fixed a bug where SEAD flights would fire one ARM and RTB
* **[Plugins]** EW Script - Fix radar detection routine.
* **[Campaign]** Fixed a bug where sinking a destroyer in a carrier group would cause squadrons to be removed from the carrier
# Retribution v1.4.1 (hotfix)

View File

@ -8,7 +8,7 @@ from dcs.triggers import TriggerZone
from dcs.unittype import ShipType, StaticType, UnitType as DcsUnitType, VehicleType
from game.data.radar_db import LAUNCHER_TRACKER_PAIRS, TELARS, TRACK_RADARS
from game.data.units import ANTI_AIR_UNIT_CLASSES
from game.data.units import ANTI_AIR_UNIT_CLASSES, UnitClass
from game.dcs.groundunittype import GroundUnitType
from game.dcs.shipunittype import ShipUnitType
from game.dcs.unittype import UnitType
@ -82,9 +82,17 @@ class TheaterUnit:
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)
for unit in self.ground_object.units:
if (
unit.unit_type
and unit.unit_type.unit_class is UnitClass.AIRCRAFT_CARRIER
and not unit.alive
):
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