mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Prefer buying aircraft at safe airbases.
Fixes https://github.com/Khopa/dcs_liberation/issues/652
This commit is contained in:
parent
8c1ebfda02
commit
6aa1f1cca0
@ -6,6 +6,7 @@ Saves from 2.3 are not compatible with 2.4.
|
|||||||
|
|
||||||
* **[Flight Planner]** Air-to-air and SEAD escorts will no longer be automatically planned for packages that are not in range of threats.
|
* **[Flight Planner]** Air-to-air and SEAD escorts will no longer be automatically planned for packages that are not in range of threats.
|
||||||
* **[Flight Planner]** Non-custom flight plans will now navigate around threat areas en route to the target area when practical.
|
* **[Flight Planner]** Non-custom flight plans will now navigate around threat areas en route to the target area when practical.
|
||||||
|
* **[Campaign AI]** Auto-purchase now prefers airfields that are not within range of the enemy.
|
||||||
|
|
||||||
# 2.3.3
|
# 2.3.3
|
||||||
|
|
||||||
|
|||||||
@ -42,6 +42,7 @@ class ProcurementAi:
|
|||||||
self.manage_runways = manage_runways
|
self.manage_runways = manage_runways
|
||||||
self.manage_front_line = manage_front_line
|
self.manage_front_line = manage_front_line
|
||||||
self.manage_aircraft = manage_aircraft
|
self.manage_aircraft = manage_aircraft
|
||||||
|
self.threat_zones = self.game.threat_zone_for(not self.is_player)
|
||||||
|
|
||||||
def spend_budget(
|
def spend_budget(
|
||||||
self, budget: int,
|
self, budget: int,
|
||||||
@ -176,6 +177,7 @@ class ProcurementAi:
|
|||||||
distance_cache = ObjectiveDistanceCache.get_closest_airfields(
|
distance_cache = ObjectiveDistanceCache.get_closest_airfields(
|
||||||
request.near
|
request.near
|
||||||
)
|
)
|
||||||
|
threatened = []
|
||||||
for cp in distance_cache.airfields_within(request.range):
|
for cp in distance_cache.airfields_within(request.range):
|
||||||
if not cp.is_friendly(self.is_player):
|
if not cp.is_friendly(self.is_player):
|
||||||
continue
|
continue
|
||||||
@ -183,7 +185,10 @@ class ProcurementAi:
|
|||||||
continue
|
continue
|
||||||
if cp.unclaimed_parking(self.game) < request.number:
|
if cp.unclaimed_parking(self.game) < request.number:
|
||||||
continue
|
continue
|
||||||
|
if self.threat_zones.threatened(cp.position):
|
||||||
|
threatened.append(cp)
|
||||||
yield cp
|
yield cp
|
||||||
|
yield from threatened
|
||||||
|
|
||||||
def front_line_candidates(self) -> List[ControlPoint]:
|
def front_line_candidates(self) -> List[ControlPoint]:
|
||||||
candidates = []
|
candidates = []
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user