Skip to content
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

add feature manager and according interfaces alongside BasicMod<T> implementation #22

Merged
merged 10 commits into from
Aug 21, 2024

Conversation

Keymasterer44
Copy link
Collaborator

This PR adds a ModFeature, ModFeatureManager, IModFeature, IModFeatureManager, IFeatureModLoaded, and implementation of IFeatureModLoaded in BasicMod to NeoModLoader.api, including documentation for all public members that were added.
The ModFeatureManager system is inspired by a FeatureManager class I recently added to the PowerBox mod, and it improves upon the system used within PowerBox in the form of improved reusability and more robust logging capabilities.
To use it, NML mods using BasicMod can simply create new classes that extend ModFeature or new classes that implement IModFeature, and then invoke the Init() method on the FeatureManager property provided to them via inheritance from BasicMod to make the feature manager automatically load all features dynamically in a manner that fulfills all specified dependencies. Alternatively, mods that do direct implementations of IMod can leverage the feature management system too by creating their own instance of ModFeatureManager or by programming their own implementation of IModFeatureManager.
The benefit of using ModFeatureManager over more traditional loading approaches is that it maximizes mod reliability and stability by ensuring that errors in specific features have as few downstream effects on other parts of the mod as possible, while traditional loading approaches tend to cause the entire mod to crash once a single error occurs upon initialization.

Note/Warning: The current standard implementation of IModFeatureManager does not account for circular dependencies, they would result in an infinite loop if they happened.

@Keymasterer44 Keymasterer44 added documentation Improvements or additions to documentation enhancement New feature or request labels Aug 20, 2024
@Keymasterer44 Keymasterer44 self-assigned this Aug 20, 2024
@inmny inmny merged commit 8b8cb36 into master Aug 21, 2024
2 checks passed
@inmny inmny deleted the keymasterer-add-feature-manager branch August 21, 2024 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants