mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
UI update; enemy vehicle difficulty settings; minor adjustments
This commit is contained in:
@@ -4,7 +4,7 @@ from .naming import *
|
||||
from dcs.mission import *
|
||||
|
||||
DISTANCE_FACTOR = 0.5, 1
|
||||
EXTRA_AA_MIN_DISTANCE = 35000
|
||||
EXTRA_AA_MIN_DISTANCE = 50000
|
||||
EXTRA_AA_MAX_DISTANCE = 150000
|
||||
EXTRA_AA_POSITION_FROM_CP = 550
|
||||
|
||||
@@ -59,6 +59,9 @@ class ExtraAAConflictGenerator:
|
||||
if cp.position.distance_to_point(self.conflict.from_cp.position) < EXTRA_AA_MIN_DISTANCE:
|
||||
continue
|
||||
|
||||
if cp.position.distance_to_point(self.conflict.to_cp.position) < EXTRA_AA_MIN_DISTANCE:
|
||||
continue
|
||||
|
||||
if cp.position.distance_to_point(self.conflict.position) > EXTRA_AA_MAX_DISTANCE:
|
||||
continue
|
||||
|
||||
|
||||
@@ -10,16 +10,20 @@ from dcs.terrain.terrain import NoParkingSlotError
|
||||
|
||||
TANKER_DISTANCE = 15000
|
||||
TANKER_ALT = 10000
|
||||
TANKER_HEADING_OFFSET = 45
|
||||
|
||||
AWACS_DISTANCE = 150000
|
||||
AWACS_ALT = 10000
|
||||
|
||||
|
||||
class AirSupportConflictGenerator:
|
||||
generated_tankers = None # type: typing.List[str]
|
||||
|
||||
def __init__(self, mission: Mission, conflict: Conflict, game):
|
||||
self.mission = mission
|
||||
self.conflict = conflict
|
||||
self.game = game
|
||||
self.generated_tankers = []
|
||||
|
||||
@classmethod
|
||||
def support_tasks(cls) -> typing.Collection[typing.Type[MainTask]]:
|
||||
@@ -27,22 +31,24 @@ class AirSupportConflictGenerator:
|
||||
|
||||
def generate(self, is_awacs_enabled):
|
||||
player_cp = self.conflict.from_cp if self.conflict.from_cp.captured else self.conflict.to_cp
|
||||
tanker_unit = db.find_unittype(Refueling, self.conflict.attackers_side.name)[0]
|
||||
tanker_heading = self.conflict.to_cp.position.heading_between_point(self.conflict.from_cp.position)
|
||||
tanker_position = player_cp.position.point_from_heading(tanker_heading, TANKER_DISTANCE)
|
||||
tanker_group = self.mission.refuel_flight(
|
||||
country=self.mission.country(self.game.player),
|
||||
name=namegen.next_tanker_name(self.mission.country(self.game.player)),
|
||||
airport=None,
|
||||
plane_type=tanker_unit,
|
||||
position=tanker_position,
|
||||
altitude=TANKER_ALT,
|
||||
frequency=131,
|
||||
start_type=StartType.Warm,
|
||||
tacanchannel="99X",
|
||||
)
|
||||
|
||||
tanker_group.points[0].tasks.append(ActivateBeaconCommand(channel=10, unit_id=tanker_group.id, aa=False))
|
||||
for i, tanker_unit_type in enumerate(db.find_unittype(Refueling, self.conflict.attackers_side.name)):
|
||||
self.generated_tankers.append(db.unit_type_name(tanker_unit_type))
|
||||
tanker_heading = self.conflict.to_cp.position.heading_between_point(self.conflict.from_cp.position) + TANKER_HEADING_OFFSET * i
|
||||
tanker_position = player_cp.position.point_from_heading(tanker_heading, TANKER_DISTANCE)
|
||||
tanker_group = self.mission.refuel_flight(
|
||||
country=self.mission.country(self.game.player),
|
||||
name=namegen.next_tanker_name(self.mission.country(self.game.player)),
|
||||
airport=None,
|
||||
plane_type=tanker_unit_type,
|
||||
position=tanker_position,
|
||||
altitude=TANKER_ALT,
|
||||
frequency=130 + i,
|
||||
start_type=StartType.Warm,
|
||||
tacanchannel="{}X".format(97 + i),
|
||||
)
|
||||
|
||||
tanker_group.points[0].tasks.append(ActivateBeaconCommand(channel=97 + i, unit_id=tanker_group.id, aa=False))
|
||||
|
||||
if is_awacs_enabled:
|
||||
awacs_unit = db.find_unittype(AWACS, self.conflict.attackers_side.name)[0]
|
||||
|
||||
@@ -154,32 +154,6 @@ class Conflict:
|
||||
def has_frontline_between(cls, from_cp: ControlPoint, to_cp: ControlPoint) -> bool:
|
||||
return from_cp.has_frontline and to_cp.has_frontline
|
||||
|
||||
@classmethod
|
||||
def frontline_position0(cls, from_cp: ControlPoint, to_cp: ControlPoint) -> typing.Tuple[Point, int]:
|
||||
cp_distance = from_cp.position.distance_to_point(to_cp.position)
|
||||
cp_distance -= cp_distance * to_cp.frontline_offset + cp_distance * from_cp.frontline_offset
|
||||
|
||||
distance = max(cp_distance * FRONTLINE_DISTANCE_STRENGTH_FACTOR * to_cp.base.strength, FRONTLINE_MIN_CP_DISTANCE)
|
||||
heading = to_cp.position.heading_between_point(from_cp.position)
|
||||
return to_cp.position.point_from_heading(heading, distance), heading
|
||||
|
||||
@classmethod
|
||||
def frontline_position2(cls, theater: ConflictTheater, from_cp: ControlPoint, to_cp: ControlPoint) -> typing.Optional[typing.Tuple[Point, int]]:
|
||||
attack_heading = from_cp.position.heading_between_point(to_cp.position)
|
||||
attack_starting_position = cls._find_ground_position(from_cp.position, 200000, attack_heading, theater)
|
||||
if not attack_starting_position:
|
||||
return None
|
||||
|
||||
attack_ending_position = cls._find_ground_position(to_cp.position, 200000, _opposite_heading(attack_heading), theater)
|
||||
if not attack_ending_position:
|
||||
return None
|
||||
|
||||
attack_distance = attack_ending_position.distance_to_point(attack_starting_position)
|
||||
strength_delta = (from_cp.base.strength - to_cp.base.strength) / 1.0
|
||||
middle_position = attack_starting_position.point_from_heading(attack_heading, attack_distance / 2)
|
||||
|
||||
return middle_position.point_from_heading(attack_heading, strength_delta * attack_distance), _opposite_heading(attack_heading)
|
||||
|
||||
@classmethod
|
||||
def frontline_position(cls, theater: ConflictTheater, from_cp: ControlPoint, to_cp: ControlPoint) -> typing.Optional[typing.Tuple[Point, int]]:
|
||||
attack_heading = from_cp.position.heading_between_point(to_cp.position)
|
||||
@@ -190,10 +164,10 @@ class Conflict:
|
||||
position = middle_point.point_from_heading(attack_heading, strength_delta * attack_distance / 2 - FRONTLINE_MIN_CP_DISTANCE)
|
||||
ground_position = cls._find_ground_position(position, attack_distance / 2 - FRONTLINE_MIN_CP_DISTANCE, attack_heading, theater)
|
||||
if ground_position:
|
||||
return ground_position, attack_heading
|
||||
return ground_position, _opposite_heading(attack_heading)
|
||||
else:
|
||||
print(from_cp, to_cp)
|
||||
return None
|
||||
print("Coudn't find frontline position between {} and {}!".format(from_cp, to_cp))
|
||||
return position, _opposite_heading(attack_heading)
|
||||
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -8,6 +8,7 @@ from dcs.mission import *
|
||||
from dcs.statics import *
|
||||
|
||||
FARP_FRONTLINE_DISTANCE = 10000
|
||||
AA_CP_MIN_DISTANCE = 40000
|
||||
|
||||
|
||||
class GroundObjectsGenerator:
|
||||
@@ -47,6 +48,9 @@ class GroundObjectsGenerator:
|
||||
|
||||
for ground_object in cp.ground_objects:
|
||||
if ground_object.dcs_identifier == "AA":
|
||||
if ground_object.position.distance_to_point(self.conflict.from_cp.position) < AA_CP_MIN_DISTANCE:
|
||||
continue
|
||||
|
||||
if ground_object.is_dead:
|
||||
continue
|
||||
|
||||
|
||||
@@ -130,9 +130,9 @@ class TriggersGenerator:
|
||||
def _set_skill(self, player_coalition: str, enemy_coalition: str):
|
||||
for coalition_name, coalition in self.mission.coalition.items():
|
||||
if coalition_name == player_coalition:
|
||||
skill_level = self.game.settings.player_skill
|
||||
skill_level = self.game.settings.player_skill, self.game.settings.player_skill
|
||||
elif coalition_name == enemy_coalition:
|
||||
skill_level = self.game.settings.enemy_skill
|
||||
skill_level = self.game.settings.enemy_skill, self.game.settings.enemy_vehicle_skill
|
||||
else:
|
||||
continue
|
||||
|
||||
@@ -140,10 +140,10 @@ class TriggersGenerator:
|
||||
for plane_group in country.plane_group:
|
||||
for plane_unit in plane_group.units:
|
||||
if plane_unit.skill != Skill.Client and plane_unit.skill != Skill.Player:
|
||||
plane_unit.skill = Skill(skill_level)
|
||||
plane_unit.skill = Skill(skill_level[0])
|
||||
|
||||
for vehicle_group in country.vehicle_group:
|
||||
vehicle_group.set_skill(Skill(skill_level))
|
||||
vehicle_group.set_skill(Skill(skill_level[1]))
|
||||
|
||||
def generate(self, player_cp: ControlPoint, is_quick: bool, activation_trigger_radius: int, awacs_enabled: bool):
|
||||
player_coalition = self.game.player == "USA" and "blue" or "red"
|
||||
|
||||
@@ -98,6 +98,9 @@ class VisualGenerator:
|
||||
|
||||
def _generate_frontline_smokes(self):
|
||||
for from_cp, to_cp in self.game.theater.conflicts():
|
||||
if from_cp.is_global or to_cp.is_global:
|
||||
continue
|
||||
|
||||
frontline = Conflict.frontline_position(self.game.theater, from_cp, to_cp)
|
||||
if not frontline:
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user