mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Ignore range when manually using auto-create
This commit is contained in:
@@ -52,6 +52,7 @@ class AirWing:
|
||||
heli: bool,
|
||||
this_turn: bool,
|
||||
preferred_type: Optional[AircraftType] = None,
|
||||
ignore_range: bool = False,
|
||||
) -> list[Squadron]:
|
||||
airfield_cache = ObjectiveDistanceCache.get_closest_airfields(location)
|
||||
best_aircraft = AircraftType.priority_list_for_task(task)
|
||||
@@ -68,7 +69,7 @@ class AirWing:
|
||||
]
|
||||
for squadron in squadrons:
|
||||
if squadron.can_auto_assign_mission(
|
||||
location, task, size, heli, this_turn
|
||||
location, task, size, heli, this_turn, ignore_range
|
||||
):
|
||||
capable_at_base.append(squadron)
|
||||
if squadron.aircraft not in best_aircraft:
|
||||
@@ -100,9 +101,10 @@ class AirWing:
|
||||
heli: bool,
|
||||
this_turn: bool,
|
||||
preferred_type: Optional[AircraftType] = None,
|
||||
ignore_range: bool = False,
|
||||
) -> Optional[Squadron]:
|
||||
for squadron in self.best_squadrons_for(
|
||||
location, task, size, heli, this_turn, preferred_type
|
||||
location, task, size, heli, this_turn, preferred_type, ignore_range
|
||||
):
|
||||
return squadron
|
||||
return None
|
||||
|
||||
@@ -281,6 +281,7 @@ class Squadron:
|
||||
size: int,
|
||||
heli: bool,
|
||||
this_turn: bool,
|
||||
ignore_range: bool = False,
|
||||
) -> bool:
|
||||
if (
|
||||
self.location.cptype.name in ["FOB", "FARP"]
|
||||
@@ -304,6 +305,9 @@ class Squadron:
|
||||
if heli and task == FlightType.REFUELING:
|
||||
return False
|
||||
|
||||
if ignore_range:
|
||||
return True
|
||||
|
||||
distance_to_target = meters(location.distance_to(self.location))
|
||||
return distance_to_target <= self.aircraft.max_mission_range
|
||||
|
||||
|
||||
Reference in New Issue
Block a user