mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Enabled for bluefor modern, since they ought to have GPS but seemingly don't. This change does nothing until https://github.com/pydcs/dcs/pull/102 lands and we update to it.
50 lines
1.5 KiB
Python
50 lines
1.5 KiB
Python
from __future__ import annotations
|
|
|
|
from enum import IntEnum
|
|
from typing import TYPE_CHECKING
|
|
|
|
from dcs.mission import Mission
|
|
|
|
if TYPE_CHECKING:
|
|
from game.game import Game
|
|
|
|
|
|
class Labels(IntEnum):
|
|
Off = 0
|
|
Full = 1
|
|
Abbreviated = 2
|
|
Dot = 3
|
|
|
|
|
|
class ForcedOptionsGenerator:
|
|
def __init__(self, mission: Mission, game: Game) -> None:
|
|
self.mission = mission
|
|
self.game = game
|
|
|
|
def _set_options_view(self) -> None:
|
|
self.mission.forced_options.options_view = self.game.settings.map_coalition_visibility
|
|
|
|
def _set_external_views(self) -> None:
|
|
if not self.game.settings.external_views_allowed:
|
|
self.mission.forced_options.external_views = self.game.settings.external_views_allowed
|
|
|
|
def _set_labels(self) -> None:
|
|
if self.game.settings.labels == "Abbreviated":
|
|
self.mission.forced_options.labels = int(Labels.Abbreviated)
|
|
elif self.game.settings.labels == "Dot Only":
|
|
self.mission.forced_options.labels = int(Labels.Dot)
|
|
elif self.game.settings.labels == "Off":
|
|
self.mission.forced_options.labels = int(Labels.Off)
|
|
|
|
def _set_unrestricted_satnav(self) -> None:
|
|
blue = self.game.player_faction
|
|
red = self.game.enemy_faction
|
|
if blue.unrestricted_satnav or red.unrestricted_satnav:
|
|
self.mission.forced_options.unrestricted_satnav = True
|
|
|
|
def generate(self):
|
|
self._set_options_view()
|
|
self._set_external_views()
|
|
self._set_labels()
|
|
self._set_unrestricted_satnav()
|