mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Preference option to prioritize custom Liberation payloads
This commit is contained in:
@@ -11,6 +11,7 @@ from dcs.unittype import FlyingType
|
||||
from game.data.weapons import Pylon, Weapon, WeaponType
|
||||
from game.dcs.aircrafttype import AircraftType
|
||||
from .flighttype import FlightType
|
||||
from ..persistency import prefer_liberation_payloads
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .flight import Flight
|
||||
@@ -161,7 +162,10 @@ class Loadout:
|
||||
# last - the first element in the tuple will be tried first, then the second,
|
||||
# etc.
|
||||
loadout_names = {
|
||||
t: [f"Retribution {t.value}", f"Liberation {t.value}"] for t in FlightType
|
||||
t: [f"Liberation {t.value}", f"Retribution {t.value}"]
|
||||
if prefer_liberation_payloads()
|
||||
else [f"Retribution {t.value}", f"Liberation {t.value}"]
|
||||
for t in FlightType
|
||||
}
|
||||
legacy_names = {
|
||||
FlightType.TARCAP: (
|
||||
|
||||
@@ -16,6 +16,7 @@ if TYPE_CHECKING:
|
||||
from game import Game
|
||||
|
||||
_dcs_saved_game_folder: Optional[str] = None
|
||||
_prefer_liberation_payloads: bool = False
|
||||
|
||||
|
||||
# fmt: off
|
||||
@@ -74,9 +75,11 @@ class MigrationUnpickler(pickle.Unpickler):
|
||||
# fmt: on
|
||||
|
||||
|
||||
def setup(user_folder: str) -> None:
|
||||
def setup(user_folder: str, prefer_liberation_payloads: bool) -> None:
|
||||
global _dcs_saved_game_folder
|
||||
_dcs_saved_game_folder = user_folder
|
||||
global _prefer_liberation_payloads
|
||||
_prefer_liberation_payloads = prefer_liberation_payloads
|
||||
if not save_dir().exists():
|
||||
save_dir().mkdir(parents=True)
|
||||
|
||||
@@ -110,6 +113,11 @@ def payloads_dir(backup: bool = False) -> Path:
|
||||
return payloads
|
||||
|
||||
|
||||
def prefer_liberation_payloads() -> bool:
|
||||
global _prefer_liberation_payloads
|
||||
return _prefer_liberation_payloads
|
||||
|
||||
|
||||
def user_custom_weapon_injections_dir() -> Path:
|
||||
return base_path() / "Retribution" / "WeaponInjections"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user