Skip to content

Commit 10d048d

Browse files
authored
refactor: 🔥 removed ModLoaderModManager (#540)
* refactor: 🔥 removed `ModLoaderModManager` * refactor: 🔥 don't forget removing the self setup class too
1 parent 6119166 commit 10d048d

File tree

3 files changed

+0
-188
lines changed

3 files changed

+0
-188
lines changed

addons/mod_loader/api/mod_manager.gd

Lines changed: 0 additions & 77 deletions
This file was deleted.

addons/mod_loader/internal/script_extension.gd

Lines changed: 0 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -154,108 +154,3 @@ static func _reload_vanilla_child_classes_for(script: Script) -> void:
154154
for child_class in classes:
155155
if child_class.base == _class.get_class():
156156
load(child_class.path).reload()
157-
158-
159-
# Used to remove a specific extension
160-
static func remove_specific_extension_from_script(extension_path: String) -> void:
161-
# Check path to file exists
162-
if not _ModLoaderFile.file_exists(extension_path):
163-
ModLoaderLog.error(
164-
'The extension script path "%s" does not exist' % [extension_path], LOG_NAME
165-
)
166-
return
167-
168-
var extension_script: Script = ResourceLoader.load(extension_path)
169-
var parent_script: Script = extension_script.get_base_script()
170-
var parent_script_path: String = parent_script.resource_path
171-
172-
# Check if the script to reset has been extended
173-
if not ModLoaderStore.saved_scripts.has(parent_script_path):
174-
ModLoaderLog.error(
175-
'The extension parent script path "%s" has not been extended' % [parent_script_path],
176-
LOG_NAME
177-
)
178-
return
179-
180-
# Check if the script to reset has anything actually saved
181-
# If we ever encounter this it means something went very wrong in extending
182-
if not ModLoaderStore.saved_scripts[parent_script_path].size() > 0:
183-
ModLoaderLog.error(
184-
(
185-
'The extension script path "%s" does not have the base script saved, this should never happen, if you encounter this please create an issue in the github repository'
186-
% [parent_script_path]
187-
),
188-
LOG_NAME
189-
)
190-
return
191-
192-
var parent_script_extensions: Array = ModLoaderStore.saved_scripts[parent_script_path].duplicate()
193-
parent_script_extensions.remove_at(0)
194-
195-
# Searching for the extension that we want to remove
196-
var found_script_extension: Script = null
197-
for script_extension in parent_script_extensions:
198-
if script_extension.get_meta("extension_script_path") == extension_path:
199-
found_script_extension = script_extension
200-
break
201-
202-
if found_script_extension == null:
203-
ModLoaderLog.error(
204-
(
205-
'The extension script path "%s" has not been found in the saved extension of the base script'
206-
% [parent_script_path]
207-
),
208-
LOG_NAME
209-
)
210-
return
211-
parent_script_extensions.erase(found_script_extension)
212-
213-
# Preparing the script to have all other extensions reapllied
214-
_remove_all_extensions_from_script(parent_script_path)
215-
216-
# Reapplying all the extensions without the removed one
217-
for script_extension in parent_script_extensions:
218-
apply_extension(script_extension.get_meta("extension_script_path"))
219-
220-
221-
# Used to fully reset the provided script to a state prior of any extension
222-
static func _remove_all_extensions_from_script(parent_script_path: String) -> void:
223-
# Check path to file exists
224-
if not _ModLoaderFile.file_exists(parent_script_path):
225-
ModLoaderLog.error(
226-
'The parent script path "%s" does not exist' % [parent_script_path], LOG_NAME
227-
)
228-
return
229-
230-
# Check if the script to reset has been extended
231-
if not ModLoaderStore.saved_scripts.has(parent_script_path):
232-
ModLoaderLog.error(
233-
'The parent script path "%s" has not been extended' % [parent_script_path], LOG_NAME
234-
)
235-
return
236-
237-
# Check if the script to reset has anything actually saved
238-
# If we ever encounter this it means something went very wrong in extending
239-
if not ModLoaderStore.saved_scripts[parent_script_path].size() > 0:
240-
ModLoaderLog.error(
241-
(
242-
'The parent script path "%s" does not have the base script saved, \nthis should never happen, if you encounter this please create an issue in the github repository'
243-
% [parent_script_path]
244-
),
245-
LOG_NAME
246-
)
247-
return
248-
249-
var parent_script: Script = ModLoaderStore.saved_scripts[parent_script_path][0]
250-
parent_script.take_over_path(parent_script_path)
251-
252-
# Remove the script after it has been reset so we do not do it again
253-
ModLoaderStore.saved_scripts.erase(parent_script_path)
254-
255-
256-
# Used to remove all extensions that are of a specific mod
257-
static func remove_all_extensions_of_mod(mod: ModData) -> void:
258-
var _to_remove_extension_paths: Array = ModLoaderStore.saved_extension_paths[mod.manifest.get_mod_id()]
259-
for extension_path in _to_remove_extension_paths:
260-
remove_specific_extension_from_script(extension_path)
261-
ModLoaderStore.saved_extension_paths.erase(mod.manifest.get_mod_id())

addons/mod_loader/setup/global_script_class_cache_mod_loader.cfg

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,6 @@ list=Array[Dictionary]([{
5353
"language": &"GDScript",
5454
"path": "res://addons/mod_loader/api/mod.gd"
5555
}, {
56-
"base": &"RefCounted",
57-
"class": &"ModLoaderModManager",
58-
"icon": "",
59-
"language": &"GDScript",
60-
"path": "res://addons/mod_loader/api/mod_manager.gd"
61-
}, {
6256
"base": &"Resource",
6357
"class": &"ModLoaderOptionsProfile",
6458
"icon": "",

0 commit comments

Comments
 (0)