mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Add options: max mission distance for planes & helicopters
This commit is contained in:
parent
f6985d9f70
commit
c39d58f60b
@ -46,6 +46,7 @@
|
||||
* **[UX]** Buy/Replace TGOs for free before the campaign has started
|
||||
* **[Data]** Ability to define "cruise" & "combat" altitudes for airplanes
|
||||
* **[Options]** Option to randomize altitudes for flights with airplanes
|
||||
* **[Options]** Options to configure/override maximum mission distance for airplanes & helicopters
|
||||
|
||||
## Fixes
|
||||
* **[Mission Generation]** Anti-ship strikes should use "group attack" in their attack-task
|
||||
|
||||
@ -381,6 +381,32 @@ class Settings:
|
||||
"planned to known threat zones."
|
||||
),
|
||||
)
|
||||
max_mission_range_planes: int = bounded_int_option(
|
||||
"Auto-planner maximum mission range for airplanes (NM)",
|
||||
page=CAMPAIGN_DOCTRINE_PAGE,
|
||||
section=DOCTRINE_DISTANCES_SECTION,
|
||||
default=150,
|
||||
min=150,
|
||||
max=1000,
|
||||
detail=(
|
||||
"The maximum mission distance that's used by the auto-planner for airplanes. "
|
||||
"This setting won't take effect when a larger "
|
||||
"range is defined in the airplane's yaml specification."
|
||||
),
|
||||
)
|
||||
max_mission_range_helicopters: int = bounded_int_option(
|
||||
"Auto-planner maximum mission range for helicopters (NM)",
|
||||
page=CAMPAIGN_DOCTRINE_PAGE,
|
||||
section=DOCTRINE_DISTANCES_SECTION,
|
||||
default=100,
|
||||
min=50,
|
||||
max=1000,
|
||||
detail=(
|
||||
"The maximum mission distance that's used by the auto-planner for helicopters. "
|
||||
"This setting won't take effect when a larger "
|
||||
"range is defined in the helicopter's yaml specification."
|
||||
),
|
||||
)
|
||||
# Pilots and Squadrons
|
||||
ai_pilot_levelling: bool = boolean_option(
|
||||
"Allow AI pilot leveling",
|
||||
|
||||
@ -18,7 +18,7 @@ from game.theater import ParkingType
|
||||
from .pilot import Pilot, PilotStatus
|
||||
from ..db.database import Database
|
||||
from ..radio.radios import RadioFrequency
|
||||
from ..utils import meters
|
||||
from ..utils import meters, nautical_miles
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from game import Game
|
||||
@ -307,9 +307,21 @@ class Squadron:
|
||||
|
||||
if ignore_range:
|
||||
return True
|
||||
|
||||
|
||||
distance_to_target = meters(location.distance_to(self.location))
|
||||
return distance_to_target <= self.aircraft.max_mission_range
|
||||
max_plane_dist = nautical_miles(
|
||||
self.coalition.game.settings.max_mission_range_planes
|
||||
)
|
||||
max_heli_dist = nautical_miles(
|
||||
self.coalition.game.settings.max_mission_range_helicopters
|
||||
)
|
||||
if self.aircraft.helicopter:
|
||||
return distance_to_target <= max(
|
||||
self.aircraft.max_mission_range, max_heli_dist
|
||||
)
|
||||
return distance_to_target <= max(
|
||||
self.aircraft.max_mission_range, max_plane_dist
|
||||
)
|
||||
|
||||
def operates_from(self, control_point: ControlPoint) -> bool:
|
||||
if not control_point.can_operate(self.aircraft):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user