mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Fix doctrine inversion in threat zones.
The threat zone is the zone project by the given coaltition, not against it.
This commit is contained in:
parent
f84d77d334
commit
2374239238
@ -13,7 +13,7 @@ from shapely.geometry import (
|
|||||||
from shapely.geometry.base import BaseGeometry
|
from shapely.geometry.base import BaseGeometry
|
||||||
from shapely.ops import nearest_points, unary_union
|
from shapely.ops import nearest_points, unary_union
|
||||||
|
|
||||||
from game.utils import Distance, meters, nautical_miles
|
from game.utils import nautical_miles
|
||||||
from gen.flights.flight import Flight
|
from gen.flights.flight import Flight
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -80,7 +80,19 @@ class ThreatZones:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def for_faction(cls, game: Game, player: bool) -> ThreatZones:
|
def for_faction(cls, game: Game, player: bool) -> ThreatZones:
|
||||||
opposing_doctrine = game.faction_for(not player).doctrine
|
"""Generates the threat zones projected by the given coalition.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
game: The game to generate the threat zone for.
|
||||||
|
player: True if the coalition projecting the threat zone belongs to
|
||||||
|
the player.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
The threat zones projected by the given coalition. If the threat
|
||||||
|
zone belongs to the player, it is the zone that will be avoided by
|
||||||
|
the enemy and vice versa.
|
||||||
|
"""
|
||||||
|
doctrine = game.faction_for(player).doctrine
|
||||||
|
|
||||||
airbases = []
|
airbases = []
|
||||||
air_defenses = []
|
air_defenses = []
|
||||||
@ -90,8 +102,8 @@ class ThreatZones:
|
|||||||
if control_point.runway_is_operational():
|
if control_point.runway_is_operational():
|
||||||
point = ShapelyPoint(control_point.position.x,
|
point = ShapelyPoint(control_point.position.x,
|
||||||
control_point.position.y)
|
control_point.position.y)
|
||||||
cap_threat_range = (opposing_doctrine.cap_max_distance_from_cp +
|
cap_threat_range = (doctrine.cap_max_distance_from_cp +
|
||||||
opposing_doctrine.cap_engagement_range)
|
doctrine.cap_engagement_range)
|
||||||
airbases.append(point.buffer(cap_threat_range.meters))
|
airbases.append(point.buffer(cap_threat_range.meters))
|
||||||
|
|
||||||
for tgo in control_point.ground_objects:
|
for tgo in control_point.ground_objects:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user