@@ -82,9 +82,11 @@ var mod_data = {}
82
82
# Order for mods to be loaded in, set by `_get_load_order`
83
83
var mod_load_order = []
84
84
85
- # Override for the path mods are loaded from. Only gets set if the CLI arg
86
- # --mods-path is used. This can be tested in the editor via:
87
- # Project Settings > Display> Editor > Main Run Args
85
+ # Override for the path mods are loaded from. Only set if the CLI arg is present.
86
+ # Can be tested in the editor via: Project Settings > Display> Editor > Main Run Args
87
+ # Default: "res://mods"
88
+ # Set via: --mods-path
89
+ # Example: --mods-path="C://path/mods"
88
90
var os_mods_path_override = ""
89
91
90
92
# Any mods that are missing their dependancies are added to this
@@ -209,6 +211,8 @@ func mod_log(text:String, mod_name:String = "Unknown-Mod", pretty:bool = false)-
209
211
log_file .close ()
210
212
211
213
214
+ # Loop over "res://mods" and add any mod zips to the unpacked virtual directory
215
+ # (UNPACKED_DIR)
212
216
func _load_mod_zips ():
213
217
# Path to the games mod folder
214
218
var game_mod_folder_path = _get_mod_folder_dir ()
@@ -247,12 +251,15 @@ func _load_mod_zips():
247
251
var is_mod_loaded_success = ProjectSettings .load_resource_pack (mod_folder_global_path , false )
248
252
249
253
# Notifies developer of an issue with Godot, where using `load_resource_pack`
250
- # in the editor WIPES the entire res:// directory the first time you use it:
254
+ # in the editor WIPES the entire virtual res:// directory the first time you
255
+ # use it. This means that unpacked mods are no longer accessible, because they
256
+ # no longer exist in the file system. So this warning basically says
257
+ # "don't use ZIPs with unpacked mods!"
251
258
# https://github.com/godotengine/godot/issues/19815
252
259
# https://github.com/godotengine/godot/issues/16798
253
260
if OS .has_feature ("editor" ) && ! has_shown_editor_warning :
254
261
mod_log (str (
255
- "WARNING: Loading files with `load_resource_pack` will WIPE the entire virtual res:// directory. " ,
262
+ "WARNING: Loading ZIP files with `load_resource_pack` will WIPE the entire virtual res:// directory. " ,
256
263
"If you have any unpacked mods in " , UNPACKED_DIR , ", they will not be loaded. " ,
257
264
"Please unpack your mod ZIPs instead, and add them to " , UNPACKED_DIR ), LOG_NAME )
258
265
has_shown_editor_warning = true
@@ -271,6 +278,8 @@ func _load_mod_zips():
271
278
dir .list_dir_end ()
272
279
273
280
281
+ # Loop over UNPACKED_DIR and triggers `_init_mod_data` for each mod directory,
282
+ # which adds their data to mod_data.
274
283
func _setup_mods ():
275
284
# Path to the unpacked mods folder
276
285
var unpacked_mods_path = UNPACKED_DIR
@@ -484,7 +493,6 @@ func _init_mod(mod):
484
493
add_child (mod_main_instance , true )
485
494
486
495
487
-
488
496
# Utils (Mod Loader)
489
497
# =============================================================================
490
498
@@ -510,7 +518,8 @@ func _get_cmd_line_arg(argument) -> String:
510
518
511
519
return ""
512
520
513
- # Get the path to the (packed) mods folder, ie "res://mods" or the OS's equivalent
521
+ # Get the path to a local folder. Primarily used to get the (packed) mods
522
+ # folder, ie "res://mods" or the OS's equivalent, as well as the configs path
514
523
func _get_mod_folder_dir ():
515
524
var game_install_directory = OS .get_executable_path ().get_base_dir ()
516
525
0 commit comments