Fix error in mission caused by wrong farp creation

This commit is contained in:
RndName 2022-02-24 21:46:05 +01:00
parent e4aedc9e83
commit c88fa6d2af
No known key found for this signature in database
GPG Key ID: 5EF516FD9537F7C0

View File

@ -530,56 +530,45 @@ class HelipadGenerator:
# This gets called for every control point, so we don't want to add an empty group (causes DCS mission editor to crash) # 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: if len(self.cp.helipads) == 0:
return return
# Note: Helipad are generated as neutral object in order not to interfer with # Note: Helipad are generated as neutral object in order not to interfer with
# capture triggers # capture triggers
neutral_country = self.m.country(self.game.neutral_country.name) neutral_country = self.m.country(self.game.neutral_country.name)
country = self.m.country(self.game.coalition_for(self.cp.captured).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(self.cp.position)
sg.add_point(sp)
for i, helipad in enumerate(self.cp.helipads): for i, helipad in enumerate(self.cp.helipads):
# This is used as a trigger of the number of available pads when spawning flights heading = helipad.heading.degrees
self.helipads.append(sg) name_i = self.cp.name + "_helipad" + "_" + str(i)
name_i = name + "_" + str(i)
logging.info("Generating helipad static : " + name_i)
pad = self.m.farp( pad = self.m.farp(
country, neutral_country,
name_i, name_i,
helipad, helipad,
heading=helipad.heading.degrees, heading=heading,
farp_type="InvisibleFARP", farp_type="InvisibleFARP",
) )
sg.add_unit(pad) self.helipads.append(pad)
# Generate a FARP Ammo and Fuel stack for each pad # Generate a FARP Ammo and Fuel stack for each pad
self.m.static_group( self.m.static_group(
country=country, country=country,
name=(name_i + "_fuel"), name=(name_i + "_fuel"),
_type=Fortification.FARP_Fuel_Depot, _type=Fortification.FARP_Fuel_Depot,
position=pad.position.point_from_heading(helipad.heading.degrees, 35), position=helipad.point_from_heading(heading, 35),
heading=pad.heading, heading=heading,
) )
self.m.static_group( self.m.static_group(
country=country, country=country,
name=(name_i + "_ammo"), name=(name_i + "_ammo"),
_type=Fortification.FARP_Ammo_Dump_Coating, _type=Fortification.FARP_Ammo_Dump_Coating,
position=pad.position.point_from_heading( position=helipad.point_from_heading(heading, 35).point_from_heading(
helipad.heading.degrees, 35 heading + 90, 10
).point_from_heading(helipad.heading.degrees + 90, 10), ),
heading=pad.heading, heading=heading,
) )
self.m.static_group( self.m.static_group(
country=country, country=country,
name=(name_i + "_ws"), name=(name_i + "_ws"),
_type=Fortification.Windsock, _type=Fortification.Windsock,
position=pad.position.point_from_heading( position=helipad.point_from_heading(heading + 45, 35),
helipad.heading.degrees + 45, 35 heading=heading,
),
heading=pad.heading,
) )
neutral_country.add_static_group(sg)
class TgoGenerator: class TgoGenerator: