-
Notifications
You must be signed in to change notification settings - Fork 23
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
Refactoring of game features for better management. #146
Merged
Holt59
merged 4 commits into
ModOrganizer2:master
from
Holt59:dev/game-features-refactoring
Jun 9, 2024
Merged
Refactoring of game features for better management. #146
Holt59
merged 4 commits into
ModOrganizer2:master
from
Holt59:dev/game-features-refactoring
Jun 9, 2024
Conversation
This file contains 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 was referenced Jun 2, 2024
Merged
Merged
Merged
Merged
Merged
Merged
Merged
Merged
Merged
Merged
Merged
Merged
Merged
Merged
Merged
Merged
Holt59
force-pushed
the
dev/game-features-refactoring
branch
from
June 8, 2024 17:18
6b137b9
to
ce0d751
Compare
This was referenced Jun 9, 2024
Merged
This was referenced Jun 9, 2024
Merged
Merged
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Global refactoring of game features management
TL;DR; This changes the way game features are specified to ModOrganizer2 to allow any third-party plugin to set/modify game features.
Why?
The main benefit is for features such as
ModDataChecker
andModDataContent
, e.g., the root-builder plugin might want to consider mod withRoot/
as valid, while this is not a default.I have not implemented it but this makes adding settings for custom valid folder/files or custom contents very easy.
How?
This adds a new abstract interface
IGameFeatures
that is available throughIOrganizer::gameFeatures
that exposes various function to register, unregister and access game features.A game feature is enabled if
A game feature has a priority
GamePlugins
feature, the one with the highest priority will be used)ModDataChecker
/ModDataContent
), this indicates the order in which the feature are used.In practice, I don't think the priority will matter much, even for
ModDataChecker
(MO2 will check feature until one returnVALID
orFIXABLE
), but maybe in the future this will be useful so I implemented it.Game features registered by game plugins have lowest priority, by choice. I think this makes sense but this could be changed easily.
Details
This refactors a lot of stuff and has wide impacts on existing plugins but that is a choice I made. I could have added the new system alongside the existing one, but after trying, it was annoying to work with and error prone (letting the old system in place means plugins could still access the old features instead of the new ones).
I never liked the way game feature were implemented, they felt out-of-place, with very ugly tricks to handle them (
std::any
, etc.). With these changes, all feature inheritsGameFeature
and you cannot register a class for the wrong feature (which was possible before), which makes code less error prone.The use of
std::shared_ptr
for handling game features is mostly dictated by the Python proxy plugin.This PR impacts all MO2 plugins (C++ / Python) that use game features, and I made PR for all of them (repository that do not have similar PR are not impacted by these changes).