further simplify console output for players

This commit is contained in:
Jesse Plamondon-Willard 2017-07-02 20:51:49 -04:00
parent 698328c52f
commit 0e6d30f65b
2 changed files with 18 additions and 10 deletions

View File

@ -13,9 +13,7 @@ For mod developers:
See [log](https://github.com/Pathoschild/SMAPI/compare/1.14...1.15).
For players:
* SMAPI no longer loads mods known to be obsolete or unneeded.
* SMAPI now lists mods in an easier-to-read format in the console.
* When the `ObjectInformation.xnb` is broken, SMAPI now prints one error to the console instead of a warning flood. (The individual issues are still listed in the log file if needed.)
* Many changes to the SMAPI console to make it simpler for players.
* Revamped TrainerMod's item commands:
* `player_add` is a new command which lets you add any game item to your inventory (including tools, weapons, equipment, craftables, wallpaper, etc). This replaces the former `player_additem`, `player_addring`, and `player_addweapon`.
* `list_items` now shows all items in the game. You can search by item type like `list_items weapon`, or search by item name like `list_items galaxy sword`.
@ -23,11 +21,13 @@ For players:
* `list_item_types` is a new command to see a list of item types.
* Added clearer error when a `config.json` is invalid.
* Fixed rare crash when window loses focus for a few players (further to fix in 1.14).
* Fixed invalid `ObjectInformation.xnb` causing a flood of warnings; SMAPI now shows one error instead.
* Updated mod compatibility list.
For modders:
* You can now specify minimum dependency versions in `manifest.json`.
* Added `System.ValueTuple.dll` to the SMAPI install package so mods can use [C# 7 value tuples](https://docs.microsoft.com/en-us/dotnet/csharp/tuples).
* Cleaned up SMAPI logging when loading mods.
* Added more useful trace logging when loading mods.
* Changed `manifest.MinimumApiVersion` from string to `ISemanticVersion`.
* Fixed `SemanticVersion` parsing some invalid versions into close approximations (like `1.apple` → `1.0-apple`).
* Fixed `SemanticVersion` not treating hyphens as separators when comparing prerelease tags.

View File

@ -126,7 +126,7 @@ namespace StardewModdingAPI
// init logging
this.Monitor.Log($"SMAPI {Constants.ApiVersion} with Stardew Valley {Constants.GetGameDisplayVersion(Constants.GameVersion)} on {this.GetFriendlyPlatformName()}", LogLevel.Info);
this.Monitor.Log($"Mods go here: {Constants.ModPath}");
this.Monitor.Log("Preparing SMAPI...");
this.Monitor.Log("Starting SMAPI...");
// validate paths
this.VerifyPath(Constants.ModPath);
@ -361,7 +361,7 @@ namespace StardewModdingAPI
// load mods
{
this.Monitor.Log("Loading mod metadata...");
this.Monitor.Log("Loading mod metadata...", LogLevel.Trace);
ModResolver resolver = new ModResolver();
// load manifests
@ -445,7 +445,6 @@ namespace StardewModdingAPI
private void RunConsoleLoop()
{
// prepare console
this.Monitor.Log("Starting console...");
this.Monitor.Log("Type 'help' for help, or 'help <cmd>' for a command's usage", LogLevel.Info);
this.CommandManager.Add("SMAPI", "help", "Lists command documentation.\n\nUsage: help\nLists all available commands.\n\nUsage: help <cmd>\n- cmd: The name of a command whose documentation to display.", this.HandleCommand);
this.CommandManager.Add("SMAPI", "reload_i18n", "Reloads translation files for all mods.\n\nUsage: reload_i18n", this.HandleCommand);
@ -580,7 +579,7 @@ namespace StardewModdingAPI
/// <param name="deprecationWarnings">A list to populate with any deprecation warnings.</param>
private void LoadMods(IModMetadata[] mods, JsonHelper jsonHelper, SContentManager contentManager, IList<Action> deprecationWarnings)
{
this.Monitor.Log("Loading mods...");
this.Monitor.Log("Loading mods...", LogLevel.Trace);
// load mod assemblies
IDictionary<IModMetadata, string> skippedMods = new Dictionary<IModMetadata, string>();
@ -810,8 +809,17 @@ namespace StardewModdingAPI
}
else
{
this.Monitor.Log("The following commands are registered: " + string.Join(", ", this.CommandManager.GetAll().Select(p => p.Name)) + ".", LogLevel.Info);
this.Monitor.Log("For more information about a command, type 'help command_name'.", LogLevel.Info);
string message = "The following commands are registered:\n";
IGrouping<string, string>[] groups = (from command in this.CommandManager.GetAll() orderby command.ModName, command.Name group command.Name by command.ModName).ToArray();
foreach (var group in groups)
{
string modName = group.Key;
string[] commandNames = group.ToArray();
message += $"{modName}:\n {string.Join("\n ", commandNames)}\n\n";
}
message += "For more information about a command, type 'help command_name'.";
this.Monitor.Log(message, LogLevel.Info);
}
break;