From cdd62515ea1710c762dc787fae188e7d41890f7e Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 22 Apr 2023 11:55:39 -0400 Subject: add multiplayer player type to window titles --- docs/release-notes.md | 1 + src/SMAPI/Framework/SCore.cs | 17 ++++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/docs/release-notes.md b/docs/release-notes.md index 8c3c498c..8e8e1981 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -10,6 +10,7 @@ ## Upcoming release * For players: * Added support for overriding SMAPI configuration per `Mods` folder (thanks to Shockah!). + * In multiplayer, the game/SMAPI window titles now show whether you're the main player or a farmhand. * Fixed logged SMAPI errors not having line numbers on Linux/macOS. * For mod authors: diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs index 3e179ef7..10f2821c 100644 --- a/src/SMAPI/Framework/SCore.cs +++ b/src/SMAPI/Framework/SCore.cs @@ -854,6 +854,9 @@ namespace StardewModdingAPI.Framework this.Monitor.Log(context); + // add context to window titles + this.UpdateWindowTitles(); + // raise events this.OnLoadStageChanged(LoadStage.Ready); events.SaveLoaded.RaiseEmpty(); @@ -1205,6 +1208,7 @@ namespace StardewModdingAPI.Framework case LoadStage.None: this.JustReturnedToTitle = true; + this.UpdateWindowTitles(); break; case LoadStage.Loaded: @@ -1452,15 +1456,14 @@ namespace StardewModdingAPI.Framework string consoleTitle = $"SMAPI {Constants.ApiVersion} - running Stardew Valley {Constants.GameVersion}"; string gameTitle = $"Stardew Valley {Constants.GameVersion} - running SMAPI {Constants.ApiVersion}"; + string suffix = ""; if (this.ModRegistry.AreAllModsLoaded) - { - int modsLoaded = this.ModRegistry.GetAll().Count(); - consoleTitle += $" with {modsLoaded} mods"; - gameTitle += $" with {modsLoaded} mods"; - } + suffix += $" with {this.ModRegistry.GetAll().Count()} mods"; + if (Context.IsMultiplayer) + suffix += $" [{(Context.IsMainPlayer ? "main player" : "farmhand")}]"; - this.Game.Window.Title = gameTitle; - this.LogManager.SetConsoleTitle(consoleTitle); + this.Game.Window.Title = gameTitle + suffix; + this.LogManager.SetConsoleTitle(consoleTitle + suffix); } /// Log a warning if software known to cause issues is installed. -- cgit