@@ -40,76 +40,6 @@ static func install_script_extension(child_script_path: String) -> void:
40
40
_ModLoaderScriptExtension .apply_extension (child_script_path )
41
41
42
42
43
- # Uninstall a script extension.
44
- #
45
- # Parameters:
46
- # - extension_script_path (String): The path to the extension script to be uninstalled.
47
- #
48
- # Returns: void
49
- static func uninstall_script_extension (extension_script_path : String ) -> void :
50
- # Currently this is the only thing we do, but it is better to expose
51
- # this function like this for further changes
52
- _ModLoaderScriptExtension .remove_specific_extension_from_script (extension_script_path )
53
-
54
-
55
- # Reload all mods.
56
- #
57
- # *Note: This function should be called only when actually necessary
58
- # as it can break the game and require a restart for mods
59
- # that do not fully use the systems put in place by the mod loader,
60
- # so anything that just uses add_node, move_node ecc...
61
- # To not have your mod break on reload please use provided functions
62
- # like ModLoader::save_scene, ModLoader::append_node_in_scene and
63
- # all the functions that will be added in the next versions
64
- # Used to reload already present mods and load new ones*
65
- #
66
- # Returns: void
67
- func reload_mods () -> void :
68
-
69
- # Currently this is the only thing we do, but it is better to expose
70
- # this function like this for further changes
71
- ModLoader ._reload_mods ()
72
-
73
-
74
- # Disable all mods.
75
- #
76
- # *Note: This function should be called only when actually necessary
77
- # as it can break the game and require a restart for mods
78
- # that do not fully use the systems put in place by the mod loader,
79
- # so anything that just uses add_node, move_node ecc...
80
- # To not have your mod break on disable please use provided functions
81
- # and implement a _disable function in your mod_main.gd that will
82
- # handle removing all the changes that were not done through the Mod Loader*
83
- #
84
- # Returns: void
85
- func disable_mods () -> void :
86
-
87
- # Currently this is the only thing we do, but it is better to expose
88
- # this function like this for further changes
89
- ModLoader ._disable_mods ()
90
-
91
-
92
- # Disable a mod.
93
- #
94
- # *Note: This function should be called only when actually necessary
95
- # as it can break the game and require a restart for mods
96
- # that do not fully use the systems put in place by the mod loader,
97
- # so anything that just uses add_node, move_node ecc...
98
- # To not have your mod break on disable please use provided functions
99
- # and implement a _disable function in your mod_main.gd that will
100
- # handle removing all the changes that were not done through the Mod Loader*
101
- #
102
- # Parameters:
103
- # - mod_data (ModData): The ModData object representing the mod to be disabled.
104
- #
105
- # Returns: void
106
- func disable_mod (mod_data : ModData ) -> void :
107
-
108
- # Currently this is the only thing we do, but it is better to expose
109
- # this function like this for further changes
110
- ModLoader ._disable_mod (mod_data )
111
-
112
-
113
43
# Register an array of classes to the global scope since Godot only does that in the editor.
114
44
#
115
45
# Format: `{ "base": "ParentClass", "class": "ClassName", "language": "GDScript", "path": "res://path/class_name.gd" }`
@@ -145,51 +75,6 @@ static func add_translation(resource_path: String) -> void:
145
75
ModLoaderLog .info ("Added Translation from Resource -> %s " % resource_path , LOG_NAME )
146
76
147
77
148
- # Gets the ModData from the provided namespace
149
- #
150
- # Parameters:
151
- # - mod_id (String): The ID of the mod.
152
- #
153
- # Returns:
154
- # - ModData: The ModData associated with the provided mod_id, or null if the mod_id is invalid.
155
- static func get_mod_data (mod_id : String ) -> ModData :
156
- if not ModLoaderStore .mod_data .has (mod_id ):
157
- ModLoaderLog .error ("%s is an invalid mod_id" % mod_id , LOG_NAME )
158
- return null
159
-
160
- return ModLoaderStore .mod_data [mod_id ]
161
-
162
-
163
- # Gets the ModData of all loaded Mods as Dictionary.
164
- #
165
- # Returns:
166
- # - Dictionary: A dictionary containing the ModData of all loaded mods.
167
- static func get_mod_data_all () -> Dictionary :
168
- return ModLoaderStore .mod_data
169
-
170
-
171
- # Returns true if the mod with the given mod_id was successfully loaded.
172
- #
173
- # Parameters:
174
- # - mod_id (String): The ID of the mod.
175
- #
176
- # Returns:
177
- # - bool: true if the mod is loaded, false otherwise.
178
- static func is_mod_loaded (mod_id : String ) -> bool :
179
- if ModLoaderStore .is_initializing :
180
- ModLoaderLog .warning (
181
- "The ModLoader is not fully initialized. " +
182
- "Calling \" is_mod_loaded()\" in \" _init()\" may result in an unexpected return value as mods are still loading." ,
183
- LOG_NAME
184
- )
185
-
186
- # If the mod is not present in the mod_data dictionary or the mod is flagged as not loadable.
187
- if not ModLoaderStore .mod_data .has (mod_id ) or not ModLoaderStore .mod_data [mod_id ].is_loadable :
188
- return false
189
-
190
- return true
191
-
192
-
193
78
# Appends a new node to a modified scene.
194
79
#
195
80
# Parameters:
@@ -236,9 +121,54 @@ static func save_scene(modified_scene: Node, scene_path: String) -> void:
236
121
ModLoaderStore .saved_objects .append (packed_scene )
237
122
238
123
124
+ # Gets the ModData from the provided namespace
125
+ #
126
+ # Parameters:
127
+ # - mod_id (String): The ID of the mod.
128
+ #
129
+ # Returns:
130
+ # - ModData: The ModData associated with the provided mod_id, or null if the mod_id is invalid.
131
+ static func get_mod_data (mod_id : String ) -> ModData :
132
+ if not ModLoaderStore .mod_data .has (mod_id ):
133
+ ModLoaderLog .error ("%s is an invalid mod_id" % mod_id , LOG_NAME )
134
+ return null
135
+
136
+ return ModLoaderStore .mod_data [mod_id ]
137
+
138
+
139
+ # Gets the ModData of all loaded Mods as Dictionary.
140
+ #
141
+ # Returns:
142
+ # - Dictionary: A dictionary containing the ModData of all loaded mods.
143
+ static func get_mod_data_all () -> Dictionary :
144
+ return ModLoaderStore .mod_data
145
+
146
+
239
147
# Returns the path to the directory where unpacked mods are stored.
240
148
#
241
149
# Returns:
242
150
# - String: The path to the unpacked mods directory.
243
151
static func get_unpacked_dir () -> String :
244
152
return _ModLoaderPath .get_unpacked_mods_dir_path ()
153
+
154
+
155
+ # Returns true if the mod with the given mod_id was successfully loaded.
156
+ #
157
+ # Parameters:
158
+ # - mod_id (String): The ID of the mod.
159
+ #
160
+ # Returns:
161
+ # - bool: true if the mod is loaded, false otherwise.
162
+ static func is_mod_loaded (mod_id : String ) -> bool :
163
+ if ModLoaderStore .is_initializing :
164
+ ModLoaderLog .warning (
165
+ "The ModLoader is not fully initialized. " +
166
+ "Calling \" is_mod_loaded()\" in \" _init()\" may result in an unexpected return value as mods are still loading." ,
167
+ LOG_NAME
168
+ )
169
+
170
+ # If the mod is not present in the mod_data dictionary or the mod is flagged as not loadable.
171
+ if not ModLoaderStore .mod_data .has (mod_id ) or not ModLoaderStore .mod_data [mod_id ].is_loadable :
172
+ return false
173
+
174
+ return true
0 commit comments