new airports for PG; TACANs and ICLS; list frequencies in mission briefing; carrier ops improvements; cold start option

This commit is contained in:
Vasyl Horbachenko
2018-07-20 04:06:13 +03:00
parent 5f7d717b63
commit d48985ca6d
12 changed files with 80 additions and 30 deletions

View File

@@ -45,6 +45,9 @@ class AircraftConflictGenerator:
self.conflict = conflict
self.escort_targets = []
def _start_type(self) -> StartType:
return self.settings.cold_start and StartType.Cold or StartType.Warm
def _group_point(self, point) -> Point:
distance = randint(
int(self.conflict.size * SPREAD_DISTANCE_FACTOR[0]),
@@ -109,7 +112,7 @@ class AircraftConflictGenerator:
aircraft_type=unit_type,
airport=self.m.terrain.airport_by_id(airport.id),
maintask=None,
start_type=StartType.Warm,
start_type=self._start_type(),
group_size=count,
parking_slots=None)
@@ -135,7 +138,7 @@ class AircraftConflictGenerator:
altitude=alt,
speed=speed,
maintask=None,
start_type=StartType.Warm,
start_type=self._start_type(),
group_size=count)
def _generate_at_carrier(self, name: str, side: Country, unit_type: FlyingType, count: int, client_count: int, at: ShipGroup) -> FlyingGroup:
@@ -148,7 +151,7 @@ class AircraftConflictGenerator:
aircraft_type=unit_type,
pad_group=at,
maintask=None,
start_type=StartType.Warm,
start_type=self._start_type(),
group_size=count)
def _generate_group(self, name: str, side: Country, unit_type: FlyingType, count: int, client_count: int, at: db.StartingPosition):
@@ -206,9 +209,11 @@ class AircraftConflictGenerator:
group.task = Escort.name
"""
heading = group.position.heading_between_point(self.conflict.position)
position = group.position # type: Point
wayp = group.add_waypoint(position.point_from_heading(heading, WORKAROUND_WAYP_DIST), CAS_ALTITUDE, WARM_START_AIRSPEED)
"""
self._setup_group(group, CAP, client_count)
for escorted_group, waypoint_index in self.escort_targets:
@@ -216,7 +221,7 @@ class AircraftConflictGenerator:
if not is_quick:
waypoint_index += TRIGGER_WAYPOINT_OFFSET
wayp.tasks.append(EscortTaskAction(escorted_group.id, engagement_max_dist=ESCORT_ENGAGEMENT_MAX_DIST, lastwpt=waypoint_index))
group.points[0].tasks.append(EscortTaskAction(escorted_group.id, engagement_max_dist=ESCORT_ENGAGEMENT_MAX_DIST, lastwpt=waypoint_index))
if should_orbit:
orbit_task = ControlledTask(OrbitAction(ATTACK_CIRCLE_ALT, pattern=OrbitAction.OrbitPattern.Circle))

View File

@@ -25,7 +25,7 @@ class AirSupportConflictGenerator:
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 = self.conflict.from_cp.position.point_from_heading(tanker_heading, TANKER_DISTANCE)
self.mission.refuel_flight(
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,
@@ -34,8 +34,11 @@ class AirSupportConflictGenerator:
altitude=TANKER_ALT,
frequency=140,
start_type=StartType.Warm,
tacanchannel="99X",
)
tanker_group.points[0].tasks.append(ActivateBeaconCommand(channel=10, unit_id=tanker_group.id, aa=False))
if is_awacs_enabled:
awacs_unit = db.find_unittype(AWACS, self.conflict.attackers_side.name)[0]
self.mission.awacs_flight(
@@ -45,6 +48,6 @@ class AirSupportConflictGenerator:
altitude=AWACS_ALT,
airport=None,
position=self.conflict.position.random_point_within(AWACS_DISTANCE, AWACS_DISTANCE),
frequency=251,
frequency=180,
start_type=StartType.Warm,
)

View File

@@ -15,12 +15,16 @@ class ShipGenerator:
self.conflict = conflict
def generate_carrier(self, type: ShipType, country: str, at: Point) -> ShipGroup:
return self.m.ship_group(
group = self.m.ship_group(
country=self.m.country(country),
name=namegen.next_carrier_name(self.m.country(country)),
_type=type,
position=at)
group.points[0].tasks.append(ActivateBeaconCommand(unit_id=group.id, channel=20, callsign="SHDW", aa=False))
group.points[0].tasks.append(ActivateICLSCommand(unit_id=group.id, channel=1))
return group
def generate_cargo(self, units: db.ShipDict) -> typing.Collection[ShipGroup]:
groups = []
for unit_type, unit_count in units.items():

View File

@@ -136,7 +136,7 @@ class TriggersGenerator:
for vehicle_group in country.vehicle_group:
vehicle_group.set_skill(Skill(skill_level))
def generate(self, player_cp: ControlPoint, is_quick: bool, activation_trigger_radius: int):
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"
enemy_coalition = player_coalition == "blue" and "red" or "blue"
@@ -146,6 +146,19 @@ class TriggersGenerator:
self._set_skill(player_coalition, enemy_coalition)
self._set_allegiances(player_coalition, enemy_coalition)
description = ""
description += "FREQUENCIES:"
description += "\nFlight: 251 MHz AM"
description += "\nTanker: 10X/140 MHz"
if awacs_enabled:
description += "\nAWACS: 180 MHz"
if self.conflict.from_cp.is_global or self.conflict.to_cp.is_global:
description += "\nCarrier: 20X/ICLS CHAN1"
self.mission.set_description_text(description)
if not is_quick:
# TODO: waypoint parts of this should not be post-hacked but added in airgen
self._gen_activation_trigger(activation_trigger_radius, player_cp, player_coalition, enemy_coalition)