mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Fix helipad creation
Only create a Farp StaticGroup when there are actual helipads. This prevents accidental creation of a helipad at the position of a carrier.
This commit is contained in:
parent
af4a718fc7
commit
a53812c0fb
@ -524,12 +524,7 @@ class HelipadGenerator:
|
|||||||
self.game = game
|
self.game = game
|
||||||
self.radio_registry = radio_registry
|
self.radio_registry = radio_registry
|
||||||
self.tacan_registry = tacan_registry
|
self.tacan_registry = tacan_registry
|
||||||
self.helipads = self.m.farp(
|
self.helipads: Optional[StaticGroup] = None
|
||||||
self.m.country(self.game.neutral_country.name),
|
|
||||||
self.cp.name + "_helipad",
|
|
||||||
self.cp.position,
|
|
||||||
farp_type="InvisibleFARP",
|
|
||||||
)
|
|
||||||
|
|
||||||
def generate(self) -> None:
|
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)
|
# This gets called for every control point, so we don't want to add an empty group (causes DCS mission editor to crash)
|
||||||
@ -542,13 +537,19 @@ class HelipadGenerator:
|
|||||||
for i, helipad in enumerate(self.cp.helipads):
|
for i, helipad in enumerate(self.cp.helipads):
|
||||||
heading = helipad.heading.degrees
|
heading = helipad.heading.degrees
|
||||||
name_i = self.cp.name + "_helipad" + "_" + str(i)
|
name_i = self.cp.name + "_helipad" + "_" + str(i)
|
||||||
if i == 0:
|
if self.helipads is None:
|
||||||
pad = self.helipads.units[0]
|
self.helipads = self.m.farp(
|
||||||
|
self.m.country(self.game.neutral_country.name),
|
||||||
|
name_i,
|
||||||
|
helipad,
|
||||||
|
farp_type="InvisibleFARP",
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
# Create a new Helipad Unit
|
# Create a new Helipad Unit
|
||||||
pad = InvisibleFARP(self.m.terrain, unit_id=self.m.next_unit_id())
|
self.helipads.add_unit(
|
||||||
self.helipads.add_unit(pad)
|
InvisibleFARP(self.m.terrain, self.m.next_unit_id(), name_i)
|
||||||
pad.name = name_i
|
)
|
||||||
|
pad = self.helipads.units[-1]
|
||||||
pad.position = helipad
|
pad.position = helipad
|
||||||
pad.heading = heading
|
pad.heading = heading
|
||||||
# Generate a FARP Ammo and Fuel stack for each pad
|
# Generate a FARP Ammo and Fuel stack for each pad
|
||||||
@ -612,7 +613,8 @@ class TgoGenerator:
|
|||||||
self.m, cp, self.game, self.radio_registry, self.tacan_registry
|
self.m, cp, self.game, self.radio_registry, self.tacan_registry
|
||||||
)
|
)
|
||||||
helipad_gen.generate()
|
helipad_gen.generate()
|
||||||
self.helipads[cp] = helipad_gen.helipads
|
if helipad_gen.helipads is not None:
|
||||||
|
self.helipads[cp] = helipad_gen.helipads
|
||||||
|
|
||||||
for ground_object in cp.ground_objects:
|
for ground_object in cp.ground_objects:
|
||||||
generator: GroundObjectGenerator
|
generator: GroundObjectGenerator
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user