Modpack compatibility prompt, GameComparator clean-up #4056
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.
Motivations
If you try to install a modpack from a .ckan file, you may have (potentially much) narrower compatibility settings than the modpack creator, which can prevent some dependencies from being found and make the installation fail.
In #3675, we added a prompt to notify users when this might happen:
However, this doesn't really present a clear, reliable path forward for the user; if they click Cancel, the installation aborts, and if they click Install, the installation will continue but might fail. What we really need is a way to guide users to extend their compatibility settings so the install can both continue and succeed.
Changes
Now before that prompt appears, a better one shows up:
If the user clicks "Add compatible versions", then we auto-update their compatibility settings to be a superset of the modpack's compatibility (which is based on the modpack .ckan file's
ksp_version_min
andksp_version_max
settings, which are based on the compatibility settings of the modpack creator), which should guarantee a successful install. If they instead click "Keep current compatibility", then we leave their settings alone, and they will still get warned about any specific incompatibilities.Other changes
While developing this, I noticed some problems with the
IGameComparator
family of classes:GrasGameComparator
treats version1.0.4
as implicitly compatible with1.0.3
, which is KSP1-specific logic that should not be applied to other games. It's very unlikely that anyone is relying on this behavior, and if they are, the compatible versions setting is a better approach anyway.YoyoGameComparator
isn't used for anythingThese classes and the files containing them are now deleted, and we now only use
StrictGameComparator
to check module compatibility.