add new game build number to the SMAPI log

This commit is contained in:
Jesse Plamondon-Willard 2021-12-21 20:33:08 -05:00
parent 0d7d447600
commit 52f4df3f30
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
3 changed files with 13 additions and 1 deletions

View File

@ -4,6 +4,7 @@
## Upcoming release
* For players:
* SMAPI now auto-fixes maps loaded without a required tilesheet to prevent errors.
* Added the new game build number to the SMAPI console + log.
* Fixed outdated instructions in Steam error message.
* Simplified [running without a terminal on Linux/macOS](https://stardewvalleywiki.com/Modding:Player_Guide/Troubleshooting#SMAPI_doesn.27t_recognize_controller_.28Steam_only.29) when needed.
* Updated compatibility list.

View File

@ -340,5 +340,16 @@ namespace StardewModdingAPI
// if save doesn't exist yet, return the default one we expect to be created
return folder;
}
/// <summary>Get a display label for the game's build number.</summary>
internal static string GetBuildVersionLabel()
{
string version = typeof(Game1).Assembly.GetName().Version?.ToString() ?? "unknown";
if (version.StartsWith($"{Game1.version}."))
version = version.Substring(Game1.version.Length + 1);
return version;
}
}
}

View File

@ -262,7 +262,7 @@ namespace StardewModdingAPI.Framework.Logging
public void LogIntro(string modsPath, IDictionary<string, object> customSettings)
{
// log platform
this.Monitor.Log($"SMAPI {Constants.ApiVersion} with Stardew Valley {Constants.GameVersion} on {EnvironmentUtility.GetFriendlyPlatformName(Constants.Platform)}", LogLevel.Info);
this.Monitor.Log($"SMAPI {Constants.ApiVersion} with Stardew Valley {Constants.GameVersion} (build {Constants.GetBuildVersionLabel()}) on {EnvironmentUtility.GetFriendlyPlatformName(Constants.Platform)}", LogLevel.Info);
// log basic info
this.Monitor.Log($"Mods go here: {modsPath}", LogLevel.Info);