mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
39 lines
1.4 KiB
Python
39 lines
1.4 KiB
Python
import random
|
|
|
|
from dcs.vehicles import AirDefence, Unarmed
|
|
|
|
from gen.sam.group_generator import GroupGenerator
|
|
|
|
GFLAK = [AirDefence.AAA_Flak_Vierling_38, AirDefence.AAA_8_8cm_Flak_18, AirDefence.AAA_8_8cm_Flak_36, AirDefence.AAA_8_8cm_Flak_37, AirDefence.AAA_8_8cm_Flak_41, AirDefence.AAA_Flak_38]
|
|
|
|
class FlakGenerator(GroupGenerator):
|
|
"""
|
|
This generate a German flak artillery group
|
|
"""
|
|
|
|
def generate(self):
|
|
grid_x = random.randint(2, 4)
|
|
grid_y = random.randint(2, 4)
|
|
|
|
spacing = random.randint(30,60)
|
|
|
|
index = 0
|
|
mixed = random.choice([True, False])
|
|
unit_type = random.choice(GFLAK)
|
|
|
|
for i in range(grid_x):
|
|
for j in range(grid_y):
|
|
index = index+1
|
|
self.add_unit(unit_type, "AAA#" + str(index),
|
|
self.position.x + spacing*i + random.randint(1,5),
|
|
self.position.y + spacing*j + random.randint(1,5), self.heading)
|
|
|
|
if(mixed):
|
|
unit_type = random.choice(GFLAK)
|
|
|
|
# Enough Opel Blitz truck to transport the guns
|
|
for i in range(grid_x):
|
|
for j in range(grid_y):
|
|
self.add_unit(Unarmed.Blitz_3_6_6700A, "AAA#" + str(index),
|
|
self.position.x + 200 + 15*i + random.randint(1,5),
|
|
self.position.y + 15*j + random.randint(1,5), 90) |