Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: ✨ Config JSON: Only log notice for no custom JSON once #138

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion addons/mod_loader/mod_loader.gd
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ var loaded_vanilla_parents_cache := {}
# Helps to decide whether a script extension should go through the _handle_script_extensions process
var is_initializing := true

# Keeps track of logged messages, to avoid flooding the log with duplicate notices
var logged_messages := []

# These variables handle various options, which can be changed via Godot's GUI
# by adding a ModLoaderOptions resource to the resource file specified by
# `ml_options_path`. See res://addons/mod_loader/options_examples for some
Expand Down Expand Up @@ -775,7 +778,11 @@ func get_mod_config(mod_dir_name: String = "", key: String = "") -> Dictionary:
if not status_code == MLConfigStatus.OK:
if status_code == MLConfigStatus.NO_JSON_OK:
# No user config file exists. Low importance as very likely to trigger
ModLoaderUtils.log_debug("Config JSON Notice: %s" % status_msg, mod_dir_name)
var full_msg = "Config JSON Notice: %s" % status_msg
# Only log this once, to avoid flooding the log
if not logged_messages.has(full_msg):
ModLoaderUtils.log_debug(full_msg, mod_dir_name)
logged_messages.push_back(full_msg)
else:
# Code error (eg. invalid mod ID)
ModLoaderUtils.log_fatal("Config JSON Error (%s): %s" % [status_code, status_msg], mod_dir_name)
Expand Down