Skip to content
Open
Show file tree
Hide file tree
Changes from 5 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
10 changes: 10 additions & 0 deletions addons/mod_loader/internal/path.gd
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ extends RefCounted
const LOG_NAME := "ModLoader:Path"
const MOD_CONFIG_DIR_PATH := "user://mod_configs"
const MOD_CONFIG_DIR_PATH_OLD := "user://configs"
const USER_MODS_DIR_PATH := "user://mods"


# Get the path to a local folder. Primarily used to get the (packed) mods
Expand Down Expand Up @@ -209,6 +210,9 @@ static func get_mod_paths_from_all_sources() -> Array[String]:

if ModLoaderStore.ml_options.load_from_steam_workshop:
mod_paths.append_array(_ModLoaderSteam.find_steam_workshop_zips())

if ModLoaderStore.ml_options.user_data_mods:
mod_paths.append_array(get_zip_paths_in(get_path_to_user_mods()))

return mod_paths

Expand Down Expand Up @@ -291,3 +295,9 @@ static func handle_mod_config_path_deprecation() -> void:
ModLoaderLog.error("Failed to rename the config directory with error \"%s\"." % [error_string(error)], LOG_NAME)
else:
ModLoaderLog.success("Successfully renamed config directory to \"%s\"." % MOD_CONFIG_DIR_PATH, LOG_NAME)

static func get_path_to_user_mods() -> String:
if ModLoaderStore:
if ModLoaderStore.ml_options.override_path_to_user_data_mods:
return ModLoaderStore.ml_options.override_path_to_user_data_mods
return USER_MODS_DIR_PATH
8 changes: 7 additions & 1 deletion addons/mod_loader/mod_loader_store.gd
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,13 @@ func _update_ml_options_from_cli_args() -> void:
if cmd_line_mod_path:
ml_options.override_path_to_mods = cmd_line_mod_path
ModLoaderLog.info("The path mods are loaded from has been changed via the CLI arg `--mods-path`, to: " + cmd_line_mod_path, LOG_NAME)

# Override paths to user data mods
# Set via: --mod-user-path
# Example: --mod-user-path="C://user/mods"
var cmd_line_mod_user_path := _ModLoaderCLI.get_cmd_line_arg_value("--mod-user-path")
if cmd_line_mod_user_path:
ml_options.override_path_to_user_data_mods = cmd_line_mod_user_path
ModLoaderLog.info("The path mod user data is loaded from has been changed via the CLI arg `--mod-user-path`, to: " + cmd_line_mod_user_path, LOG_NAME)
# Override paths to configs
# Set via: --configs-path
# Example: --configs-path="C://path/configs"
Expand Down
2 changes: 2 additions & 0 deletions addons/mod_loader/options/profiles/current.tres
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ steam_workshop_enabled = false
override_path_to_mods = ""
override_path_to_configs = ""
override_path_to_workshop = ""
user_data_mods = false
override_path_to_user_data_mods = ""
2 changes: 2 additions & 0 deletions addons/mod_loader/options/profiles/default.tres
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ steam_workshop_enabled = false
override_path_to_mods = ""
override_path_to_configs = ""
override_path_to_workshop = ""
user_data_mods = false
override_path_to_user_data_mods = ""
2 changes: 2 additions & 0 deletions addons/mod_loader/options/profiles/disable_mods.tres
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ steam_workshop_enabled = false
override_path_to_mods = ""
override_path_to_configs = ""
override_path_to_workshop = ""
user_data_mods = false
override_path_to_user_data_mods = ""
4 changes: 3 additions & 1 deletion addons/mod_loader/options/profiles/editor.tres
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ override_path_to_mods = ""
override_path_to_configs = ""
override_path_to_workshop = ""
ignore_deprecated_errors = true
ignored_mod_names_in_log = [ ]
ignored_mod_names_in_log = [ ]
user_data_mods = false
override_path_to_user_data_mods = ""
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ ignore_deprecated_errors = false
ignored_mod_names_in_log = []
load_from_steam_workshop = false
load_from_local = true
user_data_mods = false
override_path_to_user_data_mods
2 changes: 2 additions & 0 deletions addons/mod_loader/options/profiles/production_workshop.tres
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ ignore_deprecated_errors = false
ignored_mod_names_in_log = []
load_from_steam_workshop = true
load_from_local = true
user_data_mods = false
override_path_to_user_data_mods
4 changes: 4 additions & 0 deletions addons/mod_loader/resources/options_profile.gd
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,7 @@ var custom_game_version_validation_callable: Callable

## Stores the instance of the script specified in [member customize_script_path].
var customize_script_instance: RefCounted

@export var user_data_mods: bool = true

@export_dir var override_path_to_user_data_mods := ""
1 change: 1 addition & 0 deletions test/test_options/customize_script/custom_validation.tres
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ override_hook_pack_name = ""
restart_notification_scene_path = "res://addons/mod_loader/restart_notification.tscn"
disable_restart = false
game_version_validation = 2
override_path_to_user_data_mods
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ override_hook_pack_name = ""
restart_notification_scene_path = "res://addons/mod_loader/restart_notification.tscn"
disable_restart = false
game_version_validation = 2
override_path_to_user_data_mods = ""
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ override_hook_pack_name = ""
restart_notification_scene_path = "res://addons/mod_loader/restart_notification.tscn"
disable_restart = false
game_version_validation = 0
override_path_to_user_data_mods = ""
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ override_hook_pack_name = ""
restart_notification_scene_path = "res://addons/mod_loader/restart_notification.tscn"
disable_restart = false
game_version_validation = 1
override_path_to_user_data_mods = ""