mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Essex as AircraftCarrier hack (#541)
This commit is contained in:
parent
f1eb514295
commit
c15b4ac83f
@ -1510,6 +1510,11 @@ class Carrier(NavalControlPoint):
|
|||||||
return "cv"
|
return "cv"
|
||||||
|
|
||||||
|
|
||||||
|
class EssexCarrier(Carrier):
|
||||||
|
def can_operate(self, aircraft: AircraftType) -> bool:
|
||||||
|
return aircraft.lha_capable
|
||||||
|
|
||||||
|
|
||||||
class Lha(NavalControlPoint):
|
class Lha(NavalControlPoint):
|
||||||
def __init__(
|
def __init__(
|
||||||
self, name: str, at: Point, theater: ConflictTheater, starts_blue: bool
|
self, name: str, at: Point, theater: ConflictTheater, starts_blue: bool
|
||||||
|
|||||||
@ -13,7 +13,12 @@ from game import Game
|
|||||||
from game.factions.faction import Faction
|
from game.factions.faction import Faction
|
||||||
from game.naming import namegen
|
from game.naming import namegen
|
||||||
from game.scenery_group import SceneryGroup
|
from game.scenery_group import SceneryGroup
|
||||||
from game.theater import PointWithHeading, PresetLocation, NavalControlPoint
|
from game.theater import (
|
||||||
|
PointWithHeading,
|
||||||
|
PresetLocation,
|
||||||
|
NavalControlPoint,
|
||||||
|
EssexCarrier,
|
||||||
|
)
|
||||||
from game.theater.theatergroundobject import (
|
from game.theater.theatergroundobject import (
|
||||||
BuildingGroundObject,
|
BuildingGroundObject,
|
||||||
IadsBuildingGroundObject,
|
IadsBuildingGroundObject,
|
||||||
@ -322,6 +327,7 @@ class CarrierGroundObjectGenerator(GenericCarrierGroundObjectGenerator):
|
|||||||
logging.error(f"{self.faction_name} has no access to AircraftCarrier")
|
logging.error(f"{self.faction_name} has no access to AircraftCarrier")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
self.transform_to_essex_if_needed(unit_group)
|
||||||
self.generate_ground_object_from_group(
|
self.generate_ground_object_from_group(
|
||||||
unit_group,
|
unit_group,
|
||||||
PresetLocation(
|
PresetLocation(
|
||||||
@ -334,6 +340,21 @@ class CarrierGroundObjectGenerator(GenericCarrierGroundObjectGenerator):
|
|||||||
self.apply_carrier_config()
|
self.apply_carrier_config()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def transform_to_essex_if_needed(self, unit_group: ForceGroup) -> None:
|
||||||
|
classes = [u.unit_class for u in unit_group.units]
|
||||||
|
if any([c for c in classes if c == UnitClass.HELICOPTER_CARRIER]) and not any(
|
||||||
|
[c for c in classes if c == UnitClass.AIRCRAFT_CARRIER]
|
||||||
|
):
|
||||||
|
self.game.theater.controlpoints.remove(self.control_point)
|
||||||
|
self.control_point = EssexCarrier(
|
||||||
|
self.control_point.name,
|
||||||
|
self.control_point.position,
|
||||||
|
self.game.theater,
|
||||||
|
self.control_point.starts_blue,
|
||||||
|
)
|
||||||
|
self.control_point.finish_init(self.game)
|
||||||
|
self.game.theater.controlpoints.append(self.control_point)
|
||||||
|
|
||||||
|
|
||||||
class LhaGroundObjectGenerator(GenericCarrierGroundObjectGenerator):
|
class LhaGroundObjectGenerator(GenericCarrierGroundObjectGenerator):
|
||||||
def generate(self) -> bool:
|
def generate(self) -> bool:
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
name: WW2Essex
|
name: WW2Essex
|
||||||
tasks:
|
tasks:
|
||||||
- HelicopterCarrier
|
- AircraftCarrier
|
||||||
units:
|
units:
|
||||||
- USS Bennington (CV-20)
|
- USS Bennington (CV-20)
|
||||||
layouts:
|
layouts:
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
name: WW2 Essex Carrier
|
name: WW2 Essex Carrier
|
||||||
tasks:
|
tasks:
|
||||||
- HelicopterCarrier
|
- AircraftCarrier
|
||||||
groups:
|
groups:
|
||||||
- Carrier: # the word "Carrier" or "LHA" needs to be present in the group-name
|
- Carrier: # the word "Carrier" or "LHA" needs to be present in the group-name
|
||||||
- name: WW2 Carrier Group 0
|
- name: WW2 Carrier Group 0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user