Skip to content

Commit 8cb4a34

Browse files
committed
fix: inverted if
1 parent 3df29d4 commit 8cb4a34

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

addons/mod_loader/api/log.gd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,9 @@ static func _is_mod_name_ignored(mod_name: String) -> bool:
398398

399399

400400
static func _get_verbosity() -> int:
401-
return ModLoaderStore.ml_options.log_level
401+
if not ModLoaderStore:
402+
return VERBOSITY_LEVEL.DEBUG
403+
return ModLoaderStore.ml_options.log_level
402404

403405

404406
static func _store_log(log_entry: ModLoaderLogEntry) -> void:

addons/mod_loader/mod_loader_store.gd

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ func _update_ml_options_from_options_resource() -> void:
170170
for key in ml_options:
171171
ml_options[key] = current_options[key]
172172

173-
174173
# Get options overrides by feature tags
175174
# An override is saved as Dictionary[String: ModLoaderOptionsProfile]
176175
for feature_tag in options_resource.feature_override_options.keys():
@@ -182,20 +181,24 @@ func _update_ml_options_from_options_resource() -> void:
182181
"https://docs.godotengine.org/en/3.5/tutorials/export/feature_tags.html"
183182
), LOG_NAME)
184183
continue
184+
185185
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
194-
# Update from the options in the resource
195-
for key in ml_options:
196-
ml_options[key] = override_options[key]
186+
ModLoaderLog.info("Options override feature tag \"%s\". does not apply, skipping." % feature_tag, LOG_NAME)
187+
continue
197188

189+
ModLoaderLog.info("Applying options override with feature tag \"%s\"." % feature_tag, LOG_NAME)
190+
var override_options = options_resource.feature_override_options[feature_tag]
191+
if not override_options is ModLoaderOptionsProfile:
192+
ModLoaderLog.error(str(
193+
"Options override is not a valid Resource of type ModLoaderOptionsProfile. ",
194+
"Options override key with invalid resource: \"%s\". " % feature_tag,
195+
"Please edit your options at %s. " % ml_options_path
196+
), LOG_NAME)
197+
continue
198198

199+
# Update from the options in the resource
200+
for key in ml_options:
201+
ml_options[key] = override_options[key]
199202

200203

201204
# Update ModLoader's options, via CLI args

addons/mod_loader/resources/options_current.gd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ class_name ModLoaderCurrentOptions
22
extends Resource
33

44
# The default options set for the mod loader
5-
export var current_options: Resource = preload("res://addons/mod_loader/options/profiles/default.tres")
5+
export (Resource) var current_options: Resource = preload("res://addons/mod_loader/options/profiles/default.tres")
66

77
# Overrides for all available feature tags through OS.has_feature()
88
# Format: Dictionary[String: ModLoaderOptionsProfile] where the string is a tag
99
# Warning: Some tags can occur at the same time (Windows + editor for example) -
1010
# In a case where multiple apply, the last one in the dict will override all others
11-
export var feature_override_options: Dictionary = {
11+
export (Dictionary) var feature_override_options: Dictionary = {
1212
"editor": preload("res://addons/mod_loader/options/profiles/editor.tres")
1313
}
1414

0 commit comments

Comments
 (0)