-
Notifications
You must be signed in to change notification settings - Fork 37
refactor: 🚚 Moved methods handling mod state #283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
KANAjetzt
merged 2 commits into
GodotModding:development
from
KANAjetzt:refactor_add_ModLoaderModManager
Jun 19, 2023
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# This Class provides methods to manage mod state. | ||
# *Note: Intended to be used by game developers.* | ||
class_name ModLoaderModManager | ||
extends Reference | ||
|
||
|
||
const LOG_NAME := "ModLoader:Manager" | ||
|
||
|
||
# Uninstall a script extension. | ||
# | ||
# Parameters: | ||
# - extension_script_path (String): The path to the extension script to be uninstalled. | ||
# | ||
# Returns: void | ||
static func uninstall_script_extension(extension_script_path: String) -> void: | ||
# Currently this is the only thing we do, but it is better to expose | ||
# this function like this for further changes | ||
_ModLoaderScriptExtension.remove_specific_extension_from_script(extension_script_path) | ||
|
||
|
||
# Reload all mods. | ||
# | ||
# *Note: This function should be called only when actually necessary | ||
# as it can break the game and require a restart for mods | ||
# that do not fully use the systems put in place by the mod loader, | ||
# so anything that just uses add_node, move_node ecc... | ||
# To not have your mod break on reload please use provided functions | ||
# like ModLoader::save_scene, ModLoader::append_node_in_scene and | ||
# all the functions that will be added in the next versions | ||
# Used to reload already present mods and load new ones* | ||
# | ||
# Returns: void | ||
func reload_mods() -> void: | ||
|
||
# Currently this is the only thing we do, but it is better to expose | ||
# this function like this for further changes | ||
ModLoader._reload_mods() | ||
|
||
|
||
# Disable all mods. | ||
# | ||
# *Note: This function should be called only when actually necessary | ||
# as it can break the game and require a restart for mods | ||
# that do not fully use the systems put in place by the mod loader, | ||
# so anything that just uses add_node, move_node ecc... | ||
# To not have your mod break on disable please use provided functions | ||
# and implement a _disable function in your mod_main.gd that will | ||
# handle removing all the changes that were not done through the Mod Loader* | ||
# | ||
# Returns: void | ||
func disable_mods() -> void: | ||
|
||
# Currently this is the only thing we do, but it is better to expose | ||
# this function like this for further changes | ||
ModLoader._disable_mods() | ||
|
||
|
||
# Disable a mod. | ||
# | ||
# *Note: This function should be called only when actually necessary | ||
# as it can break the game and require a restart for mods | ||
# that do not fully use the systems put in place by the mod loader, | ||
# so anything that just uses add_node, move_node ecc... | ||
# To not have your mod break on disable please use provided functions | ||
# and implement a _disable function in your mod_main.gd that will | ||
# handle removing all the changes that were not done through the Mod Loader* | ||
# | ||
# Parameters: | ||
# - mod_data (ModData): The ModData object representing the mod to be disabled. | ||
# | ||
# Returns: void | ||
func disable_mod(mod_data: ModData) -> void: | ||
|
||
# Currently this is the only thing we do, but it is better to expose | ||
# this function like this for further changes | ||
ModLoader._disable_mod(mod_data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.