File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -293,18 +293,20 @@ func _setup_mods() -> int:
293
293
# The mod_folder_path is just the folder name that was added to UNPACKED_DIR,
294
294
# which depends on the name used in a given mod ZIP (eg "mods-unpacked/Folder-Name")
295
295
func _init_mod_data (mod_id : String , zip_path := "" ) -> void :
296
- # Path to the mod in UNPACKED_DIR (eg "res://mods-unpacked/My-Mod")
296
+ # Path to the mod in UNPACKED_DIR (eg "res://mods-unpacked/My-Mod")
297
297
var local_mod_path := _ModLoaderPath .get_unpacked_mods_dir_path ().path_join (mod_id )
298
298
299
299
var mod := ModData .new ()
300
300
if not zip_path .is_empty ():
301
301
mod .zip_name = _ModLoaderPath .get_file_name_from_path (zip_path )
302
302
mod .zip_path = zip_path
303
+ mod .source = mod .get_mod_source ()
303
304
mod .dir_path = local_mod_path
304
305
mod .dir_name = mod_id
305
306
var mod_overwrites_path := mod .get_optional_mod_file_path (ModData .optional_mod_files .OVERWRITES )
306
307
mod .is_overwrite = _ModLoaderFile .file_exists (mod_overwrites_path )
307
308
mod .is_locked = true if mod_id in ModLoaderStore .ml_options .locked_mods else false
309
+
308
310
ModLoaderStore .mod_data [mod_id ] = mod
309
311
310
312
# Get the mod file paths
Original file line number Diff line number Diff line change @@ -23,6 +23,16 @@ enum optional_mod_files {
23
23
OVERWRITES
24
24
}
25
25
26
+ # Specifies the source from which the mod has been loaded:
27
+ # UNPACKED = From the mods-unpacked directory ( only when in the editor ).
28
+ # LOCAL = From the local mod zip directory, which by default is ../game_dir/mods.
29
+ # STEAM_WORKSHOP = Loaded from ../Steam/steamapps/workshop/content/1234567/[..].
30
+ enum sources {
31
+ UNPACKED ,
32
+ LOCAL ,
33
+ STEAM_WORKSHOP ,
34
+ }
35
+
26
36
# Name of the Mod's zip file
27
37
var zip_name := ""
28
38
# Path to the Mod's zip file
@@ -47,6 +57,8 @@ var manifest: ModManifest
47
57
# Updated in load_configs
48
58
var configs := {}
49
59
var current_config : ModConfig : set = _set_current_config
60
+ # Specifies the source from which the mod has been loaded
61
+ var source : int
50
62
51
63
# only set if DEBUG_ENABLE_STORING_FILEPATHS is enabled
52
64
var file_paths : PackedStringArray = []
@@ -154,8 +166,18 @@ func get_required_mod_file_path(required_file: int) -> String:
154
166
return dir_path .path_join ("manifest.json" )
155
167
return ""
156
168
169
+
157
170
func get_optional_mod_file_path (optional_file : int ) -> String :
158
171
match optional_file :
159
172
optional_mod_files .OVERWRITES :
160
173
return dir_path .path_join ("overwrites.gd" )
161
174
return ""
175
+
176
+
177
+ func get_mod_source () -> sources:
178
+ if zip_path .contains ("workshop" ):
179
+ return sources .STEAM_WORKSHOP
180
+ if zip_path == "" :
181
+ return sources .UNPACKED
182
+
183
+ return sources .LOCAL
You can’t perform that action at this time.
0 commit comments