Add all helipads to single group per FARP allowing take off from parking behavour

cherry-pick from a70a951192390cc2e9afa41dc32b567ac81f9f06 with adoptions
This commit is contained in:
Ben Birch 2022-01-30 15:04:53 +11:00 committed by RndName
parent d23b1fbb2c
commit a6e1dc14c3
No known key found for this signature in database
GPG Key ID: 5EF516FD9537F7C0
2 changed files with 21 additions and 17 deletions

View File

@ -590,12 +590,12 @@ class AircraftConflictGenerator:
)
# 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 start_type != "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(count - 1):
try:

View File

@ -608,42 +608,46 @@ 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
).point_from_heading(helipad.heading.degrees + 90, 10),
heading=pad.heading,
)
neutral_country.add_static_group(sg)
class GroundObjectsGenerator: