mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Doesn't affect the thing players see, but corrects the defaults when using the command line mission generator.
77 lines
2.5 KiB
Python
77 lines
2.5 KiB
Python
from dataclasses import dataclass, field
|
|
from typing import Dict, Optional
|
|
|
|
|
|
@dataclass
|
|
class Settings:
|
|
# Generator settings
|
|
inverted: bool = False
|
|
do_not_generate_carrier: bool = False
|
|
do_not_generate_lha: bool = False
|
|
do_not_generate_player_navy: bool = False
|
|
do_not_generate_enemy_navy: bool = False
|
|
|
|
# Difficulty settings
|
|
player_skill: str = "Good"
|
|
enemy_skill: str = "Average"
|
|
enemy_vehicle_skill: str = "Average"
|
|
map_coalition_visibility: str = "All Units"
|
|
labels: str = "Full"
|
|
only_player_takeoff: bool = True # Legacy parameter do not use
|
|
night_disabled: bool = False
|
|
external_views_allowed: bool = True
|
|
supercarrier: bool = False
|
|
multiplier: float = 1
|
|
generate_marks: bool = True
|
|
sams: bool = True # Legacy parameter do not use
|
|
cold_start: bool = False # Legacy parameter do not use
|
|
version: Optional[str] = None
|
|
|
|
# Performance oriented
|
|
perf_red_alert_state: bool = True
|
|
perf_smoke_gen: bool = True
|
|
perf_artillery: bool = True
|
|
perf_moving_units: bool = True
|
|
perf_infantry: bool = True
|
|
perf_ai_parking_start: bool = True
|
|
perf_destroyed_units: bool = True
|
|
|
|
# Performance culling
|
|
perf_culling: bool = False
|
|
perf_culling_distance: int = 100
|
|
|
|
# LUA Plugins system
|
|
plugins: Dict[str, bool] = field(default_factory=dict)
|
|
|
|
# Cheating
|
|
show_red_ato: bool = False
|
|
|
|
never_delay_player_flights: bool = False
|
|
|
|
@staticmethod
|
|
def plugin_settings_key(identifier: str) -> str:
|
|
return f"plugins.{identifier}"
|
|
|
|
def initialize_plugin_option(self, identifier: str,
|
|
default_value: bool) -> None:
|
|
try:
|
|
self.plugin_option(identifier)
|
|
except KeyError:
|
|
self.set_plugin_option(identifier, default_value)
|
|
|
|
def plugin_option(self, identifier: str) -> bool:
|
|
return self.plugins[self.plugin_settings_key(identifier)]
|
|
|
|
def set_plugin_option(self, identifier: str, enabled: bool) -> None:
|
|
self.plugins[self.plugin_settings_key(identifier)] = enabled
|
|
|
|
def __setstate__(self, state) -> None:
|
|
# __setstate__ is called with the dict of the object being unpickled. We
|
|
# can provide save compatibility for new settings options (which
|
|
# normally would not be present in the unpickled object) by creating a
|
|
# new settings object, updating it with the unpickled state, and
|
|
# updating our dict with that.
|
|
new_state = Settings().__dict__
|
|
new_state.update(state)
|
|
self.__dict__.update(new_state)
|