From 61a237d1aee7d6c9f29fe5d3269fe44c4f46fa25 Mon Sep 17 00:00:00 2001 From: Vasyl Horbachenko Date: Sun, 9 Sep 2018 20:57:32 +0300 Subject: [PATCH] proper settings for barcap --- game/operation/strike.py | 2 +- gen/aircraft.py | 11 +++++------ gen/conflictgen.py | 30 ++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/game/operation/strike.py b/game/operation/strike.py index 48252b0c..1ee8d940 100644 --- a/game/operation/strike.py +++ b/game/operation/strike.py @@ -33,7 +33,7 @@ class StrikeOperation(Operation): if self.game.player == self.defender_name: self.attackers_starting_position = None - conflict = Conflict.capture_conflict( + conflict = Conflict.strike_conflict( attacker=self.mission.country(self.attacker_name), defender=self.mission.country(self.defender_name), from_cp=self.from_cp, diff --git a/gen/aircraft.py b/gen/aircraft.py index e9244f85..52df2c06 100644 --- a/gen/aircraft.py +++ b/gen/aircraft.py @@ -24,6 +24,7 @@ WARM_START_AIRSPEED = 550 INTERCEPTION_ALT = 3000 INTERCEPTION_AIRSPEED = 1000 +BARCAP_RACETRACK_DISTANCE = 20000 ATTACK_CIRCLE_ALT = 5000 ATTACK_CIRCLE_DURATION = 15 @@ -218,12 +219,6 @@ class AircraftConflictGenerator: at=at) 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: @@ -404,6 +399,10 @@ class AircraftConflictGenerator: if self.conflict.is_vector: group.add_waypoint(self.conflict.tail, WARM_START_ALTITUDE, WARM_START_AIRSPEED) else: + heading = group.position.heading_between_point(self.conflict.position) + waypoint = group.add_waypoint(self.conflict.position.point_from_heading(heading, BARCAP_RACETRACK_DISTANCE), + WARM_START_ALTITUDE, + WARM_START_AIRSPEED) waypoint.tasks.append(OrbitAction(WARM_START_ALTITUDE, WARM_START_AIRSPEED)) group.task = CAP.name diff --git a/gen/conflictgen.py b/gen/conflictgen.py index 30e4a53a..a2dc39cb 100644 --- a/gen/conflictgen.py +++ b/gen/conflictgen.py @@ -21,6 +21,9 @@ AIR_DISTANCE = 40000 CAPTURE_AIR_ATTACKERS_DISTANCE = 25000 CAPTURE_AIR_DEFENDERS_DISTANCE = 60000 +STRIKE_AIR_ATTACKERS_DISTANCE = 45000 +STRIKE_AIR_DEFENDERS_DISTANCE = 25000 + CAP_CAS_DISTANCE = 10000, 120000 GROUND_INTERCEPT_SPREAD = 5000 @@ -225,6 +228,33 @@ class Conflict: air_defenders_location=position.point_from_heading(_opposite_heading(attack_raw_heading), CAPTURE_AIR_DEFENDERS_DISTANCE) ) + @classmethod + def strike_conflict(cls, attacker: Country, defender: Country, from_cp: ControlPoint, to_cp: ControlPoint, theater: ConflictTheater): + position = to_cp.position + attack_raw_heading = to_cp.position.heading_between_point(from_cp.position) + attack_heading = to_cp.find_radial(attack_raw_heading) + defense_heading = to_cp.find_radial(from_cp.position.heading_between_point(to_cp.position), ignored_radial=attack_heading) + + distance = to_cp.size * GROUND_DISTANCE_FACTOR + attackers_location = position.point_from_heading(attack_heading, distance) + attackers_location = Conflict._find_ground_position(attackers_location, distance * 2, _heading_sum(attack_heading, 180), theater) + + defenders_location = position.point_from_heading(defense_heading, distance) + defenders_location = Conflict._find_ground_position(defenders_location, distance * 2, _heading_sum(defense_heading, 180), theater) + + return cls( + position=position, + theater=theater, + from_cp=from_cp, + to_cp=to_cp, + attackers_side=attacker, + defenders_side=defender, + ground_attackers_location=attackers_location, + ground_defenders_location=defenders_location, + air_attackers_location=position.point_from_heading(attack_raw_heading, STRIKE_AIR_ATTACKERS_DISTANCE), + air_defenders_location=position.point_from_heading(_opposite_heading(attack_raw_heading), STRIKE_AIR_DEFENDERS_DISTANCE) + ) + @classmethod def intercept_conflict(cls, attacker: Country, defender: Country, from_cp: ControlPoint, to_cp: ControlPoint, theater: ConflictTheater): raw_distance = from_cp.position.distance_to_point(to_cp.position) * 1.5