mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Ability to configure forced-options via a file
https://github.com/dcs-retribution/dcs-retribution/issues/490
This commit is contained in:
parent
de1f8a7abc
commit
f8b4c7bcf5
@ -57,6 +57,7 @@
|
|||||||
* **[Modding]** Support for Cowboy's E-7A Wedgetail mod (Supports EW Script Offensive Jamming)
|
* **[Modding]** Support for Cowboy's E-7A Wedgetail mod (Supports EW Script Offensive Jamming)
|
||||||
* **[Modding]** Support for szcz's MiG-31BM (v2.0)
|
* **[Modding]** Support for szcz's MiG-31BM (v2.0)
|
||||||
* **[Plugins]** Added initial AI support for EW Script 2.0
|
* **[Plugins]** Added initial AI support for EW Script 2.0
|
||||||
|
* **[Options]** Ability to configure certain forced-options via a file (WIP: https://github.com/dcs-retribution/dcs-retribution/issues/490).
|
||||||
|
|
||||||
## Fixes
|
## Fixes
|
||||||
* **[UI/UX]** A-10A flights can be edited again
|
* **[UI/UX]** A-10A flights can be edited again
|
||||||
|
|||||||
@ -1,10 +1,13 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
|
import dcs.lua
|
||||||
from dcs.forcedoptions import ForcedOptions
|
from dcs.forcedoptions import ForcedOptions
|
||||||
from dcs.mission import Mission
|
from dcs.mission import Mission
|
||||||
|
|
||||||
|
from game.persistency import forced_options_path
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from game.game import Game
|
from game.game import Game
|
||||||
|
|
||||||
@ -53,7 +56,15 @@ class ForcedOptionsGenerator:
|
|||||||
value = self.game.settings.supercarrier_deck_crew
|
value = self.game.settings.supercarrier_deck_crew
|
||||||
self.mission.forced_options.supercarrier_deck_crew = value
|
self.mission.forced_options.supercarrier_deck_crew = value
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def load_forced_options() -> dict[str, Any]:
|
||||||
|
with open(forced_options_path(), "r+", encoding="utf-8") as f:
|
||||||
|
content = f.read()
|
||||||
|
result = dcs.lua.loads(content).get("forcedOptions", {})
|
||||||
|
return result
|
||||||
|
|
||||||
def generate(self) -> None:
|
def generate(self) -> None:
|
||||||
|
self.mission.forced_options.load_from_dict(self.load_forced_options())
|
||||||
self._set_options_view()
|
self._set_options_view()
|
||||||
self._set_external_views()
|
self._set_external_views()
|
||||||
self._set_easy_communication()
|
self._set_easy_communication()
|
||||||
|
|||||||
@ -195,6 +195,10 @@ def settings_dir() -> Path:
|
|||||||
return _create_dir_if_needed(base_path() / "Retribution" / "Settings")
|
return _create_dir_if_needed(base_path() / "Retribution" / "Settings")
|
||||||
|
|
||||||
|
|
||||||
|
def forced_options_path() -> Path:
|
||||||
|
return _create_dir_if_needed(base_path() / "Retribution" / "forced_options.lua")
|
||||||
|
|
||||||
|
|
||||||
def airwing_dir() -> Path:
|
def airwing_dir() -> Path:
|
||||||
return _create_dir_if_needed(base_path() / "Retribution" / "AirWing")
|
return _create_dir_if_needed(base_path() / "Retribution" / "AirWing")
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user