File tree 4 files changed +16
-5
lines changed
4 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -194,7 +194,11 @@ static func get_mod_paths_from_all_sources() -> Array[String]:
194
194
var mod_paths : Array [String ] = []
195
195
196
196
var mod_dirs := get_dir_paths_in_dir (get_unpacked_mods_dir_path ())
197
- mod_paths .append_array (mod_dirs )
197
+
198
+ if ModLoaderStore .has_feature .editor or ModLoaderStore .ml_options .load_from_unpacked :
199
+ mod_paths .append_array (mod_dirs )
200
+ else :
201
+ ModLoaderLog .info ("Loading mods from \" res://mods-unpacked\" is disabled." , LOG_NAME )
198
202
199
203
if ModLoaderStore .ml_options .load_from_local :
200
204
var mods_dir := get_path_to_mods ()
Original file line number Diff line number Diff line change @@ -30,8 +30,6 @@ signal new_hooks_created
30
30
31
31
const LOG_NAME := "ModLoader"
32
32
33
- var is_in_editor := OS .has_feature ("editor" )
34
-
35
33
36
34
func _init () -> void :
37
35
# if mods are not enabled - don't load mods
@@ -41,7 +39,7 @@ func _init() -> void:
41
39
# Only load the hook pack if not in the editor
42
40
# We can't use it in the editor - see https://github.com/godotengine/godot/issues/19815
43
41
# Mod devs can use the Dev Tool to generate hooks in the editor.
44
- if not is_in_editor and _ModLoaderFile .file_exists (_ModLoaderPath .get_path_to_hook_pack ()):
42
+ if not ModLoaderStore . has_feature . editor and _ModLoaderFile .file_exists (_ModLoaderPath .get_path_to_hook_pack ()):
45
43
_load_mod_hooks_pack ()
46
44
47
45
# Rotate the log files once on startup.
@@ -119,7 +117,7 @@ func _init() -> void:
119
117
# "don't use ZIPs with unpacked mods!"
120
118
# https://github.com/godotengine/godot/issues/19815
121
119
# https://github.com/godotengine/godot/issues/16798
122
- if is_in_editor :
120
+ if ModLoaderStore . has_feature . editor :
123
121
ModLoaderLog .hint (
124
122
"Loading any resource packs (.zip/.pck) with `load_resource_pack` will WIPE the entire virtual res:// directory. " +
125
123
"If you have any unpacked mods in %s , they will not be loaded.Please unpack your mod ZIPs instead, and add them to %s " %
Original file line number Diff line number Diff line change @@ -111,6 +111,9 @@ var cache := {}
111
111
# See: res://addons/mod_loader/resources/options_profile.gd
112
112
var ml_options : ModLoaderOptionsProfile
113
113
114
+ var has_feature := {
115
+ "editor" = OS .has_feature ("editor" )
116
+ }
114
117
115
118
# Methods
116
119
# =============================================================================
Original file line number Diff line number Diff line change @@ -74,6 +74,12 @@ enum VERSION_VALIDATION {
74
74
@export var load_from_steam_workshop : bool = false
75
75
## Indicates whether to load mods from the "mods" folder located at the game's install directory, or the overridden mods path.
76
76
@export var load_from_local : bool = true
77
+ ## Indicates whether to load mods from [code]"res://mods-unpacked"[/code] in the exported game.[br]
78
+ ## ===[br]
79
+ ## [b]Note:[color=note "Load from unpacked in the editor"][/color][/b][br]
80
+ ## In the editor, mods inside [code]"res://mods-unpacked"[/code] are always loaded. Use [member enable_mods] to disable mod loading completely.[br]
81
+ ## ===[br]
82
+ @export var load_from_unpacked : bool = true
77
83
## Path to a folder containing mods [br]
78
84
## Mod zips should be directly in this folder
79
85
@export_dir var override_path_to_mods = ""
You can’t perform that action at this time.
0 commit comments