add feature manager and according interfaces alongside BasicMod<T> implementation #22
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.
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.