summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--release-notes.md3
-rw-r--r--src/StardewModdingAPI/Framework/Models/IncompatibleMod.cs18
-rw-r--r--src/StardewModdingAPI/Program.cs2
-rw-r--r--src/StardewModdingAPI/StardewModdingAPI.data.json10
4 files changed, 21 insertions, 12 deletions
diff --git a/release-notes.md b/release-notes.md
index 6cedbc4f..6c667c31 100644
--- a/release-notes.md
+++ b/release-notes.md
@@ -8,6 +8,9 @@ For players:
* Fixed issue where SMAPI couldn't be launched from Steam for some Linux players.
* Updated list of incompatible mods.
+For SMAPI developers:
+ * Added support for specifying a lower bound in mod incompatibility data.
+
## 1.5
See [log](https://github.com/Pathoschild/SMAPI/compare/1.4...1.5).
diff --git a/src/StardewModdingAPI/Framework/Models/IncompatibleMod.cs b/src/StardewModdingAPI/Framework/Models/IncompatibleMod.cs
index 9bf06552..bcc62bb4 100644
--- a/src/StardewModdingAPI/Framework/Models/IncompatibleMod.cs
+++ b/src/StardewModdingAPI/Framework/Models/IncompatibleMod.cs
@@ -14,8 +14,11 @@ namespace StardewModdingAPI.Framework.Models
/// <summary>The mod name.</summary>
public string Name { get; set; }
+ /// <summary>The oldest incompatible mod version, or <c>null</c> for all past versions.</summary>
+ public string LowerVersion { get; set; }
+
/// <summary>The most recent incompatible mod version.</summary>
- public string Version { get; set; }
+ public string UpperVersion { get; set; }
/// <summary>The URL the user can check for an official updated version.</summary>
public string UpdateUrl { get; set; }
@@ -23,7 +26,7 @@ namespace StardewModdingAPI.Framework.Models
/// <summary>The URL the user can check for an unofficial updated version.</summary>
public string UnofficialUpdateUrl { get; set; }
- /// <summary>A regular expression matching version strings to consider compatible, even if they technically precede <see cref="Version"/>.</summary>
+ /// <summary>A regular expression matching version strings to consider compatible, even if they technically precede <see cref="UpperVersion"/>.</summary>
public string ForceCompatibleVersion { get; set; }
@@ -34,14 +37,17 @@ namespace StardewModdingAPI.Framework.Models
/// <param name="version">The current version of the matching mod.</param>
public bool IsCompatible(ISemanticVersion version)
{
- ISemanticVersion incompatibleVersion = new SemanticVersion(this.Version);
+ ISemanticVersion lowerVersion = this.LowerVersion != null ? new SemanticVersion(this.LowerVersion) : null;
+ ISemanticVersion upperVersion = new SemanticVersion(this.UpperVersion);
- // allow newer versions
- if (version.IsNewerThan(incompatibleVersion))
+ // ignore versions not in range
+ if (lowerVersion != null && version.IsOlderThan(lowerVersion))
+ return true;
+ if (version.IsNewerThan(upperVersion))
return true;
// allow versions matching override
return !string.IsNullOrWhiteSpace(this.ForceCompatibleVersion) && Regex.IsMatch(version.ToString(), this.ForceCompatibleVersion, RegexOptions.IgnoreCase);
}
}
-} \ No newline at end of file
+}
diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs
index 58dbd87d..9d08c823 100644
--- a/src/StardewModdingAPI/Program.cs
+++ b/src/StardewModdingAPI/Program.cs
@@ -402,7 +402,7 @@ namespace StardewModdingAPI
{
if (!compatibility.IsCompatible(manifest.Version))
{
- string warning = $"Skipped {compatibility.Name} ≤v{compatibility.Version} because this version is not compatible with the latest version of the game. Please check for a newer version of the mod here:";
+ string warning = $"Skipped {compatibility.Name} {manifest.Version} because this version is not compatible with the latest version of the game. Please check for a newer version of the mod here:";
if (!string.IsNullOrWhiteSpace(compatibility.UpdateUrl))
warning += $"{Environment.NewLine}- official mod: {compatibility.UpdateUrl}";
if (!string.IsNullOrWhiteSpace(compatibility.UnofficialUpdateUrl))
diff --git a/src/StardewModdingAPI/StardewModdingAPI.data.json b/src/StardewModdingAPI/StardewModdingAPI.data.json
index f350e8c5..464286af 100644
--- a/src/StardewModdingAPI/StardewModdingAPI.data.json
+++ b/src/StardewModdingAPI/StardewModdingAPI.data.json
@@ -9,15 +9,15 @@ This file contains advanced metadata for SMAPI. You shouldn't change this file.
{
"ID": "SPDSprinklersMod",
"Name": "Better Sprinklers",
- "Version": "2.1",
+ "UpperVersion": "2.1",
"UpdateUrl": "http://www.nexusmods.com/stardewvalley/mods/41",
"UnofficialUpdateUrl": "http://community.playstarbound.com/threads/125031",
- "ForceCompatibleVersion": "^2.1-EntoPatch"
+ "ForceCompatibleVersion": "^2.1-EntoPatch"
},
{
"ID": "SPDChestLabel",
"Name": "Chest Label System",
- "Version": "1.5",
+ "UpperVersion": "1.5",
"UpdateUrl": "http://www.nexusmods.com/stardewvalley/mods/242",
"UnofficialUpdateUrl": "http://community.playstarbound.com/threads/125031",
"ForceCompatibleVersion": "^1.5-EntoPatch"
@@ -25,14 +25,14 @@ This file contains advanced metadata for SMAPI. You shouldn't change this file.
{
"ID": "CJBCheatsMenu",
"Name": "CJB Cheats Menu",
- "Version": "1.12",
+ "UpperVersion": "1.12",
"UpdateUrl": "http://www.nexusmods.com/stardewvalley/mods/4",
"ForceCompatibleVersion": "^1.12-EntoPatch"
},
{
"ID": "CJBItemSpawner",
"Name": "CJB Item Spawner",
- "Version": "1.5",
+ "UpperVersion": "1.5",
"UpdateUrl": "http://www.nexusmods.com/stardewvalley/mods/93",
"ForceCompatibleVersion": "^1.5-EntoPatch"
}