mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Changed helipad generation structure as to not impact "Game" object, as suggested by Dan.
This commit is contained in:
@@ -9,6 +9,7 @@ from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import random
|
||||
from collections import defaultdict
|
||||
from typing import (
|
||||
Dict,
|
||||
Iterator,
|
||||
@@ -587,6 +588,7 @@ class HelipadGenerator:
|
||||
self.game = game
|
||||
self.radio_registry = radio_registry
|
||||
self.tacan_registry = tacan_registry
|
||||
self.helipads: list[StaticGroup] = []
|
||||
|
||||
def generate(self) -> None:
|
||||
|
||||
@@ -595,7 +597,7 @@ class HelipadGenerator:
|
||||
country = self.m.country(self.game.coalition_for(self.cp.captured).country_name)
|
||||
for i, helipad in enumerate(self.cp.helipads):
|
||||
name = self.cp.name + "_helipad_" + str(i)
|
||||
logging.info("Generating helipad : " + name)
|
||||
logging.info("Generating helipad static : " + name)
|
||||
pad = InvisibleFARP(name=name)
|
||||
pad.position = Point(helipad.x, helipad.y)
|
||||
pad.heading = helipad.heading.degrees
|
||||
@@ -606,8 +608,7 @@ class HelipadGenerator:
|
||||
sg.add_point(sp)
|
||||
neutral_country.add_static_group(sg)
|
||||
|
||||
helipad.static_unit = sg
|
||||
helipad.occupied = False
|
||||
self.helipads.append(sg)
|
||||
|
||||
# Generate a FARP Ammo and Fuel stack for each pad
|
||||
self.m.static_group(
|
||||
@@ -652,13 +653,18 @@ class GroundObjectsGenerator:
|
||||
self.unit_map = unit_map
|
||||
self.icls_alloc = iter(range(1, 21))
|
||||
self.runways: Dict[str, RunwayData] = {}
|
||||
self.helipads: dict[ControlPoint, list[StaticGroup]] = defaultdict(list)
|
||||
|
||||
def generate(self) -> None:
|
||||
for cp in self.game.theater.controlpoints:
|
||||
country = self.m.country(self.game.coalition_for(cp.captured).country_name)
|
||||
HelipadGenerator(
|
||||
|
||||
# Generate helipads
|
||||
helipad_gen = HelipadGenerator(
|
||||
self.m, cp, self.game, self.radio_registry, self.tacan_registry
|
||||
).generate()
|
||||
)
|
||||
helipad_gen.generate()
|
||||
self.helipads[cp] = helipad_gen.helipads
|
||||
|
||||
for ground_object in cp.ground_objects:
|
||||
generator: GenericGroundObjectGenerator[Any]
|
||||
|
||||
Reference in New Issue
Block a user