mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
FARPs for heli flights WIP
This commit is contained in:
@@ -42,7 +42,7 @@ GROUP_VERTICAL_OFFSET = 300
|
||||
|
||||
|
||||
class AircraftConflictGenerator:
|
||||
escort_targets = [] # type: typing.List[typing.Tuple[PlaneGroup, int]]
|
||||
escort_targets = [] # type: typing.List[typing.Tuple[FlyingGroup, int]]
|
||||
vertical_offset = None # type: int
|
||||
|
||||
def __init__(self, mission: Mission, conflict: Conflict, settings: Settings):
|
||||
@@ -77,7 +77,7 @@ class AircraftConflictGenerator:
|
||||
count -= group_size
|
||||
client_count -= client_size
|
||||
|
||||
def _setup_group(self, group: FlyingGroup, for_task: Task, client_count: int):
|
||||
def _setup_group(self, group: FlyingGroup, for_task: typing.Type[Task], client_count: int):
|
||||
did_load_loadout = False
|
||||
unit_type = group.units[0].unit_type
|
||||
if unit_type in db.PLANE_PAYLOAD_OVERRIDES:
|
||||
|
||||
@@ -142,6 +142,9 @@ class Conflict:
|
||||
y = lerp * dy + self.tail.y
|
||||
return Point(x, y)
|
||||
|
||||
def find_ground_position(self, at: Point, heading: int, max_distance: int = 40000) -> typing.Optional[Point]:
|
||||
return Conflict._find_ground_position(at, max_distance, heading, self.theater)
|
||||
|
||||
@classmethod
|
||||
def has_frontline_between(cls, from_cp: ControlPoint, to_cp: ControlPoint) -> bool:
|
||||
return from_cp.has_frontline and to_cp.has_frontline
|
||||
@@ -190,7 +193,7 @@ class Conflict:
|
||||
return pos
|
||||
|
||||
@classmethod
|
||||
def _find_ground_position(cls, initial: Point, max_distance: int, heading: int, theater: ConflictTheater) -> Point:
|
||||
def _find_ground_position(cls, initial: Point, max_distance: int, heading: int, theater: ConflictTheater) -> typing.Optional[Point]:
|
||||
pos = initial
|
||||
for _ in range(0, int(max_distance), 500):
|
||||
if theater.is_on_land(pos):
|
||||
|
||||
@@ -7,6 +7,8 @@ from .naming import *
|
||||
from dcs.mission import *
|
||||
from dcs.statics import *
|
||||
|
||||
FARP_FRONTLINE_DISTANCE = 10000
|
||||
|
||||
|
||||
CATEGORY_MAPPING = {
|
||||
"power": [Fortification.Workshop_A],
|
||||
@@ -25,6 +27,17 @@ class GroundObjectsGenerator:
|
||||
self.conflict = conflict
|
||||
self.game = game
|
||||
|
||||
def generate_farp(self) -> StaticGroup:
|
||||
assert self.conflict.is_vector, "FARP could be generated only on frontline conflicts!"
|
||||
|
||||
position = self.conflict.find_ground_position(self.conflict.center.point_from_heading(self.conflict.opposite_heading, FARP_FRONTLINE_DISTANCE))
|
||||
return self.m.static_group(
|
||||
country=self.m.country(self.game.player),
|
||||
name="",
|
||||
_type=Fortification.FARP_Command_Post,
|
||||
position=position
|
||||
)
|
||||
|
||||
def generate(self):
|
||||
side = self.m.country(self.game.enemy)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user