mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Properly determine Carrier/LHA TGO in apply_carrier_config
The first ground object of a naval control-point isn't always the CV or LHA, but can also be a different TGO if 1 or more TGOs are linked to the naval control point.
This commit is contained in:
parent
d2fd7bbb4e
commit
327c934ed3
@ -27,7 +27,13 @@ from . import (
|
||||
Fob,
|
||||
OffMapSpawn,
|
||||
)
|
||||
from .theatergroup import IadsGroundGroup, IadsRole, SceneryUnit, TheaterGroup
|
||||
from .theatergroup import (
|
||||
IadsGroundGroup,
|
||||
IadsRole,
|
||||
SceneryUnit,
|
||||
TheaterGroup,
|
||||
TheaterUnit,
|
||||
)
|
||||
from ..armedforces.armedforces import ArmedForces
|
||||
from ..armedforces.forcegroup import ForceGroup
|
||||
from ..campaignloader.campaignairwingconfig import CampaignAirWingConfig
|
||||
@ -241,7 +247,7 @@ class GenericCarrierGroundObjectGenerator(ControlPointGroundObjectGenerator):
|
||||
if ccfg := carrier_map.get(self.control_point.name):
|
||||
preferred_name = ccfg.preferred_name
|
||||
preferred_type = ccfg.preferred_type
|
||||
carrier_unit = self.control_point.ground_objects[0].groups[0].units[0]
|
||||
carrier_unit = self.get_carrier_unit()
|
||||
if preferred_type and preferred_type.dcs_unit_type in [
|
||||
v
|
||||
for k, v in country_dict[self.faction.country.id].Ship.__dict__.items() # type: ignore
|
||||
@ -268,6 +274,17 @@ class GenericCarrierGroundObjectGenerator(ControlPointGroundObjectGenerator):
|
||||
self.control_point.name
|
||||
)
|
||||
|
||||
def get_carrier_unit(self) -> TheaterUnit:
|
||||
carrier_go = [
|
||||
go
|
||||
for go in self.control_point.ground_objects
|
||||
if go.category in ["CARRIER", "LHA"]
|
||||
][0]
|
||||
groups = [
|
||||
g for g in carrier_go.groups if "Carrier" in g.name or "LHA" in g.name
|
||||
]
|
||||
return groups[0].units[0]
|
||||
|
||||
|
||||
class CarrierGroundObjectGenerator(GenericCarrierGroundObjectGenerator):
|
||||
def generate(self) -> bool:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user