@@ -47,30 +47,32 @@ def SaveModSettings(mod: ModObjects.SDKMod) -> None:
4747 """
4848 mod_settings : Dict [str , Any ] = {}
4949
50- if len (mod .Options ) > 0 :
51- mod_settings [_OPTIONS_CATEGORY_NAME ] = {}
52-
53- def create_options_dict (options : Sequence [Options .Base ]) -> Dict [str , Any ]:
54- settings = {}
55- for option in options :
56- if isinstance (option , Options .Value ):
57- settings [option .Caption ] = option .CurrentValue
58- elif isinstance (option , Options .Nested ):
59- settings [option .Caption ] = create_options_dict (option .Children )
60- return settings
61-
62- mod_settings [_OPTIONS_CATEGORY_NAME ] = create_options_dict (mod .Options )
63-
64- if any (k .IsRebindable for k in mod .Keybinds ):
65- mod_settings [_KEYBINDS_CATEGORY_NAME ] = {}
66- for input in mod .Keybinds :
67- if isinstance (input , KeybindManager .Keybind ):
68- if not input .IsRebindable :
69- continue
70- mod_settings [_KEYBINDS_CATEGORY_NAME ][input .Name ] = input .Key
71- else :
72- dh .PrintWarning (KeybindManager .Keybind ._list_deprecation_warning )
73- mod_settings [_KEYBINDS_CATEGORY_NAME ][input [0 ]] = input [1 ]
50+ def create_options_dict (options : Sequence [Options .Base ]) -> Dict [str , Any ]:
51+ settings = {}
52+ for option in options :
53+ if isinstance (option , Options .Value ):
54+ settings [option .Caption ] = option .CurrentValue
55+ elif isinstance (option , Options .Nested ):
56+ settings [option .Caption ] = create_options_dict (option .Children )
57+ return settings
58+
59+ options_dict = create_options_dict (mod .Options )
60+
61+ if len (options_dict ) > 0 :
62+ mod_settings [_OPTIONS_CATEGORY_NAME ] = options_dict
63+
64+ keybinds_dict = {}
65+ for input in mod .Keybinds :
66+ if isinstance (input , KeybindManager .Keybind ):
67+ if not input .IsRebindable :
68+ continue
69+ keybinds_dict [input .Name ] = input .Key
70+ else :
71+ dh .PrintWarning (KeybindManager .Keybind ._list_deprecation_warning )
72+ keybinds_dict [input [0 ]] = input [1 ]
73+
74+ if len (keybinds_dict ) > 0 :
75+ mod_settings [_KEYBINDS_CATEGORY_NAME ] = keybinds_dict
7476
7577 if mod .SaveEnabledState != ModObjects .EnabledSaveType .NotSaved :
7678 mod_settings [_ENABLED_CATEGORY_NAME ] = mod .IsEnabled
0 commit comments