mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
add support for neutral FOBs
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import itertools
|
||||
import math
|
||||
import operator
|
||||
from collections.abc import Iterable, Iterator
|
||||
@@ -278,6 +279,29 @@ class ObjectiveFinder:
|
||||
prioritized.extend(self._targets_by_range(isolated))
|
||||
return prioritized
|
||||
|
||||
def air_assault_targets(self) -> list[ControlPoint]:
|
||||
"""Returns control points suitable for air assault missions, including neutral bases."""
|
||||
prioritized = []
|
||||
capturable_later = []
|
||||
isolated = []
|
||||
|
||||
combined_control_points = itertools.chain(
|
||||
self.game.theater.control_points_for(self.is_player.opponent),
|
||||
self.game.theater.control_points_for(Player.NEUTRAL),
|
||||
)
|
||||
|
||||
for cp in combined_control_points:
|
||||
if cp.is_isolated:
|
||||
isolated.append(cp)
|
||||
continue
|
||||
if cp.has_active_frontline:
|
||||
prioritized.append(cp)
|
||||
else:
|
||||
capturable_later.append(cp)
|
||||
prioritized.extend(self._targets_by_range(capturable_later))
|
||||
prioritized.extend(self._targets_by_range(isolated))
|
||||
return prioritized
|
||||
|
||||
@staticmethod
|
||||
def closest_airfields_to(location: MissionTarget) -> ClosestAirfields:
|
||||
"""Returns the closest airfields to the given location."""
|
||||
|
||||
@@ -158,6 +158,7 @@ class TheaterState(WorldState["TheaterState"]):
|
||||
coalition = game.coalition_for(player)
|
||||
finder = ObjectiveFinder(game, player)
|
||||
ordered_capturable_points = finder.prioritized_points()
|
||||
air_assault_capturable_points = finder.air_assault_targets()
|
||||
|
||||
context = PersistentContext(
|
||||
game.db,
|
||||
@@ -177,7 +178,7 @@ class TheaterState(WorldState["TheaterState"]):
|
||||
|
||||
battle_postitions: Dict[ControlPoint, BattlePositions] = {
|
||||
cp: BattlePositions.for_control_point(cp)
|
||||
for cp in ordered_capturable_points
|
||||
for cp in air_assault_capturable_points
|
||||
}
|
||||
|
||||
vulnerable_control_points = [
|
||||
|
||||
Reference in New Issue
Block a user