mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Fix ships being wrong unit type
This commit is contained in:
parent
e2682d633f
commit
4ca92ea22d
@ -1,14 +1,23 @@
|
|||||||
import random
|
import random
|
||||||
|
|
||||||
from gen.sam.group_generator import GroupGenerator
|
from gen.sam.group_generator import GroupGenerator
|
||||||
|
from dcs import unitgroup
|
||||||
|
from dcs.point import PointAction
|
||||||
|
from dcs.unit import Ship
|
||||||
from dcs.ships import *
|
from dcs.ships import *
|
||||||
|
|
||||||
|
|
||||||
class DDGroupGenerator(GroupGenerator):
|
class DDGroupGenerator(GroupGenerator):
|
||||||
|
|
||||||
def __init__(self, game, ground_object, faction, ddtype):
|
def __init__(self, game, ground_object, faction, ddtype):
|
||||||
super(DDGroupGenerator, self).__init__(game, ground_object)
|
self.game = game
|
||||||
|
self.go = ground_object
|
||||||
|
self.position = ground_object.position
|
||||||
|
self.heading = random.randint(0, 359)
|
||||||
self.faction = faction
|
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
|
||||||
self.ddtype = ddtype
|
self.ddtype = ddtype
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
@ -16,6 +25,18 @@ class DDGroupGenerator(GroupGenerator):
|
|||||||
self.add_unit(self.ddtype, "DD2", self.position.x + 500, self.position.y - 900, self.heading)
|
self.add_unit(self.ddtype, "DD2", self.position.x + 500, self.position.y - 900, self.heading)
|
||||||
self.get_generated_group().points[0].speed = 20
|
self.get_generated_group().points[0].speed = 20
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class OliverHazardPerryGroupGenerator(DDGroupGenerator):
|
class OliverHazardPerryGroupGenerator(DDGroupGenerator):
|
||||||
def __init__(self, game, ground_object, faction):
|
def __init__(self, game, ground_object, faction):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user