Support for auto-fog

implemented as a setting...
This commit is contained in:
Raffson 2024-12-26 02:44:38 +01:00
parent 3ef6ae20c7
commit d1b484f560
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99
5 changed files with 18 additions and 4 deletions

View File

@ -12,11 +12,12 @@ from game.weather.wind import WindConditions
class EnvironmentGenerator:
def __init__(
self, mission: Mission, conditions: Conditions, time: datetime
self, mission: Mission, conditions: Conditions, time: datetime, auto_fog: bool
) -> None:
self.mission = mission
self.conditions = conditions
self.time = time
self.auto_fog = auto_fog
def set_atmospheric(self, atmospheric: AtmosphericConditions) -> None:
self.mission.weather.qnh = atmospheric.qnh.mm_hg
@ -33,6 +34,7 @@ class EnvironmentGenerator:
self.mission.weather.clouds_preset = clouds.preset
def set_fog(self, fog: Optional[Fog]) -> None:
self.mission.weather.auto_fog = self.auto_fog
if fog is None:
return
self.mission.weather.fog_visibility = int(fog.visibility.meters)

View File

@ -86,7 +86,10 @@ class MissionGenerator:
self.add_airfields_to_unit_map()
self.initialize_registries()
EnvironmentGenerator(self.mission, self.game.conditions, self.time).generate()
auto_fog = self.game.settings.use_auto_fog
EnvironmentGenerator(
self.mission, self.game.conditions, self.time, auto_fog
).generate()
tgo_generator = TgoGenerator(
self.mission,

View File

@ -83,7 +83,10 @@ class PretenseMissionGenerator(MissionGenerator):
self.add_airfields_to_unit_map()
self.initialize_registries()
EnvironmentGenerator(self.mission, self.game.conditions, self.time).generate()
auto_fog = self.game.settings.use_auto_fog
EnvironmentGenerator(
self.mission, self.game.conditions, self.time, auto_fog
).generate()
tgo_generator = PretenseTgoGenerator(
self.mission,

View File

@ -1073,6 +1073,12 @@ class Settings:
GAMEPLAY_SECTION,
default=True,
)
use_auto_fog: bool = boolean_option(
"Use DCS' automatic fog setting",
MISSION_GENERATOR_PAGE,
GAMEPLAY_SECTION,
default=True,
)
# Performance
perf_smoke_gen: bool = boolean_option(

View File

@ -33,7 +33,7 @@ pluggy==1.5.0
pre-commit==3.7.1
pydantic==2.7.4
pydantic-settings==2.3.3
pydcs @ git+https://github.com/dcs-retribution/pydcs@d227a6a81e159f0df8a31d12e8bc10ee12673c73
pydcs @ git+https://github.com/dcs-retribution/pydcs@d4f141fb8bfa75a4e3b8280012ab46723a6b05ef
pyinstaller==5.13.2
pyinstaller-hooks-contrib==2024.0
pyparsing==3.1.2