mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Merge pull request #1985 from bbirchnz/farp-stuck-helis
Add all helipads to single group per FARP allowing take off from parking behavour
This commit is contained in:
commit
079f19a66e
@ -228,6 +228,7 @@ class FlightGroupSpawner:
|
||||
|
||||
def _generate_at_cp_helipad(self, name: str, cp: ControlPoint) -> FlyingGroup[Any]:
|
||||
try:
|
||||
# helipad = self.helipads[cp][0]
|
||||
helipad = self.helipads[cp].pop()
|
||||
except IndexError as ex:
|
||||
raise RuntimeError(f"Not enough helipads available at {cp}") from ex
|
||||
@ -235,18 +236,18 @@ class FlightGroupSpawner:
|
||||
group = self._generate_at_group(name, helipad)
|
||||
|
||||
# Note : A bit dirty, need better support in pydcs
|
||||
group.points[0].action = PointAction.FromGroundArea
|
||||
group.points[0].type = "TakeOffGround"
|
||||
group.points[0].action = PointAction.FromParkingArea
|
||||
group.points[0].type = "TakeOffParking"
|
||||
group.units[0].heading = helipad.units[0].heading
|
||||
if self.start_type is not StartType.COLD:
|
||||
group.points[0].action = PointAction.FromGroundAreaHot
|
||||
group.points[0].type = "TakeOffGroundHot"
|
||||
group.points[0].action = PointAction.FromParkingArea
|
||||
group.points[0].type = "TakeOffParkingHot"
|
||||
|
||||
for i in range(self.flight.count - 1):
|
||||
group.units[1 + i].position = Point(helipad.x, helipad.y)
|
||||
group.units[1 + i].heading = helipad.units[0].heading
|
||||
try:
|
||||
helipad = self.helipads[cp].pop()
|
||||
group.units[1 + i].position = Point(helipad.x, helipad.y)
|
||||
group.units[1 + i].heading = helipad.units[0].heading
|
||||
self.helipads[cp].pop()
|
||||
except IndexError as ex:
|
||||
raise RuntimeError(f"Not enough helipads available at {cp}") from ex
|
||||
return group
|
||||
|
||||
@ -607,37 +607,40 @@ class HelipadGenerator:
|
||||
self.helipads: list[StaticGroup] = []
|
||||
|
||||
def generate(self) -> None:
|
||||
# This gets called for every control point, so we don't want to add an empty group (causes DCS mission editor to crash)
|
||||
if len(self.cp.helipads) == 0:
|
||||
return
|
||||
|
||||
# Note: Helipad are generated as neutral object in order not to interfer with
|
||||
# capture triggers
|
||||
neutral_country = self.m.country(self.game.neutral_country.name)
|
||||
country = self.m.country(self.game.coalition_for(self.cp.captured).country_name)
|
||||
name = self.cp.name + "_helipad"
|
||||
sg = unitgroup.StaticGroup(self.m.next_group_id(), name)
|
||||
sp = StaticPoint()
|
||||
sp.position = self.cp.position
|
||||
sg.add_point(sp)
|
||||
|
||||
for i, helipad in enumerate(self.cp.helipads):
|
||||
name = self.cp.name + "_helipad_" + str(i)
|
||||
logging.info("Generating helipad static : " + name)
|
||||
pad = InvisibleFARP(unit_id=self.m.next_unit_id(), name=name)
|
||||
# This is used as a trigger of the number of available pads when spawning flights
|
||||
self.helipads.append(sg)
|
||||
name_i = name + "_" + str(i)
|
||||
logging.info("Generating helipad static : " + name_i)
|
||||
pad = InvisibleFARP(unit_id=self.m.next_unit_id(), name=name_i)
|
||||
pad.position = Point(helipad.x, helipad.y)
|
||||
pad.heading = helipad.heading.degrees
|
||||
sg = unitgroup.StaticGroup(self.m.next_group_id(), name)
|
||||
sg.add_unit(pad)
|
||||
sp = StaticPoint()
|
||||
sp.position = pad.position
|
||||
sg.add_point(sp)
|
||||
neutral_country.add_static_group(sg)
|
||||
|
||||
self.helipads.append(sg)
|
||||
|
||||
# Generate a FARP Ammo and Fuel stack for each pad
|
||||
self.m.static_group(
|
||||
country=country,
|
||||
name=(name + "_fuel"),
|
||||
name=(name_i + "_fuel"),
|
||||
_type=Fortification.FARP_Fuel_Depot,
|
||||
position=pad.position.point_from_heading(helipad.heading.degrees, 35),
|
||||
heading=pad.heading,
|
||||
)
|
||||
self.m.static_group(
|
||||
country=country,
|
||||
name=(name + "_ammo"),
|
||||
name=(name_i + "_ammo"),
|
||||
_type=Fortification.FARP_Ammo_Dump_Coating,
|
||||
position=pad.position.point_from_heading(
|
||||
helipad.heading.degrees, 35
|
||||
@ -646,13 +649,14 @@ class HelipadGenerator:
|
||||
)
|
||||
self.m.static_group(
|
||||
country=country,
|
||||
name=(name + "_ws"),
|
||||
name=(name_i + "_ws"),
|
||||
_type=Fortification.Windsock,
|
||||
position=pad.position.point_from_heading(
|
||||
helipad.heading.degrees + 45, 35
|
||||
),
|
||||
heading=pad.heading,
|
||||
)
|
||||
neutral_country.add_static_group(sg)
|
||||
|
||||
|
||||
class TgoGenerator:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user