Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions addons/mod_loader/api/mod.gd
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const LOG_NAME := "ModLoader:Mod"
static func install_script_extension(child_script_path: String) -> void:

var mod_id: String = ModLoaderUtils.get_string_in_between(child_script_path, "res://mods-unpacked/", "/")
var mod_data: ModData = get_mod_data_from_mod_id(mod_id)
var mod_data: ModData = get_mod_data(mod_id)
if not ModLoaderStore.saved_extension_paths.has(mod_data.manifest.get_mod_id()):
ModLoaderStore.saved_extension_paths[mod_data.manifest.get_mod_id()] = []
ModLoaderStore.saved_extension_paths[mod_data.manifest.get_mod_id()].append(child_script_path)
Expand Down Expand Up @@ -102,7 +102,7 @@ static func add_translation_from_resource(resource_path: String) -> void:


# Gets the ModData from the provided namespace
static func get_mod_data_from_mod_id(mod_id: String) -> ModData:
static func get_mod_data(mod_id: String) -> ModData:
if not ModLoaderStore.mod_data.has(mod_id):
ModLoaderLog.error("%s is an invalid mod_id" % mod_id, LOG_NAME)
return null
Expand All @@ -116,7 +116,7 @@ static func is_mod_loaded(mod_id: String) -> bool:
ModLoaderLog.warning(
"The ModLoader is not fully initialized. " +
"Calling \"is_mod_loaded()\" in \"_init()\" may result in an unexpected return value as mods are still loading.",
LOG_NAME
LOG_NAME
)

# If the mod is not present in the mod_data dictionary or the mod is flagged as not loadable.
Expand Down
11 changes: 10 additions & 1 deletion addons/mod_loader/mod_loader.gd
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ const LOG_NAME := "ModLoader"

# --- DEPRECATED ---
# UNPACKED_DIR was moved to ModLoaderStore.
# However, many Brotato mods use this const directly, which is why the deprecation warning was added.
# However, many mods use this const directly, which is why the deprecation warning was added.
var UNPACKED_DIR := "res://mods-unpacked/" setget ,deprecated_direct_access_UNPACKED_DIR

# mod_data was moved to ModLoaderStore.
# However, many mods use this const directly, which is why the deprecation warning was added.
var mod_data := {} setget , deprecated_direct_access_mod_data

# Main
# =============================================================================

Expand Down Expand Up @@ -374,3 +378,8 @@ func get_mod_config(mod_dir_name: String = "", key: String = "") -> ModConfig:
func deprecated_direct_access_UNPACKED_DIR() -> String:
ModLoaderDeprecated.deprecated_message("The const \"UNPACKED_DIR\" was removed, use \"ModLoaderMod.get_unpacked_dir()\" instead", "6.0.0")
return _ModLoaderPath.get_unpacked_mods_dir_path()


func deprecated_direct_access_mod_data() -> Dictionary:
ModLoaderDeprecated.deprecated_message("The var \"mod_data\" was removed, use \"ModLoaderMod.get_mod_data()\" instead", "6.0.0")
return ModLoaderStore.mod_data