mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Attempt at fixing Carrier killed in state.json but not being removed from game, issue #2405. GenericCarrierGenerator.generate() will now generate the ship group with an array that only contains alive ship units, just like GroundObjectGenerator.generate() has previously done.
Carrier groups will now also show up as destroyed/damaged on the map when the carrier is sunk. cherry-pick from e53dc5b80b77154db5271cc9f03bb9e98f79febe
This commit is contained in:
parent
bfed69573f
commit
bde22b52ea
@ -405,7 +405,17 @@ class GenericCarrierGenerator(GroundObjectGenerator):
|
|||||||
logging.warning(f"Found empty carrier group in {self.control_point}")
|
logging.warning(f"Found empty carrier group in {self.control_point}")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
ship_group = self.create_ship_group(group.group_name, group.units, atc)
|
ship_units = []
|
||||||
|
for unit in group.units:
|
||||||
|
if unit.alive:
|
||||||
|
# All alive Ships
|
||||||
|
ship_units.append(unit)
|
||||||
|
|
||||||
|
if not ship_units:
|
||||||
|
# Empty array (no alive units), stop here
|
||||||
|
return
|
||||||
|
|
||||||
|
ship_group = self.create_ship_group(group.group_name, ship_units, atc)
|
||||||
|
|
||||||
# Always steam into the wind, even if the carrier is being moved.
|
# Always steam into the wind, even if the carrier is being moved.
|
||||||
# There are multiple unsimulated hours between turns, so we can
|
# There are multiple unsimulated hours between turns, so we can
|
||||||
@ -414,7 +424,7 @@ class GenericCarrierGenerator(GroundObjectGenerator):
|
|||||||
brc = self.steam_into_wind(ship_group)
|
brc = self.steam_into_wind(ship_group)
|
||||||
|
|
||||||
# Set Carrier Specific Options
|
# Set Carrier Specific Options
|
||||||
if g_id == 0:
|
if g_id == 0 and self.control_point.runway_is_operational():
|
||||||
# Get Correct unit type for the carrier.
|
# Get Correct unit type for the carrier.
|
||||||
# This will upgrade to super carrier if option is enabled
|
# This will upgrade to super carrier if option is enabled
|
||||||
carrier_type = self.carrier_type
|
carrier_type = self.carrier_type
|
||||||
|
|||||||
@ -1200,7 +1200,7 @@ class NavalControlPoint(ControlPoint, ABC):
|
|||||||
# while its escorts are still alive.
|
# while its escorts are still alive.
|
||||||
for group in self.find_main_tgo().groups:
|
for group in self.find_main_tgo().groups:
|
||||||
for u in group.units:
|
for u in group.units:
|
||||||
if u.type in [
|
if u.alive and u.type in [
|
||||||
Forrestal,
|
Forrestal,
|
||||||
Stennis,
|
Stennis,
|
||||||
LHA_Tarawa,
|
LHA_Tarawa,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user