Skip to content

Commit 26bcc8d

Browse files
authored
Merge - v6.0.2
2 parents 279a012 + bd56c38 commit 26bcc8d

File tree

5 files changed

+40
-37
lines changed

5 files changed

+40
-37
lines changed

addons/mod_loader/api/profile.gd

+22-31
Original file line numberDiff line numberDiff line change
@@ -253,45 +253,36 @@ static func _update_mod_list(mod_list: Dictionary, mod_data := ModLoaderStore.mo
253253
var updated_mod_list := mod_list.duplicate(true)
254254

255255
# Iterate over each mod ID in the mod list
256-
for mod_id in updated_mod_list:
256+
for mod_id in updated_mod_list.keys():
257257
var mod_list_entry: Dictionary = updated_mod_list[mod_id]
258258

259-
# If mod data is accessible and the mod is not loaded
260-
if not mod_data.empty() and not mod_data.has(mod_id):
261-
# Check if the mod_dir for the mod-id exists
262-
if not _ModLoaderFile.dir_exists(_ModLoaderPath.get_unpacked_mods_dir_path() + mod_id):
263-
# If the mod directory doesn't exist,
264-
# the mod is no longer installed and can be removed from the mod list
265-
updated_mod_list.erase(mod_id)
266-
continue
267-
268259
# Check if the current config doesn't exist
269260
# This can happen if the config file was manually deleted
270261
if mod_list_entry.has("current_config") and _ModLoaderPath.get_path_to_mod_config_file(mod_id, mod_list_entry.current_config).empty():
271262
# If the current config doesn't exist, reset it to the default configuration
272263
mod_list_entry.current_config = ModLoaderConfig.DEFAULT_CONFIG_NAME
273264

274-
# If the mod is not loaded
275-
if not mod_data.has(mod_id):
276-
if (
277-
# Check if the entry has a zip_path key
278-
mod_list_entry.has("zip_path") and
279-
# Check if the entry has a zip_path
280-
not mod_list_entry.zip_path.empty() and
281-
# Check if the zip file for the mod exists
282-
not _ModLoaderFile.file_exists(mod_list_entry.zip_path)
283-
):
284-
# If the mod directory doesn't exist,
285-
# the mod is no longer installed and can be removed from the mod list
286-
ModLoaderLog.debug(
287-
"Mod \"%s\" has been deleted from all user profiles as the corresponding zip file no longer exists at path \"%s\"."
288-
% [mod_id, mod_list_entry.zip_path],
289-
LOG_NAME,
290-
true
291-
)
292-
293-
updated_mod_list.erase(mod_id)
294-
continue
265+
if (
266+
# If the mod is not loaded
267+
not mod_data.has(mod_id) and
268+
# Check if the entry has a zip_path key
269+
mod_list_entry.has("zip_path") and
270+
# Check if the entry has a zip_path
271+
not mod_list_entry.zip_path.empty() and
272+
# Check if the zip file for the mod doesn't exist
273+
not _ModLoaderFile.file_exists(mod_list_entry.zip_path)
274+
):
275+
# If the mod directory doesn't exist,
276+
# the mod is no longer installed and can be removed from the mod list
277+
ModLoaderLog.debug(
278+
"Mod \"%s\" has been deleted from all user profiles as the corresponding zip file no longer exists at path \"%s\"."
279+
% [mod_id, mod_list_entry.zip_path],
280+
LOG_NAME,
281+
true
282+
)
283+
284+
updated_mod_list.erase(mod_id)
285+
continue
295286

296287
updated_mod_list[mod_id] = mod_list_entry
297288

addons/mod_loader/internal/file.gd

-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ static func load_zips_in_folder(folder_path: String) -> Dictionary:
5858
ModLoaderLog.error("Can't read mod folder %s (Error: %s)" % [folder_path, mod_dir_listdir_error], LOG_NAME)
5959
return {}
6060

61-
62-
6361
# Get all zip folders inside the game mod folder
6462
while true:
6563
# Get the next file in the directory

addons/mod_loader/mod_loader.gd

+4-2
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,10 @@ func _setup_mods() -> int:
282282
ModLoaderLog.info("Skipped setting up mod: \"%s\"" % mod_dir_name, LOG_NAME)
283283
continue
284284

285-
# Init the mod data for each mod
286-
_init_mod_data(mod_dir_name)
285+
# Initialize the mod data for each mod if there is no existing mod data for that mod.
286+
if not ModLoaderStore.mod_data.has(mod_dir_name):
287+
_init_mod_data(mod_dir_name)
288+
287289
unpacked_mods_count += 1
288290

289291
dir.list_dir_end()

addons/mod_loader/mod_loader_store.gd

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ extends Node
1212
# Most of these settings should never need to change, aside from the DEBUG_*
1313
# options (which should be `false` when distributing compiled PCKs)
1414

15-
const MODLOADER_VERSION = "6.0.1"
15+
const MODLOADER_VERSION = "6.0.2"
1616

1717
# If true, a complete array of filepaths is stored for each mod. This is
1818
# disabled by default because the operation can be very expensive, but may

addons/mod_loader/resources/mod_manifest.gd

+13-1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ func _init(manifest: Dictionary) -> void:
110110
incompatibilities,
111111
["dependencies", "incompatibilities"]
112112
) or
113+
not validate_distinct_mod_ids_in_arrays(
114+
mod_id,
115+
optional_dependencies,
116+
dependencies,
117+
["optional_dependencies", "dependencies"]
118+
) or
113119
not validate_distinct_mod_ids_in_arrays(
114120
mod_id,
115121
optional_dependencies,
@@ -128,7 +134,13 @@ func _init(manifest: Dictionary) -> void:
128134
load_before,
129135
optional_dependencies,
130136
["load_before", "optional_dependencies"],
131-
"\"load_before\" can be viewed as optional dependency, please remove the duplicate mod-id.")
137+
"\"load_before\" can be viewed as optional dependency, please remove the duplicate mod-id."
138+
) or
139+
not validate_distinct_mod_ids_in_arrays(
140+
mod_id,
141+
load_before,
142+
incompatibilities,
143+
["load_before", "incompatibilities"])
132144
):
133145
return
134146

0 commit comments

Comments
 (0)