From 9276db05d7f2b90340843304798da973217c6eea Mon Sep 17 00:00:00 2001 From: MetalStormGhost Date: Sun, 24 Apr 2022 12:45:32 +0300 Subject: [PATCH] Loading saved mod settings from the faction now works. --- game/factions/faction.py | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/game/factions/faction.py b/game/factions/faction.py index 5a2bd176..4bf1178f 100644 --- a/game/factions/faction.py +++ b/game/factions/faction.py @@ -288,25 +288,17 @@ class Faction: yield unit def apply_mod_settings(self, mod_settings: Optional[ModSettings] = None) -> None: - from game.theater.start_generator import ModSettings - - # Update the mod settings of this faction - # so the settings can be applied again on load, if needed - 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 + if mod_settings is None and self.mod_settings is None: + # No mod settings were provided and none were saved for this faction + # so stop here + return + elif self.mod_settings is not None: + # Saved mod settings were found for this faction, + # so load them for use + mod_settings = self.mod_settings else: + # Update the mod settings of this faction + # so the settings can be applied again on load, if needed self.mod_settings = mod_settings # aircraft