mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Changed mod_settings into Optional[ModSettings]
This commit is contained in:
@@ -124,7 +124,7 @@ class Faction:
|
||||
|
||||
# Store mod settings so mod properties can be injected again on game load,
|
||||
# in case mods like CJS F/A-18E/F/G or IDF F-16I are selected by the player
|
||||
mod_settings: ModSettings = field(default=None)
|
||||
mod_settings: Optional[ModSettings] = field(default=None)
|
||||
|
||||
def has_access_to_dcs_type(self, unit_type: Type[DcsUnitType]) -> bool:
|
||||
# Vehicle and Ship Units
|
||||
@@ -287,13 +287,27 @@ class Faction:
|
||||
if unit.unit_class is unit_class:
|
||||
yield unit
|
||||
|
||||
def apply_mod_settings(self) -> None:
|
||||
self.apply_mod_settings(self.mod_settings)
|
||||
def apply_mod_settings(self, mod_settings: Optional[ModSettings] = None) -> None:
|
||||
from game.theater.start_generator import ModSettings
|
||||
|
||||
def apply_mod_settings(self, mod_settings: ModSettings) -> None:
|
||||
# Update the mod settings of this faction
|
||||
# so the settings can be applied again on load, if needed
|
||||
self.mod_settings = mod_settings
|
||||
if mod_settings is None:
|
||||
mod_settings = ModSettings(
|
||||
a4_skyhawk=False,
|
||||
f_16_idf=False,
|
||||
f22_raptor=False,
|
||||
f104_starfighter=False,
|
||||
hercules=False,
|
||||
uh_60l=False,
|
||||
jas39_gripen=False,
|
||||
su57_felon=False,
|
||||
frenchpack=False,
|
||||
high_digit_sams=False,
|
||||
)
|
||||
self.mod_settings = mod_settings
|
||||
else:
|
||||
self.mod_settings = mod_settings
|
||||
|
||||
# aircraft
|
||||
if not mod_settings.a4_skyhawk:
|
||||
|
||||
@@ -83,7 +83,6 @@ class GameGenerator:
|
||||
self.air_wing_config = air_wing_config
|
||||
self.settings = settings
|
||||
self.generator_settings = generator_settings
|
||||
self.mod_settings = mod_settings
|
||||
self.player.apply_mod_settings(mod_settings)
|
||||
self.enemy.apply_mod_settings(mod_settings)
|
||||
|
||||
@@ -105,7 +104,6 @@ class GameGenerator:
|
||||
|
||||
GroundObjectGenerator(game, self.generator_settings).generate()
|
||||
game.settings.version = VERSION
|
||||
game.mod_settings = self.mod_settings
|
||||
return game
|
||||
|
||||
def should_remove_carrier(self, player: bool) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user