mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
28 lines
750 B
Python
28 lines
750 B
Python
import random
|
|
|
|
from gen.sam.group_generator import GroupGenerator
|
|
|
|
|
|
class ArmoredGroupGenerator(GroupGenerator):
|
|
|
|
def __init__(self, game, ground_object, unit_type):
|
|
super(ArmoredGroupGenerator, self).__init__(game, ground_object)
|
|
self.unit_type = unit_type
|
|
|
|
def generate(self):
|
|
|
|
grid_x = random.randint(2, 3)
|
|
grid_y = random.randint(1, 2)
|
|
|
|
spacing = random.randint(30, 80)
|
|
|
|
index = 0
|
|
for i in range(grid_x):
|
|
for j in range(grid_y):
|
|
index = index + 1
|
|
self.add_unit(self.unit_type, "Armor#" + str(index),
|
|
self.position.x + spacing * i,
|
|
self.position.y + spacing * j, self.heading)
|
|
|
|
|