From 1c86585f0329137dd3de71d4a500043d798ee431 Mon Sep 17 00:00:00 2001 From: Simon Clark Date: Sat, 30 Jan 2021 13:35:22 +0000 Subject: [PATCH] Make certain stances use slightly offset headings. There's a DCS bug where vehicles sometimes don't move if they don't have to change heading. This is a bit of a hacky workaround for that. Should fix #797. --- gen/armor.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gen/armor.py b/gen/armor.py index 8e54c8ca..7dec9333 100644 --- a/gen/armor.py +++ b/gen/armor.py @@ -352,9 +352,14 @@ class GroundConflictGenerator: to_cp.position.random_point_within(500, 0) ) else: + # We use an offset heading here because DCS doesn't always + # force vehicles to move if there's no heading change. + offset_heading = forward_heading - 1 + if offset_heading < 0: + offset_heading = 359 attack_point = self.find_offensive_point( dcs_group, - forward_heading, + offset_heading, AGGRESIVE_MOVE_DISTANCE ) dcs_group.add_waypoint(attack_point, PointAction.OffRoad) @@ -367,7 +372,12 @@ class GroundConflictGenerator: to_cp.position.random_point_within(500, 0) ) else: - attack_point = self.find_offensive_point(dcs_group, forward_heading, BREAKTHROUGH_OFFENSIVE_DISTANCE) + # We use an offset heading here because DCS doesn't always + # force vehicles to move if there's no heading change. + offset_heading = forward_heading - 1 + if offset_heading < 0: + offset_heading = 359 + attack_point = self.find_offensive_point(dcs_group, offset_heading, BREAKTHROUGH_OFFENSIVE_DISTANCE) dcs_group.add_waypoint(attack_point, PointAction.OffRoad) elif stance == CombatStance.ELIMINATION: # In elimination mode, the units focus on destroying as much enemy groups as possible