Single ShipGroupGenerator added

This commit is contained in:
walterroach
2020-11-03 15:13:24 -06:00
committed by Dan Albert
parent 4ca92ea22d
commit 9087f3487d
10 changed files with 68 additions and 69 deletions

View File

@@ -11,6 +11,9 @@ from gen.fleet.ru_dd_group import RussianNavyGroupGenerator, GrishaGroupGenerato
from gen.fleet.schnellboot import SchnellbootGroupGenerator
from gen.fleet.uboat import UBoatGroupGenerator
from gen.fleet.ww2lst import WW2LSTGroupGenerator
# from dcs import unitgroup
# from dcs.unit import Ship
SHIP_MAP = {
"SchnellbootGroupGenerator": SchnellbootGroupGenerator,
@@ -68,4 +71,27 @@ def generate_lha_group(faction:str, game, ground_object):
"""
generator = LHAGroupGenerator(game, ground_object, db.FACTIONS[faction])
generator.generate()
return generator.get_generated_group()
return generator.get_generated_group()
# class ShipGroupGenerator(GroupGenerator):
# """Abstract class for other ship generator classes"""
# def __init__(self, game, ground_object, faction):
# self.game = game
# self.go = ground_object
# self.position = ground_object.position
# self.heading = random.randint(0, 359)
# self.faction = faction
# self.vg = unitgroup.ShipGroup(self.game.next_group_id(), self.groupNamePrefix + self.go.group_identifier)
# wp = self.vg.add_waypoint(self.position, 0)
# wp.ETA_locked = True
# def add_unit(self, unit_type, name, pos_x, pos_y, heading):
# nn = "cgroup|" + str(self.go.cp_id) + '|' + str(self.go.group_id) + '|' + str(self.go.group_identifier) + "|" + name
# unit = Ship(self.game.next_unit_id(),
# nn, unit_type)
# unit.position.x = pos_x
# unit.position.y = pos_y
# unit.heading = heading
# self.vg.add_unit(unit)
# return unit