summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI/Framework')
-rw-r--r--src/SMAPI/Framework/ModLoading/ModResolver.cs36
-rw-r--r--src/SMAPI/Framework/SCore.cs2
2 files changed, 35 insertions, 3 deletions
diff --git a/src/SMAPI/Framework/ModLoading/ModResolver.cs b/src/SMAPI/Framework/ModLoading/ModResolver.cs
index 08df7b76..af7d90f6 100644
--- a/src/SMAPI/Framework/ModLoading/ModResolver.cs
+++ b/src/SMAPI/Framework/ModLoading/ModResolver.cs
@@ -72,7 +72,7 @@ namespace StardewModdingAPI.Framework.ModLoading
switch (mod.DataRecord?.Status)
{
case ModStatus.Obsolete:
- mod.SetStatus(ModMetadataStatus.Failed, ModFailReason.Obsolete, $"it's obsolete: {mod.DataRecord.StatusReasonPhrase}");
+ mod.SetStatus(ModMetadataStatus.Failed, ModFailReason.Obsolete, $"it's obsolete: {mod.DataRecord.StatusReasonPhrase}", this.GetTechnicalReasonForStatusOverride(mod));
continue;
case ModStatus.AssumeBroken:
@@ -102,7 +102,7 @@ namespace StardewModdingAPI.Framework.ModLoading
error += $"version newer than {mod.DataRecord.StatusUpperVersion}";
error += " at " + string.Join(" or ", updateUrls);
- mod.SetStatus(ModMetadataStatus.Failed, ModFailReason.Incompatible, error);
+ mod.SetStatus(ModMetadataStatus.Failed, ModFailReason.Incompatible, error, this.GetTechnicalReasonForStatusOverride(mod));
}
continue;
}
@@ -409,6 +409,38 @@ namespace StardewModdingAPI.Framework.ModLoading
yield return new ModDependency(manifest.ContentPackFor.UniqueID, manifest.ContentPackFor.MinimumVersion, FindMod(manifest.ContentPackFor.UniqueID), isRequired: true);
}
+ /// <summary>Get a technical message indicating why a mod's compatibility status was overridden, if applicable.</summary>
+ /// <param name="mod">The mod metadata.</param>
+ private string GetTechnicalReasonForStatusOverride(IModMetadata mod)
+ {
+ // get compatibility list record
+ var data = mod.DataRecord;
+ if (data == null)
+ return null;
+
+ // get status label
+ string statusLabel = data.Status switch
+ {
+ ModStatus.AssumeBroken => "'assume broken'",
+ ModStatus.AssumeCompatible => "'assume compatible'",
+ ModStatus.Obsolete => "obsolete",
+ _ => data.Status.ToString()
+ };
+
+ // get reason
+ string[] reasons = new[] { mod.DataRecord.StatusReasonPhrase, mod.DataRecord.StatusReasonDetails }
+ .Where(p => !string.IsNullOrWhiteSpace(p))
+ .ToArray();
+
+ // build message
+ return
+ $"marked {statusLabel} in SMAPI's internal compatibility list for "
+ + (mod.DataRecord.StatusUpperVersion != null ? $"versions up to {mod.DataRecord.StatusUpperVersion}" : "all versions")
+ + ": "
+ + (reasons.Any() ? string.Join(": ", reasons) : "no reason given")
+ + ".";
+ }
+
/*********
** Private models
diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs
index e05213f0..27540442 100644
--- a/src/SMAPI/Framework/SCore.cs
+++ b/src/SMAPI/Framework/SCore.cs
@@ -1532,7 +1532,7 @@ namespace StardewModdingAPI.Framework
// validate status
if (mod.Status == ModMetadataStatus.Failed)
{
- this.Monitor.Log($" Failed: {mod.Error}");
+ this.Monitor.Log($" Failed: {mod.ErrorDetails ?? mod.Error}");
failReason = mod.FailReason;
errorReasonPhrase = mod.Error;
return false;