mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Support for Bandit's cloud presets mod (v15)
This commit is contained in:
@@ -462,7 +462,7 @@ class Settings:
|
||||
"range is defined in the helicopter's yaml specification."
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
# Campaign management
|
||||
# General
|
||||
squadron_random_chance: int = bounded_int_option(
|
||||
@@ -501,6 +501,13 @@ class Settings:
|
||||
"assigned to their primary task."
|
||||
),
|
||||
)
|
||||
use_bandit_clouds: bool = boolean_option(
|
||||
"Use Bandit's clouds",
|
||||
page=CAMPAIGN_MANAGEMENT_PAGE,
|
||||
section=GENERAL_SECTION,
|
||||
default=False,
|
||||
detail=("If checked, Bandit's cloud presets will become available."),
|
||||
)
|
||||
|
||||
# Pilots and Squadrons
|
||||
ai_pilot_levelling: bool = boolean_option(
|
||||
|
||||
@@ -2,9 +2,10 @@ from __future__ import annotations
|
||||
|
||||
import random
|
||||
from dataclasses import dataclass, field
|
||||
from math import ceil, floor
|
||||
from typing import Optional
|
||||
|
||||
from dcs.cloud_presets import Clouds as PydcsClouds
|
||||
from dcs.cloud_presets import CLOUD_PRESETS
|
||||
from dcs.weather import Weather as PydcsWeather, CloudPreset
|
||||
|
||||
|
||||
@@ -18,14 +19,14 @@ class Clouds:
|
||||
|
||||
@classmethod
|
||||
def random_preset(cls, rain: bool) -> Clouds:
|
||||
clouds = (p.value for p in PydcsClouds)
|
||||
clouds = (p.value for _, p in CLOUD_PRESETS.items())
|
||||
if rain:
|
||||
presets = [p for p in clouds if "Rain" in p.name]
|
||||
else:
|
||||
presets = [p for p in clouds if "Rain" not in p.name]
|
||||
preset = random.choice(presets)
|
||||
return Clouds(
|
||||
base=random.randint(preset.min_base, preset.max_base),
|
||||
base=random.randint(ceil(preset.min_base), floor(preset.max_base)),
|
||||
density=0,
|
||||
thickness=0,
|
||||
precipitation=PydcsWeather.Preceptions.None_,
|
||||
|
||||
Reference in New Issue
Block a user