mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Use task priorities from aircraft yamls.
Preferred aircraft per task are now determined by a ranking of weights stored in the aircraft yaml files. To aid in visualizing the priorities across aircraft, Liberation can be run with the argument dump-task-priorities to dump a yaml file in Saved Games/DCS/Liberation/Debug/priorities.yaml, which will show each task along with priority sorted aircraft and their weights. The current weights in the data were exported from the existing lists, where each position from the bottom of the list was worth 10 (to allow some games for less shuffling later). Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2809.
This commit is contained in:
@@ -10,8 +10,6 @@ from PySide2.QtWidgets import (
|
||||
QFrame,
|
||||
)
|
||||
|
||||
import game.ato.ai_flight_planner_db
|
||||
from game.ato.flighttype import FlightType
|
||||
from game.dcs.aircrafttype import AircraftType
|
||||
from game.dcs.groundunittype import GroundUnitType
|
||||
from game.dcs.unittype import UnitType
|
||||
@@ -84,9 +82,8 @@ class QUnitInfoWindow(QDialog):
|
||||
|
||||
# If it's an aircraft, include the task list.
|
||||
if isinstance(unit_type, AircraftType):
|
||||
self.tasks_box = QLabel(
|
||||
f"<b>In-Game Tasks:</b> {self.generateAircraftTasks()}"
|
||||
)
|
||||
tasks = ", ".join(str(t) for t in unit_type.iter_task_capabilities())
|
||||
self.tasks_box = QLabel(f"<b>In-Game Tasks:</b> {tasks}")
|
||||
self.tasks_box.setProperty("style", "info-element")
|
||||
self.gridLayout.addWidget(self.tasks_box, 2, 0)
|
||||
|
||||
@@ -101,30 +98,3 @@ class QUnitInfoWindow(QDialog):
|
||||
|
||||
self.layout.addLayout(self.gridLayout, 1, 0)
|
||||
self.setLayout(self.layout)
|
||||
|
||||
def generateAircraftTasks(self) -> str:
|
||||
aircraft_tasks = ""
|
||||
unit_type = self.unit_type.dcs_unit_type
|
||||
if unit_type in game.ato.ai_flight_planner_db.CAP_CAPABLE:
|
||||
aircraft_tasks = (
|
||||
aircraft_tasks
|
||||
+ f"{FlightType.BARCAP}, {FlightType.ESCORT}, {FlightType.INTERCEPTION}, {FlightType.SWEEP}, {FlightType.TARCAP}, "
|
||||
)
|
||||
if unit_type in game.ato.ai_flight_planner_db.CAS_CAPABLE:
|
||||
aircraft_tasks = (
|
||||
aircraft_tasks
|
||||
+ f"{FlightType.CAS}, {FlightType.BAI}, {FlightType.OCA_AIRCRAFT}, "
|
||||
)
|
||||
if unit_type in game.ato.ai_flight_planner_db.SEAD_CAPABLE:
|
||||
aircraft_tasks = aircraft_tasks + f"{FlightType.SEAD}, "
|
||||
if unit_type in game.ato.ai_flight_planner_db.DEAD_CAPABLE:
|
||||
aircraft_tasks = aircraft_tasks + f"{FlightType.DEAD}, "
|
||||
if unit_type in game.ato.ai_flight_planner_db.ANTISHIP_CAPABLE:
|
||||
aircraft_tasks = aircraft_tasks + f"{FlightType.ANTISHIP}, "
|
||||
if unit_type in game.ato.ai_flight_planner_db.RUNWAY_ATTACK_CAPABLE:
|
||||
aircraft_tasks = aircraft_tasks + f"{FlightType.OCA_RUNWAY}, "
|
||||
if unit_type in game.ato.ai_flight_planner_db.STRIKE_CAPABLE:
|
||||
aircraft_tasks = aircraft_tasks + f"{FlightType.STRIKE}, "
|
||||
if unit_type in game.ato.ai_flight_planner_db.REFUELING_CAPABALE:
|
||||
aircraft_tasks = aircraft_tasks + f"{FlightType.REFUELING}, "
|
||||
return aircraft_tasks[:-2]
|
||||
|
||||
Reference in New Issue
Block a user