mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
naval intercept operation; package refactoring
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from game import db
|
||||
from .conflictgen import *
|
||||
from .naming import *
|
||||
|
||||
@@ -5,15 +6,33 @@ from dcs.mission import *
|
||||
from dcs.unitgroup import *
|
||||
from dcs.task import *
|
||||
|
||||
SHIP_RANDOM_SPREAD = 300
|
||||
|
||||
|
||||
class ShipGenerator:
|
||||
def __init__(self, mission: Mission, conflict: Conflict):
|
||||
self.m = mission
|
||||
self.conflict = conflict
|
||||
|
||||
def generate(self, type: ShipType, country: str, at: Point) -> ShipGroup:
|
||||
def generate_carrier(self, type: ShipType, country: str, at: Point) -> ShipGroup:
|
||||
return self.m.ship_group(
|
||||
country=self.m.country(country),
|
||||
name=namegen.next_transport_group_name(),
|
||||
_type=type,
|
||||
position=at)
|
||||
|
||||
def generate_cargo(self, units: db.ShipDict) -> typing.Collection[ShipGroup]:
|
||||
groups = []
|
||||
for unit_type, unit_count in units.items():
|
||||
group = self.m.ship_group(
|
||||
country=self.conflict.defenders_side,
|
||||
name=namegen.next_transport_group_name(),
|
||||
_type=unit_type,
|
||||
position=self.conflict.position.random_point_within(SHIP_RANDOM_SPREAD, SHIP_RANDOM_SPREAD),
|
||||
group_size=unit_count,
|
||||
)
|
||||
|
||||
group.add_waypoint(self.conflict.to_cp.position)
|
||||
groups.append(group)
|
||||
|
||||
return groups
|
||||
|
||||
Reference in New Issue
Block a user