@@ -150,15 +150,52 @@ func _update_ml_options_from_options_resource() -> void:
150150 var ml_options_path := "res://addons/mod_loader/options/options.tres"
151151
152152 # Get user options for ModLoader
153- if _ModLoaderFile .file_exists (ml_options_path ):
154- var options_resource := load (ml_options_path )
155- if not options_resource .current_options == null :
156- var current_options : Resource = options_resource .current_options
153+ if not _ModLoaderFile .file_exists (ml_options_path ):
154+ ModLoaderLog .fatal (str ("A critical file is missing: " , ml_options_path ), LOG_NAME )
155+
156+ var options_resource : ModLoaderCurrentOptions = load (ml_options_path )
157+ if options_resource .current_options == null :
158+ ModLoaderLog .warning (str (
159+ "No current options are set. Falling back to defaults. " ,
160+ "Edit your options at %s . " % ml_options_path
161+ ), LOG_NAME )
162+ else :
163+ var current_options = options_resource .current_options
164+ if not current_options is ModLoaderOptionsProfile :
165+ ModLoaderLog .error (str (
166+ "Current options is not a valid Resource of type ModLoaderOptionsProfile. " ,
167+ "Please edit your options at %s . " % ml_options_path
168+ ), LOG_NAME )
169+ # Update from the options in the resource
170+ for key in ml_options :
171+ ml_options [key ] = current_options [key ]
172+
173+
174+ # Get options overrides by feature tags
175+ # An override is saved as Dictionary[String: ModLoaderOptionsProfile]
176+ for feature_tag in options_resource .feature_override_options .keys ():
177+ if not feature_tag is String :
178+ ModLoaderLog .error (str (
179+ "Options override keys are required to be of type String. Failing key: \" %s .\" " % feature_tag ,
180+ "Please edit your options at %s . " % ml_options_path ,
181+ "Consult the documentation for all available feature tags: " ,
182+ "https://docs.godotengine.org/en/3.5/tutorials/export/feature_tags.html"
183+ ), LOG_NAME )
184+ continue
185+ if not OS .has_feature (feature_tag ):
186+ var override_options = options_resource .feature_override_options [feature_tag ]
187+ if not override_options is ModLoaderOptionsProfile :
188+ ModLoaderLog .error (str (
189+ "Options override is not a valid Resource of type ModLoaderOptionsProfile. " ,
190+ "Options override key with invalid resource: \" %s \" . " % feature_tag ,
191+ "Please edit your options at %s . " % ml_options_path
192+ ), LOG_NAME )
193+ continue
157194 # Update from the options in the resource
158195 for key in ml_options :
159- ml_options [key ] = current_options [key ]
160- else :
161- ModLoaderLog . fatal ( str ( "A critical file is missing: " , ml_options_path ), LOG_NAME )
196+ ml_options [key ] = override_options [key ]
197+
198+
162199
163200
164201# Update ModLoader's options, via CLI args
0 commit comments