mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Revert "Remove front line minimum distance."
This bug still isn't well understood and this made things worse. Reverting until we understand the cause. This reverts commit c844c364fa8a544b8f542a63c90da7162539640f. Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1912
This commit is contained in:
parent
b3a3eb414a
commit
f95795d547
@ -13,6 +13,9 @@ if TYPE_CHECKING:
|
||||
from game.ato import FlightType
|
||||
|
||||
|
||||
FRONTLINE_MIN_CP_DISTANCE = 5000
|
||||
|
||||
|
||||
@dataclass
|
||||
class FrontLineSegment:
|
||||
"""
|
||||
@ -170,8 +173,23 @@ class FrontLine(MissionTarget):
|
||||
"""
|
||||
total_strength = self.blue_cp.base.strength + self.red_cp.base.strength
|
||||
if self.blue_cp.base.strength == 0:
|
||||
return 0
|
||||
return self._adjust_for_min_dist(0)
|
||||
if self.red_cp.base.strength == 0:
|
||||
return self.attack_distance
|
||||
return self._adjust_for_min_dist(self.attack_distance)
|
||||
strength_pct = self.blue_cp.base.strength / total_strength
|
||||
return strength_pct * self.attack_distance
|
||||
return self._adjust_for_min_dist(strength_pct * self.attack_distance)
|
||||
|
||||
def _adjust_for_min_dist(self, distance: float) -> float:
|
||||
"""
|
||||
Ensures the frontline conflict is never located within the minimum distance
|
||||
constant of either end control point.
|
||||
"""
|
||||
if (distance > self.attack_distance / 2) and (
|
||||
distance + FRONTLINE_MIN_CP_DISTANCE > self.attack_distance
|
||||
):
|
||||
distance = self.attack_distance - FRONTLINE_MIN_CP_DISTANCE
|
||||
elif (distance < self.attack_distance / 2) and (
|
||||
distance < FRONTLINE_MIN_CP_DISTANCE
|
||||
):
|
||||
distance = FRONTLINE_MIN_CP_DISTANCE
|
||||
return distance
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user